[Distutils] is_python should catch TypeError

Matt Good matt at matt-good.net
Sat Feb 17 18:00:28 CET 2007


I just got an error trying to upgrade SilverCity from easy_install:

  File "/usr/lib/python2.4/site-packages/setuptools-0.6c5-py2.4.egg/setuptools/command/easy_install.py", line 1462, in is_python
    compile(text, filename, 'exec')
TypeError: compile() expected string without null bytes

You can reproduce it easily:
>>> from setuptools.command.easy_install import is_python
>>> is_python('\0')

The fix is simply to add TypeError to the except clause along with
SyntaxError.

-- Matt Good



More information about the Distutils-SIG mailing list