mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
builtin_dir(): Treat classic classes like types. Use PyDict_Keys instead
of PyMapping_Keys because we know we have a real dict. Tolerate that objects may have an attr named "__dict__" that's not a dict (Py_None popped up during testing). test_descr.py, test_dir(): Test the new classic-class behavior; beef up the new-style class test similarly. test_pyclbr.py, checkModule(): dir(C) is no longer a synonym for C.__dict__.keys() when C is a classic class (looks like the same thing that burned distutils! -- should it be *made* a synoym again? Then it would be inconsistent with new-style class behavior.).
This commit is contained in:
parent
a8aefe535c
commit
37a309db70
3 changed files with 54 additions and 30 deletions
|
@ -76,7 +76,7 @@ class PyclbrTest(unittest.TestCase):
|
|||
self.assertListEq(real_bases, pyclbr_bases, ignore)
|
||||
|
||||
actualMethods = []
|
||||
for m in dir(py_item):
|
||||
for m in py_item.__dict__.keys():
|
||||
if type(getattr(py_item, m)) == MethodType:
|
||||
actualMethods.append(m)
|
||||
foundMethods = []
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue