[New-bugs-announce] [issue16514] Cryptic traceback when sys.path[0] is None
Barry A. Warsaw
report at bugs.python.org
Tue Nov 20 16:17:15 CET 2012
New submission from Barry A. Warsaw:
When sys.path[0] is None, attempting to import a module produces a cryptic chained traceback. This is a regression from 3.2 where the import would succeed.
The basic issue is that in 3.2's import.c, non-string/bytes items on sys.path are essentially ignored (see the loop in import.c:1708 find_module()) while they are not ignored in 3.3's importlib. This means that because zipimporter.zipimiporter is by default the first thing on sys.path_hooks, zipimporter.zipimporter(None) gets called. This raises a TypeError which starts the chained exception. Note that the fact that zipimporter.zipimporter(None) raises a TypeError is *not* a regression. The regression is that None makes its way to sys.path_hooks at all.
I think this will be relatively easy to fix, if we agree that the current regressive behavior is a bug.
----------
assignee: barry
components: Interpreter Core
keywords: 3.3regression
messages: 175996
nosy: barry
priority: high
severity: normal
status: open
title: Cryptic traceback when sys.path[0] is None
type: behavior
versions: Python 3.3, Python 3.4
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16514>
_______________________________________
More information about the New-bugs-announce
mailing list