Petr Viktorin added the comment:
Not true (on 3.3 2.7).
import sys
import x
Traceback (most recent call last):
File stdin, line 1, in module
File /tmp/x.py, line 1, in module
import y
File /tmp/y.py, line 1, in module
1/0
ZeroDivisionError: division by zero
sys.modules['x']
Eric Snow added the comment:
Either the docs are out-of-date or they are really poorly worded. Most likely
it's the former, but I'm taking a look.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24081
Changes by R. David Murray rdmur...@bitdance.com:
--
stage: - commit review
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24081
___
___
R. David Murray added the comment:
OK, I can't reproduce it either, neither in python3 nor python2. Brett, is
this left over from a long time ago?
Heh. I just tried another experiment and got an interesting result:
rdmurray@pydev:~/python/p34cat temp1.py
import temp2
foo = 1
R. David Murray added the comment:
Note that calling reload on temp1.temp2 will fail with an error that temp2 is
not in sys.modules. So maybe the caveat needs rewording rather than deletion.
--
___
Python tracker rep...@bugs.python.org
Eric Snow added the comment:
I'm pretty sure this is the culprit:
changeset: 32882:331e60d8ce6da19b168849418776fea0940787ec
branch: legacy-trunk
user:Tim Peters tim.pet...@gmail.com
date:Mon Aug 02 03:52:12 2004 +
summary: PyImport_ExecCodeModuleEx(): remove
R. David Murray added the comment:
Thanks, Petr. (And Eric.)
--
resolution: - fixed
stage: commit review - resolved
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24081
Roundup Robot added the comment:
New changeset 3cdeafd18e61 by R David Murray in branch '3.4':
#24081: Remove obsolete caveat from import docs.
https://hg.python.org/cpython/rev/3cdeafd18e61
New changeset d57e0c6d292d by R David Murray in branch 'default':
Merge: #24081: Remove obsolete caveat
Eric Snow added the comment:
I've verified that the documentation is correct under Python 2.3. The behavior
changed under Python 2.4 (and the docs were not updated). I expect that the
change in behavior is an unintended consequence of a change in the import
system for 2.4. There were 7 in
Eric Snow added the comment:
patch LGTM for the 3 branches.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24081
___
___
Python-bugs-list
Nick Coghlan added the comment:
I vaguely recall discussing that change, and my recollection is that it was
deliberate in order to evict improperly configured modules - we didn't
count it as a significant compatibility break because it solely affected an
error handling path.
I guess we never
R. David Murray added the comment:
This generally comes up in the context of a module importing another module,
and *that* module fails to import. The first module is left in sys.modules as
a stub. Try that experiment, I'm pretty sure that is still true.
--
nosy: +r.david.murray
New submission from Petr Viktorin:
imp.reload() and importlib.reload() docs state::
If a module is syntactically correct but its initialization fails, the first
:keyword:`import` statement for it does not bind its name locally, but does
store a (partially initialized) module object
Changes by Berker Peksag berker.pek...@gmail.com:
--
nosy: +brett.cannon, eric.snow, ncoghlan
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24081
___
14 matches
Mail list logo