[issue21709] logging.__init__ assumes that __file__ is always set

2015-10-22 Thread Gregory P. Smith
Gregory P. Smith added the comment: I applied the same _srcfile setting cleanup to 2.7 as we ran into this at work with an embedded python stdlib. __file__ was set to something by the embedded importer, but to something different than the path seen on the actual code objects which appear to

[issue21709] logging.__init__ assumes that __file__ is always set

2015-10-22 Thread Roundup Robot
Roundup Robot added the comment: New changeset da971f467f6e by Gregory P. Smith in branch '2.7': Issue #21709: Fix the logging module to not depend upon __file__ being set https://hg.python.org/cpython/rev/da971f467f6e New changeset bdb219a0219c by Gregory P. Smith in branch '2.7': Issue21709:

[issue21709] logging.__init__ assumes that __file__ is always set

2014-06-15 Thread Vinay Sajip
Vinay Sajip added the comment: Isn't __code__ implementation-specific? Further data point: the contents of __code__ might be implementation-specific (as there are no other Python 3 implementations), but the 2.x equivalent, func_code, is to be found in CPython, Jython, IronPython and PyPy,

[issue21709] logging.__init__ assumes that __file__ is always set

2014-06-14 Thread Eric Snow
Eric Snow added the comment: addLevelName.__code__.co_filename Isn't __code__ implementation-specific? -- nosy: +eric.snow ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21709 ___

[issue21709] logging.__init__ assumes that __file__ is always set

2014-06-14 Thread Vinay Sajip
Vinay Sajip added the comment: Isn't __code__ implementation-specific? It is, but ISTM it's worth getting a resolution for #21736 before another patch for this issue is developed. -- ___ Python tracker rep...@bugs.python.org

[issue21709] logging.__init__ assumes that __file__ is always set

2014-06-12 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: While the current patch does not resolve the issue, I'm leaving the issue closed and have instead opened a new Issue21736 which tracks the idea to add a __file__ attribute to frozen modules per default. -- ___

[issue21709] logging.__init__ assumes that __file__ is always set

2014-06-12 Thread Vinay Sajip
Vinay Sajip added the comment: While the current patch does not resolve the issue, I'm leaving the issue closed That's fine - I will implement the changes we discussed in this issue, even if it's something of a stop-gap. -- ___ Python tracker

[issue21709] logging.__init__ assumes that __file__ is always set

2014-06-12 Thread Roundup Robot
Roundup Robot added the comment: New changeset bec6f18dd636 by Vinay Sajip in branch '3.4': Issue #21709: Improved implementation to cover the frozen module case. http://hg.python.org/cpython/rev/bec6f18dd636 New changeset bd44ad77013a by Vinay Sajip in branch 'default': Issue #21709: Merged

[issue21709] logging.__init__ assumes that __file__ is always set

2014-06-11 Thread Roundup Robot
Roundup Robot added the comment: New changeset 11a920a26f13 by Vinay Sajip in branch '3.4': Issue #21709: Remove references to __file__ when part of a frozen application. http://hg.python.org/cpython/rev/11a920a26f13 New changeset 149cc6364180 by Vinay Sajip in branch 'default': Closes #21709:

[issue21709] logging.__init__ assumes that __file__ is always set

2014-06-11 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: Hi Vinaj, thanks for the patch, but it doesn't really help outside of py2exe. The sys.frozen flag is not an official Python API and it's unlikely to become one, since you can freeze the whole application or just parts of it, which sys.frozen would not be

[issue21709] logging.__init__ assumes that __file__ is always set

2014-06-11 Thread Vinay Sajip
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

[issue21709] logging.__init__ assumes that __file__ is always set

2014-06-11 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: 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

[issue21709] logging.__init__ assumes that __file__ is always set

2014-06-11 Thread Vinay Sajip
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

[issue21709] logging.__init__ assumes that __file__ is always set

2014-06-11 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: 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

[issue21709] logging.__init__ assumes that __file__ is always set

2014-06-11 Thread Vinay Sajip
Vinay Sajip added the comment: Please also add some comment explaining why this is done in this way. Natürlich :-) 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

[issue21709] logging.__init__ assumes that __file__ is always set

2014-06-11 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: 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

[issue21709] logging.__init__ assumes that __file__ is always set

2014-06-10 Thread Marc-Andre Lemburg
New submission from Marc-Andre Lemburg: It is not when freezing the logging package, so any use of the logging package fails: import logging Traceback (most recent call last): File console, line 1, in module File pyrun/importlib/_bootstrap.py, line 2237, in _find_and_load File

[issue21709] logging.__init__ assumes that __file__ is always set

2014-06-10 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: The issue is similar to Issue20884. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21709 ___ ___

[issue21709] logging.__init__ assumes that __file__ is always set

2014-06-10 Thread Berker Peksag
Changes by Berker Peksag berker.pek...@gmail.com: -- nosy: +vinay.sajip ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21709 ___ ___