Fix #544: allow .pyw extension for importable modules.

This commit is contained in:
Georg Brandl 2011-09-21 19:19:01 +02:00
parent 6396adfda2
commit 23cbe85e9f

View File

@ -205,6 +205,8 @@ def get_module_source(modname):
lfilename = filename.lower()
if lfilename.endswith('.pyo') or lfilename.endswith('.pyc'):
filename = filename[:-1]
if not path.isfile(filename) and path.isfile(filename + 'w'):
filename += 'w'
elif not (lfilename.endswith('.py') or lfilename.endswith('.pyw')):
raise PycodeError('source is not a .py file: %r' % filename)
if not path.isfile(filename):