classification
Title: Make _PyTraceback_Add public
Type: enhancement Stage: resolved
Components: Extension Modules Versions: Python 3.8
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: iritkatriel, mic-e, serhiy.storchaka
Priority: normal Keywords:

Created on 2015-07-28 12:02 by mic-e, last changed 2020-12-15 20:19 by iritkatriel. This issue is now closed.

Messages (4)
msg247521 - (view) Author: Michael Ensslin (mic-e) * Date: 2015-07-28 12:02
Python 3.4.3 introduced an internal function, _PyTraceback_Add, which is quite useful when constructing Python exception objects.

I'm using it when constructing a Python Exception object from a C++ exception object, to add "fake traceback frames" that contain the line number / file name where the C++ exception has occurred.

The function is exported via Python.h, but unfortunately it seems undocumented, and must thus be considered unstable; I request to change that.
msg339703 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2019-04-09 05:55
It looks like a hack and is used only three time in the CPython code. What is your use case? How do you use it?
msg380792 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2020-11-11 19:44
The information about the location in c++ where the error occurred can be included in the exception message.

I don't think adding fake frames to the traceback is a pattern that we should support through a public API.
msg383095 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2020-12-15 20:19
This seems like something that needs to be discussed on python-ideas before it can be brought to implementation.
History
Date User Action Args
2020-12-15 20:19:44iritkatrielsetstatus: open -> closed
resolution: rejected
messages: + msg383095

stage: needs patch -> resolved
2020-11-11 19:44:14iritkatrielsetnosy: + iritkatriel
messages: + msg380792
2019-04-09 05:55:40serhiy.storchakasetmessages: + msg339703
2019-04-09 05:48:15SilentGhostsetnosy: + serhiy.storchaka

versions: - Python 3.7
2019-04-08 22:56:54cheryl.sabellasetstage: needs patch
versions: + Python 3.7, Python 3.8, - Python 3.4, Python 3.5, Python 3.6
2015-07-28 12:02:34mic-ecreate