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.09:54:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <53982765.90700@egenix.com>
In-reply-to <1402478720.7.0.302746095911.issue21709@psf.upfronthosting.co.za>
Content
On 11.06.2014 11:25, Vinay Sajip wrote:
> 
> Vinay Sajip added the comment:
> 
>> Could you please use a fix that works for Python tools in general?
> 
> I suggested an alternative implementation altogether in Issue #16778, but it was suggested that we wait for frame annotations. I'm not sure what the schedule for that is.
> 
>> The sys.frozen flag is not an official Python API and it's unlikely to become one
> 
> Would using imp.is_frozen('logging') rather than hasattr(sys, 'frozen') meet your requirement here? I'm not saying it's the ideal solution, but perhaps it will do until frame annotations arrive and we can avoid using filenames altogether?

I don't think any of this is needed here. _srcfile is only used to
identify the caller's stack frame and needs to be set to the co_filename
of the stack frame used by the logging.__init__ module.

Here's a sketch of what I had hinted at in my last reply:

def _get_module_filename():
    return getLogger.func_code.co_filename

You simply use the .co_filename attribute of one of the module's functions
to get useable value for __file__.
History
Date User Action Args
2014-06-11 09:54:50lemburgsetrecipients: + lemburg, vinay.sajip, python-dev
2014-06-11 09:54:50lemburglinkissue21709 messages
2014-06-11 09:54:50lemburgcreate