Issue 15365: Traceback reporting can fail if IO cannot be imported (original) (raw)

Created on 2012-07-16 10:28 by kristjan.jonsson, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
traceback.patch kristjan.jonsson,2012-07-16 10:28 review
Messages (5)
msg165585 - (view) Author: Kristján Valur Jónsson (kristjan.jonsson) * (Python committer) Date: 2012-07-16 10:28
Reporting an error early in the python startup, before importing is properly initialized, can be tricky. For example, here: if (PyImport_ImportFrozenModule("_frozen_importlib") <= 0) { Py_FatalError("Py_Initialize: can't import _frozen_importlib"); The problem is, that _Py_DisplaySourceLine will set an exception because it cannot import the io module. And this will terminate the traceback output. The attached patch aims to rectify it by ignoring errors from this api in traceback.c
msg165692 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2012-07-17 08:58
The patch looks simple enough, but you should use spaces, not tabs.
msg165698 - (view) Author: Kristján Valur Jónsson (kristjan.jonsson) * (Python committer) Date: 2012-07-17 10:33
Certainly. But the submission filter would have caught that. The question is: Is it acceptible to simply ignore errors from this api when printing tracebacks? There are other errors that can be returned as well. The trouble is, any errors in the traceback reporting will be ignored anyway, since there is no way to report them :)
msg165699 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2012-07-17 10:38
> The trouble is, any errors in the traceback reporting will be ignored > anyway, since there is no way to report them :) Which is a good reason to ignore them, isn't it? ;)
msg165878 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-07-19 21:02
New changeset 54524897fafc by Kristján Valur Jónsson in branch 'default': Issue #15365: Make traceback reporting ignore any errors when printing out http://hg.python.org/cpython/rev/54524897fafc
History
Date User Action Args
2022-04-11 14:57:32 admin set github: 59570
2012-08-10 19:23:38 eric.snow set nosy: + eric.snow
2012-08-10 13:57:03 kristjan.jonsson set status: open -> closed
2012-07-19 21:03:00 python-dev set nosy: + python-devmessages: +
2012-07-17 10:38:27 pitrou set messages: +
2012-07-17 10:33:42 kristjan.jonsson set messages: +
2012-07-17 08:58:45 pitrou set nosy: + amaury.forgeotdarc, pitroumessages: + stage: patch review
2012-07-16 10:28:14 kristjan.jonsson create