[issue17396] modulefinder fails if module contains syntax error
Jan Gosmann
report at bugs.python.org
Mon Mar 11 13:03:45 CET 2013
New submission from Jan Gosmann:
Running modulefinder.ModuleFinder.run_script on a script which has an import statement with a module containing a syntax error will raise a SyntaxError exception. I think, modulefinder should instead continue its analysis and add the module to badmodules. Especially, as there are valid reasons for importing modules with syntax errors like in the following code snippet
if not python3:
from .exec_py2 import exec_
else:
from .exec_py3 import exec_
I attached a patch which changes the code to catch potential SyntaxError exceptions and change them to an ImportError.
----------
components: Library (Lib)
files: fix-handling-of-syntax-errors.diff
keywords: patch
messages: 183953
nosy: jgosmann
priority: normal
severity: normal
status: open
title: modulefinder fails if module contains syntax error
versions: Python 2.7
Added file: http://bugs.python.org/file29376/fix-handling-of-syntax-errors.diff
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17396>
_______________________________________
More information about the Python-bugs-list
mailing list