Skip to content

Commit 5cf9c4c

Browse files
authored
Removed duplicated definition of lookup_special in types.py. (#6)
1 parent 9f66dc9 commit 5cf9c4c

File tree

1 file changed

+0
-23
lines changed

1 file changed

+0
-23
lines changed

Lib/types.py

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -112,29 +112,6 @@ def lookup_special(object, name, default=_sentinel):
112112

113113
del sys, inspect _f, _g, _C, _c, _ag, _cell_factory # Not for export
114114

115-
def lookup_special(object, name, *args):
116-
"""Lookup method name `name` on `object` skipping the instance
117-
dictionary.
118-
119-
`name` must be a string. If the named special attribute does not exist,
120-
`default` is returned if provided, otherwise AttributeError is raised.
121-
"""
122-
from inspect import getattr_static
123-
cls = type(object)
124-
if not isinstance(name, str):
125-
raise TypeError(
126-
f"attribute name must be string, not '{type(name).__name__}'"
127-
)
128-
try:
129-
descr = getattr_static(cls, name)
130-
except AttributeError:
131-
if args:
132-
return args[0]
133-
raise
134-
if hasattr(descr, "__get__"):
135-
return descr.__get__(object, cls)
136-
return descr
137-
138115

139116
# Provide a PEP 3115 compliant mechanism for class creation
140117
def new_class(name, bases=(), kwds=None, exec_body=None):

0 commit comments

Comments
 (0)