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.10:45:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <5398335C.6070700@egenix.com>
In-reply-to <1402482755.9.0.0429734003163.issue21709@psf.upfronthosting.co.za>
Content
On 11.06.2014 12:32, Vinay Sajip wrote:
> 
> Vinay Sajip added the comment:
> 
>> _srcfile is only used to identify the caller's stack frame
> 
> Not quite. It's also used to indicate whether findCaller() should be called at all: setting it to None avoids calling findCaller(), which might be desirable in some performance-sensitive scenarios.
> 
> So if you mean "just call _get_module_filename() instead of accessing _srcFile", that won't do. If you mean "set _srcFile to the return value of _get_module_filename()", that might work, if I e.g. move the _srcFile definition to after addLevelName (say) and do just
> 
> _srcFile = addLevelName.__code__.co_filename
> 
> How does that sound?

That's what I meant, yes. Please also add some comment explaining
why this is done in this way.

FWIW: Given that __file__ is not always set, it may be worthwhile
introducing some generic helper to the stdlib which uses the
.co_filename attribute to get the compile time filename as fallback
in case __file__ is not set.

Thanks,
-- 
Marc-Andre Lemburg
eGenix.com
History
Date User Action Args
2014-06-11 10:45:52lemburgsetrecipients: + lemburg, vinay.sajip, python-dev
2014-06-11 10:45:52lemburglinkissue21709 messages
2014-06-11 10:45:52lemburgcreate