[issue43377] _PyErr_Display should be available in the CPython-specific API

2021-07-28 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

> PErr_Display (without underscore) is already exposed.
> This issue is about adding a variant with an additional output file argument.

Oh, I was not aware of that :( Apologies for the confusion!

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43377] _PyErr_Display should be available in the CPython-specific API

2021-07-28 Thread Petr Viktorin


Petr Viktorin  added the comment:

PyErr_Display (without underscore) is already exposed.
This issue is about adding a variant with an additional output file argument.

The function formats an exception "just as Python would". The exact output will 
naturally be different between versions, but the function is still useful.

I'm also not sold on the "the arguments it may take" restriction:
- exceptions generally carry all of their context around
- even if they don't in the future, we'll always need a function that takes 
"just" an exception, for cases where some additional context isn't available

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43377] _PyErr_Display should be available in the CPython-specific API

2021-07-27 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

PyErr_Display is not exposed partially because is full of small details of the 
interpreter and we change it constantly without regard for backwards 
compatibility on purpose. Exposing it will restrict us a lot on how we display 
error messages or the arguments it may take, so I woulf prefer to not expose it.

--
nosy: +pablogsal

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43377] _PyErr_Display should be available in the CPython-specific API

2021-07-27 Thread Petr Viktorin


Petr Viktorin  added the comment:

If it should be exposed, it should be renamed to a public (non-underscored) 
name, like PyErr_DisplayToFile. It should also ideally get documentation and 
tests (along with PyErr_Display, which is sadly missing those as well).


(Also, note that there are no no API/ABI compatibility guarantees if you use 
private API or define Py_BUILD_CORE. Functions like _PyErr_Display could 
change/disappear in a patch version of CPython.)

--
nosy: +petr.viktorin

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43377] _PyErr_Display should be available in the CPython-specific API

2021-03-03 Thread Max Bélanger

Change by Max Bélanger :


--
keywords: +patch
nosy: +maxbelanger
nosy_count: 1.0 -> 2.0
pull_requests: +23495
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/24719

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43377] _PyErr_Display should be available in the CPython-specific API

2021-03-02 Thread Maxime Belanger


New submission from Maxime Belanger :

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`.

--
components: C API
messages: 387965
nosy: Maxime Belanger
priority: normal
severity: normal
status: open
title: _PyErr_Display should be available in the CPython-specific API
type: enhancement
versions: Python 3.10

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com