Issue #10160: Speed up operator.attrgetter.  Patch by Christos Georgiou.
diff --git a/Doc/library/operator.rst b/Doc/library/operator.rst
index 2d03061..efefaa6 100644
--- a/Doc/library/operator.rst
+++ b/Doc/library/operator.rst
@@ -336,6 +336,8 @@
    b.date)``.  Equivalent to::
 
       def attrgetter(*items):
+          if any(not isinstance(item, str) for item in items):
+              raise TypeError('attribute name must be a string')
           if len(items) == 1:
               attr = items[0]
               def g(obj):