Title: _PyErr_Display should be available in the CPython-specific API
Type: enhancement Stage: patch review
Components: C API Versions: Python 3.10
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Maxime Belanger, maxbelanger
Priority: normal Keywords: patch

Created on 2021-03-02 20:42 by Maxime Belanger, last changed 2021-03-03 08:22 by maxbelanger.

Pull Requests
URL Status Linked Edit
PR 24719 open maxbelanger, 2021-03-03 08:22
Messages (1)
msg387965 - (view) Author: Maxime Belanger (Maxime Belanger) Date: 2021-03-02 20:42
We have found `_PyErr_Display` to be quite helpful in embedding situations, in particular as a way to capture errors to a custom buffer rather than to `stderr`. Otherwise, embedders often have to replicate logic in `PyErr_Print`, etc. 

Since the header restructuring in Python 3.8+, that function is a bit harder to call. It's exported, but is considered "internal" and thus requires defining `Py_BUILD_CORE`.

I was wondering: why not expose it under "Include/cpython"? It seems like a generic-enough helper, similar to `_PyErr_WriteUnraisableMsg`.
Date User Action Args
2021-03-03 08:22:36maxbelangersetkeywords: + patch
nosy: + maxbelanger

pull_requests: + pull_request23495
stage: patch review
2021-03-02 20:42:17Maxime Belangercreate