Author: christian.heimes
Date: Fri Jan 11 08:03:05 2008
New Revision: 59908
Modified:
python/branches/py3k/Lib/test/test_import.py
python/branches/py3k/Python/import.c
Log:
Good catch Neal!
I completely forgot about pyo files and the tests are usually not run with -O.
The modified code checks for *.py?
Modified: python/branches/py3k/Lib/test/test_import.py
==============================================================================
--- python/branches/py3k/Lib/test/test_import.py (original)
+++ python/branches/py3k/Lib/test/test_import.py Fri Jan 11 08:03:05 2008
@@ -213,7 +213,8 @@
os.remove(source)
del sys.modules[TESTFN]
mod = __import__(TESTFN)
- self.failUnless(mod.__file__.endswith('.pyc'))
+ ext = mod.__file__[-4:]
+ self.failUnless(ext in ('.pyc', '.pyo'), ext)
finally:
sys.path.pop(0)
remove_files(TESTFN)
Modified: python/branches/py3k/Python/import.c
==============================================================================
--- python/branches/py3k/Python/import.c (original)
+++ python/branches/py3k/Python/import.c Fri Jan 11 08:03:05 2008
@@ -982,7 +982,8 @@
}
len = strlen(file);
- if (len > MAXPATHLEN || PyOS_stricmp(&file[len-4], ".pyc") != 0) {
+ /* match '*.py?' */
+ if (len > MAXPATHLEN || PyOS_strnicmp(&file[len-4], ".py", 3) != 0) {
return PyUnicode_DecodeFSDefault(file);
}
_______________________________________________
Python-3000-checkins mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000-checkins