Alexander Belopolsky added the comment:

Actually, a very simple change restores python2.5 behavior:

===================================================================
--- Modules/main.c      (revision 60941)
+++ Modules/main.c      (working copy)
@@ -187,6 +187,7 @@
 
        if ((argv0 = PyString_FromString(filename)) && 
            (importer = PyImport_GetImporter(argv0)) &&
+           (importer != Py_None) &&
            (importer->ob_type != &PyNullImporter_Type))
        {
                 /* argv0 is usable as an import source, so

$ ./python.exe .   
./python.exe: '.' is a directory, cannot continue
$ ./python.exe abc
./python.exe: can't open file 'abc': [Errno 2] No such file or directory

I'm not sure, however that PyImport_GetImporter is behaving correctly in 
this case.  (For one, it should INCREF Py_None before returning it.)

I could not find any documentation for PyImport_GetImporter.  Can 
someone enlighten me what Py_None (instead of NULL) return from 
yImport_GetImporter signifies?

----------
nosy: +belopolsky

__________________________________
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1877>
__________________________________
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to