[issue8297] AttributeError message text should include module name
Amaury Forgeot d'Arc
report at bugs.python.org
Thu Jul 22 09:01:27 CEST 2010
Amaury Forgeot d'Arc <amauryfa at gmail.com> added the comment:
I also like the idea; 3 remarks though:
- the patch introduces a new function that returns a PyObject*, but returns NULL when """the attribute is not found, and the caller should raise AttributeError""".
This convention is not standard among the Python API and dangerous IMO.
This part of the patch is not necessary. PyModule_GetAttr could just call PyObject_GenericGetAttr and override the current exception with a new message.
- it's not necessary to expose the function PyModule_GetAttr. It could be renamed to something like module_getattr, and be a static function. Module writers are already used to PyObject_GetAttr to access the module items, this new function brings nothing new.
- a minor nit: instead of
module object 'mod_name' has no attribute 'xxx'
I'd prefer
module 'mod_name' has no attribute 'xxx'
----------
nosy: +amaury.forgeotdarc
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8297>
_______________________________________
More information about the Python-bugs-list
mailing list