[issue16514] Cryptic traceback when sys.path[0] is None
Changes by Jesús Cea Avión j...@jcea.es: -- nosy: +jcea ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16514 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16514] Cryptic traceback when sys.path[0] is None
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 rep...@bugs.python.org http://bugs.python.org/issue16514 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16514] Cryptic traceback when sys.path[0] is None
Barry A. Warsaw added the comment: Patch for 3.3, omitting the requisite importlib.h change. -- keywords: +patch Added file: http://bugs.python.org/file28051/16514.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16514 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16514] Cryptic traceback when sys.path[0] is None
Barry A. Warsaw added the comment: Oh, the patch includes the removal of some unused imports from test_path.py, thanks to pyflakes. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16514 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16514] Cryptic traceback when sys.path[0] is None
Changes by Barry A. Warsaw ba...@python.org: -- nosy: +brett.cannon, eric.smith, eric.snow, jason.coombs ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16514 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16514] Cryptic traceback when sys.path[0] is None
Eric V. Smith added the comment: I agree it's a bug. And the fix looks good to me. Having said that: I haven't looked at the import.c version to verify what is happening. Does the test pass under 3.2? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16514 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16514] Cryptic traceback when sys.path[0] is None
Barry A. Warsaw added the comment: Oh, btw, I intend to add documentation that makes explicit: * sys.path entries must be strings or bytes, everything else is ignored * path importers should expect strings or bytes * the encoding of bytes is left to the individual path hooks to define, however it it can't decode the bytes it should ignore the path entry or raise an ImportError (effectively ignoring it anyway). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16514 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16514] Cryptic traceback when sys.path[0] is None
Changes by Chris Jerdonek chris.jerdo...@gmail.com: -- nosy: +chris.jerdonek ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16514 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16514] Cryptic traceback when sys.path[0] is None
Changes by Barry A. Warsaw ba...@python.org: -- title: Cryptic traceback when sys.path - Cryptic traceback when sys.path[0] is None ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16514 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16514] Cryptic traceback when sys.path[0] is None
Roundup Robot added the comment: New changeset 291406748217 by Barry Warsaw in branch '3.3': - Issue #16514: Fix regression causing a traceback when sys.path[0] is None http://hg.python.org/cpython/rev/291406748217 New changeset a82ee9a1457a by Barry Warsaw in branch 'default': - Issue #16514: Fix regression causing a traceback when sys.path[0] is None http://hg.python.org/cpython/rev/a82ee9a1457a -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16514 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16514] Cryptic traceback when sys.path[0] is None
Changes by Barry A. Warsaw ba...@python.org: -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16514 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com