mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
Issue 9732: remove use of __class__ in inspect.getattr_static and note the mro exception to code execution
This commit is contained in:
parent
45ec426157
commit
cc7ebb8f69
3 changed files with 18 additions and 4 deletions
|
@ -855,6 +855,18 @@ class TestGetattrStatic(unittest.TestCase):
|
|||
self.assertEqual(inspect.getattr_static(Thing, 'd'), meta.__dict__['d'])
|
||||
|
||||
|
||||
def test_class_as_property(self):
|
||||
class Base(object):
|
||||
foo = 3
|
||||
|
||||
class Something(Base):
|
||||
@property
|
||||
def __class__(self):
|
||||
return object
|
||||
|
||||
self.assertEqual(inspect.getattr_static(Something(), 'foo'), 3)
|
||||
self.assertEqual(inspect.getattr_static(Something, 'foo'), 3)
|
||||
|
||||
def test_main():
|
||||
run_unittest(
|
||||
TestDecorators, TestRetrievingSourceCode, TestOneliners, TestBuggyCases,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue