New submission from Andreas Stührk <andy-pyt...@hammerhartes.de>: My patch for issue #11133 introduced a regression: it is no longer possible to get attributes of modules. That is because modules use "tp_dictoffset" (at C level). The instance __dict__ is exposed to Python code using a types.MemberDescriptorType. My patch for issue #11133 currently assumes that accessing the instance __dict__ can trigger code execution, but that is impossible: The access itself can't trigger code execution (it just returns a PyObject in the C struct). Theoretically, it could return any Python object, but that doesn't matter, as the code that uses the object only calls dict methods directly, hence a TypeError is the worst thing that can happen (although it shouldn't ever happen in practise).
Attached is a patch that adds a test and fixes the issue. ---------- components: Library (Lib) files: getattr_static_modules.patch keywords: patch messages: 133432 nosy: Trundle, michael.foord priority: normal severity: normal status: open title: inspect.getattr_static doesn't get module attributes type: behavior versions: Python 3.2, Python 3.3 Added file: http://bugs.python.org/file21596/getattr_static_modules.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue11813> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com