[issue22599] traceback: errors in the linecache module at exit

2014-12-05 Thread Roundup Robot
Roundup Robot added the comment: New changeset cd3244416592 by Victor Stinner in branch '3.4': Issue #22599: Enhance tokenize.open() to be able to call it during Python https://hg.python.org/cpython/rev/cd3244416592 New changeset 22f2784a276e by Victor Stinner in branch 'default': (Merge 3.4)

[issue22599] traceback: errors in the linecache module at exit

2014-12-05 Thread STINNER Victor
STINNER Victor added the comment: Yes, please do this. Ok done. I only added the test to default, not in the 3.4 branch. As Antoine noticed, the test is fragile, I perfer to not backport it. Ok, let's focus now on the issue #22696 ;-) -- dependencies: -Add a function to know about

[issue22599] traceback: errors in the linecache module at exit

2014-12-04 Thread STINNER Victor
STINNER Victor added the comment: Can I apply traceback_at_exit-2.patch? I know that my change on tokenize is not perfect, but it doesn't look like an hack, and it adds a new unit test. The linecache module can be enhanced in the issue #22696. --

[issue22599] traceback: errors in the linecache module at exit

2014-12-04 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Yes, please do this. -- versions: +Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22599 ___ ___

[issue22599] traceback: errors in the linecache module at exit

2014-11-16 Thread Serhiy Storchaka
Changes by Serhiy Storchaka storch...@gmail.com: -- assignee: - haypo dependencies: +Add a function to know about interpreter shutdown type: - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22599

[issue22599] traceback: errors in the linecache module at exit

2014-10-22 Thread STINNER Victor
STINNER Victor added the comment: traceback_at_exit-2.patch: Updated patch to remove import builtins from tokenize.py, it's no more needed. Antoine, Serhiy: What do you think about this patch? IMO the bug is very simple and fixes a common bug. --

[issue22599] traceback: errors in the linecache module at exit

2014-10-22 Thread Antoine Pitrou
Antoine Pitrou added the comment: The patch looks fragile to me: who knows whether other similar problems can appear in other situations? I would prefer something like traceback_ignore_linecache_error.patch, perhaps combined with a new function that would tell you whether the interpreter is

[issue22599] traceback: errors in the linecache module at exit

2014-10-22 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Since I wrote tokenize.open(), I can explain why I chose to import builtins :-) Then it is good to me. I would prefer something like traceback_ignore_linecache_error.patch, perhaps combined with a new function that would tell you whether the

[issue22599] traceback: errors in the linecache module at exit

2014-10-22 Thread STINNER Victor
STINNER Victor added the comment: The patch looks fragile to me: who knows whether other similar problems can appear in other situations? Maybe we can always ignore non fatal errors when calling linecache from print_exception? Having the Python source code in the traceback is better, but

[issue22599] traceback: errors in the linecache module at exit

2014-10-22 Thread STINNER Victor
STINNER Victor added the comment: The patch looks fragile to me: who knows whether other similar problems can appear in other situations? Oh, I forgot to say that yes, my patch is incomplete, but it is simple and it is already make the code more reliable. --

[issue22599] traceback: errors in the linecache module at exit

2014-10-22 Thread STINNER Victor
STINNER Victor added the comment: Oh, I see that Antoine opened the issue #22696. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22599 ___ ___

[issue22599] traceback: errors in the linecache module at exit

2014-10-14 Thread STINNER Victor
STINNER Victor added the comment: There is one downside of my solution. For now the code uses current builtin open() which can be overloaded (to handle reading from ZIP archive for example, or to check permissions). Oh, does anyone really modify the builtin open() for that? If you already

[issue22599] traceback: errors in the linecache module at exit

2014-10-14 Thread STINNER Victor
STINNER Victor added the comment: traceback_at_exit-2.patch: Updated patch to remove import builtins from tokenize.py, it's no more needed. -- Added file: http://bugs.python.org/file36925/traceback_at_exit-2.patch ___ Python tracker

[issue22599] traceback: errors in the linecache module at exit

2014-10-13 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: There is one downside of my solution. For now the code uses current builtin open() which can be overloaded (to handle reading from ZIP archive for example, or to check permissions). With my solution it uses builtin open() at the time of import. I don't know

[issue22599] traceback: errors in the linecache module at exit

2014-10-12 Thread STINNER Victor
STINNER Victor added the comment: Alternative solution of this issue would be to use from builtins import open as _open instead of import builtins. Right. I prefer your solution because it's much simpler, it doesn't make traceback less usable at exit, and it doesn't need to make assumption

[issue22599] traceback: errors in the linecache module at exit

2014-10-10 Thread STINNER Victor
New submission from STINNER Victor: Attached destructortest.py script comes the issue #22480. It calls traceback.print_exception() at exit. The problem is that the call occurs late during Python finalization. The object was stored in the namespace of the main module. Currently, Python deletes

[issue22599] traceback: errors in the linecache module at exit

2014-10-10 Thread STINNER Victor
STINNER Victor added the comment: Errors in the traceback module (caused by linecache) are common when working on the asyncio module in debug mode. The asyncio tries to log exceptions at exit to help the debug to track bugs. It uses the garbage collector and destructors on objects. Example of

[issue22599] traceback: errors in the linecache module at exit

2014-10-10 Thread Antoine Pitrou
Antoine Pitrou added the comment: There is no patch. -- nosy: +pitrou ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22599 ___ ___ Python-bugs-list

[issue22599] traceback: errors in the linecache module at exit

2014-10-10 Thread STINNER Victor
STINNER Victor added the comment: There is no patch. Oh no :-( I revert all my local changes and I forgot to produce the patch... My change added a new sys._is_finalizing() function which exposes the private C variable _Py_Finalizing. Well, here is a patch which implements the first option

[issue22599] traceback: errors in the linecache module at exit

2014-10-10 Thread Martin Panter
Changes by Martin Panter vadmium...@gmail.com: -- nosy: +vadmium ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22599 ___ ___ Python-bugs-list

[issue22599] traceback: errors in the linecache module at exit

2014-10-10 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Alternative solution of this issue would be to use from builtins import open as _open instead of import builtins. -- nosy: +serhiy.storchaka ___ Python tracker rep...@bugs.python.org

[issue22599] traceback: errors in the linecache module at exit

2014-10-10 Thread STINNER Victor
STINNER Victor added the comment: See also the issue #19421. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22599 ___ ___ Python-bugs-list