This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author belopolsky
Recipients belopolsky, georg.brandl, ncoghlan
Date 2008-02-22.04:08:05
SpamBayes Score 0.1710886
Marked as misclassified No
Message-id <1203653286.28.0.98692051656.issue1877@psf.upfronthosting.co.za>
In-reply-to
Content
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?
History
Date User Action Args
2008-02-22 04:08:06belopolskysetspambayes_score: 0.171089 -> 0.1710886
recipients: + belopolsky, georg.brandl, ncoghlan
2008-02-22 04:08:06belopolskysetspambayes_score: 0.171089 -> 0.171089
messageid: <1203653286.28.0.98692051656.issue1877@psf.upfronthosting.co.za>
2008-02-22 04:08:05belopolskylinkissue1877 messages
2008-02-22 04:08:05belopolskycreate