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 <rep...@bugs.python.org>
<http://bugs.python.org/issue17396>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to