[issue22676] Creating the string representation of a module is slower

2014-10-21 Thread Georg Brandl
Georg Brandl added the comment: HasAttr would just call GetAttr and discard the exception. @ OP: what objects are you pickling? You can give them a __module__ attribute to save the lookup in sys.modules. -- nosy: +georg.brandl ___ Python tracker

[issue22676] Creating the string representation of a module is slower

2014-10-20 Thread kbengine
kbengine added the comment: This is a misunderstanding, "getattribute (PyObject *obj, PyObject *name, int allow_qualname)" is the Python code, in the Python/Modules/_pickle.c (1538). Do efficiency is decreased a lot. -- status: pending -> open ___ P

[issue22676] Creating the string representation of a module is slower

2014-10-20 Thread Brett Cannon
Brett Cannon added the comment: In Python 3.3 the import machinery changed to use importlib. This means the code to create the representation of a module now calls into Python code (the `:690(_module_repr)` you're seeing). But my question is why are you not calling PyObject_HasAttr() before ca