Skip to content

Commit d3f6bda

Browse files
committed
add attr check in Python fallback
1 parent 6650498 commit d3f6bda

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Lib/types.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,10 @@ def lookup_special_method(obj, attr, /):
116116
"""
117117
from inspect import getattr_static, isfunction, ismethoddescriptor
118118
cls = type(obj)
119+
if not isinstance(attr, str):
120+
raise TypeError(
121+
f"attribute name must be string, not '{type(attr).__name__}'"
122+
)
119123
try:
120124
descr = getattr_static(cls, attr)
121125
except AttributeError:

0 commit comments

Comments
 (0)