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 lemburg
Recipients lemburg, python-dev, vinay.sajip
Date 2014-06-11.11:32:59
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <53983E68.5070905@egenix.com>
In-reply-to <1402485769.69.0.869832298656.issue21709@psf.upfronthosting.co.za>
Content
On 11.06.2014 13:22, Vinay Sajip wrote:
> 
> Vinay Sajip added the comment:
> 
>> Please also add some comment explaining why this is done in this way.
> 
> Natürlich :-)

Prima :-)

>> it may be worthwhile introducing some generic helper to the stdlib
> 
> Wouldn't you have to pass in a function (or code object) from a specific module, though? It seems more logical to have __file__ set, even for frozen modules (after all, if it's there in a code object's co_filename, is there some reason it shouldn't be exposed as a module attribute? (Even though it isn't at the moment.)

Well, I guess passing in a reference to the module would suffice. The
function could then look around for functions, methods, etc. to find
a usable code object.

I agree that having a __file__ attribute in frozen modules would
be helpful, since it's obviously not widely known that this
attribute does not always exist (just grep the stdlib as example,
in particular the test suite).

The module object's PyModule_GetFilenameObject() even reports a missing
__file__ attribute as a SystemError.

Perhaps something to discuss on python-dev.
History
Date User Action Args
2014-06-11 11:33:00lemburgsetrecipients: + lemburg, vinay.sajip, python-dev
2014-06-11 11:33:00lemburglinkissue21709 messages
2014-06-11 11:32:59lemburgcreate