Amaury Forgeot d'Arc <amaur...@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 <rep...@bugs.python.org>
<http://bugs.python.org/issue8297>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to