cpython: 8f33758df19a (original) (raw)

Mercurial > cpython

changeset 74122:8f33758df19a 3.2

Metaclasses with metaclasses with a __dict__ descriptor can no longer trigger code execution with inspect.getattr_static. Closes issue 11829. [#11829]

Michael Foord michael@voidspace.org.uk
date Thu, 22 Dec 2011 01:13:37 +0000
parents 82557279efd2
children 282a2a245278 dc913f73a7fb
files Lib/inspect.py Lib/test/test_inspect.py Misc/NEWS
diffstat 3 files changed, 25 insertions(+), 4 deletions(-)[+] [-] Lib/inspect.py 9 Lib/test/test_inspect.py 17 Misc/NEWS 3

line wrap: on

line diff

--- a/Lib/inspect.py +++ b/Lib/inspect.py @@ -1161,10 +1161,11 @@ def getattr_static(obj, attr, default=_s if obj is klass: # for types we check the metaclass too for entry in _static_getmro(type(klass)):

--- a/Lib/test/test_inspect.py +++ b/Lib/test/test_inspect.py @@ -1088,6 +1088,23 @@ class TestGetattrStatic(unittest.TestCas self.assertIsNot(inspect.getattr_static(sys, "version", sentinel), sentinel)

+

+

+

+ class TestGetGeneratorState(unittest.TestCase): def setUp(self):

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -97,6 +97,9 @@ Core and Builtins Library ------- +- Issue #11829: Fix code execution holes in inspect.getattr_static for