[New-bugs-announce] [issue24492] using custom objects as modules: AttributeErrors new in 3.5

Armin Rigo report at bugs.python.org
Tue Jun 23 19:40:13 CEST 2015


New submission from Armin Rigo:

A regression in 3.5: if we use custom objects as modules (like some projects do), then these custom objects may not have an attribute called "__name__".  There is new code in 3.5 added for issue #17636 which tries sometimes to read the "__name__" of a module when executing an import statement, and if this leads to an AttributeError, it will get propagated.

I imagine this could break real code using "try: except ImportError:".  It _does_ break the tests of the "cffi" project, which try to check that some import of a nonexisting name correctly gives ImportError.  Now it gives AttributeError("__name__") instead.

----------
components: Interpreter Core
keywords: 3.4regression
messages: 245696
nosy: arigo, larry
priority: normal
severity: normal
status: open
title: using custom objects as modules: AttributeErrors new in 3.5
type: behavior
versions: Python 3.5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24492>
_______________________________________


More information about the New-bugs-announce mailing list