[issue20321] ImportError when a module is created after a catched ImportError

2014-01-22 Thread Brett Cannon
Brett Cannon added the comment: So those semantics have existed as long as PEP 302 has been around, which is Python 2.3 (that PEP itself is over a decade old), so changing them now would break code. And honestly I wouldn't change it anyway. On some filesystems, stat calls are extremely costly

[issue20321] ImportError when a module is created after a catched ImportError

2014-01-22 Thread Ezio Melotti
Ezio Melotti added the comment: > Because you inserted LIBDIR before it existed, import noticed it didn't > exist and so put None into sys.path_importer_cache[LIBDIR] I'm not familiar with sys.path_importer_cache, but what happens if instead of putting None, sys.path_importer_cache[LIBDIR] is n

[issue20321] ImportError when a module is created after a catched ImportError

2014-01-21 Thread Brett Cannon
Brett Cannon added the comment: It actually is a caching issue, but not with the caches in the finder but the cache *of* finders. Because you inserted LIBDIR before it existed, import noticed it didn't exist and so put None into sys.path_importer_cache[LIBDIR] (or imp.NullImporter prior to Pyt

[issue20321] ImportError when a module is created after a catched ImportError

2014-01-21 Thread berdario
Changes by berdario : Added file: http://bugs.python.org/file33596/bug_with_invalidatecaches.py ___ Python tracker ___ ___ Python-bugs-list ma

[issue20321] ImportError when a module is created after a catched ImportError

2014-01-21 Thread berdario
berdario added the comment: Ok, the bug is unrelated with timings and the finder caches apparently -- resolution: invalid -> status: closed -> open versions: -3rd party, Python 2.7 ___ Python tracker

[issue20321] ImportError when a module is created after a catched ImportError

2014-01-21 Thread berdario
Changes by berdario : Removed file: http://bugs.python.org/file33582/bbug.py ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscr

[issue20321] ImportError when a module is created after a catched ImportError

2014-01-21 Thread berdario
berdario added the comment: yes, sorry... I tried to "simplify" and generalize it too much (I tried to avoid creating a new directory in the test, assuming that the same behavior could make sense by only creating a new module in the current directory) I'll reupload the correct version of the f

[issue20321] ImportError when a module is created after a catched ImportError

2014-01-21 Thread Brett Cannon
Brett Cannon added the comment: I'm not sure why you think the example code as-is should work. The first entry on sys.path is the current directory ('' or the absolute path, depending if you are running from the interpreter prompt or specifying a file on the command-line). Stripping off sys.pa

[issue20321] ImportError when a module is created after a catched ImportError

2014-01-20 Thread Ezio Melotti
Changes by Ezio Melotti : -- nosy: +brett.cannon, eric.snow, ncoghlan stage: -> test needed type: -> behavior ___ Python tracker ___ ___

[issue20321] ImportError when a module is created after a catched ImportError

2014-01-20 Thread berdario
New submission from berdario: This small script errors on both Python2.7, Python3.3 and Pypy2.0 (I just reduced the test case supplied to me by ezio) -- components: Interpreter Core files: bbug.py messages: 208608 nosy: berdario, ezio.melotti priority: normal severity: normal status: op