[issue40545] Expose _PyErr_GetTopmostException

STINNER Victor report at bugs.python.org
Thu May 7 05:43:44 EDT 2020


STINNER Victor <vstinner at python.org> added the comment:

The function was added by:

commit ae3087c6382011c47db82fea4d05f8bbf514265d
Author: Mark Shannon <mark at hotpy.org>
Date:   Sun Oct 22 22:41:51 2017 +0100

    Move exc state to generator. Fixes bpo-25612 (#1773)
    
    Move exception state information from frame objects to coroutine (generator/thread) object where it belongs.

Python 3.9 is now built with -fvisibility=hidden, bpo-11410:

commit 0b60f64e4343913b4931dc27379d9808e5b78fe1
Author: Vinay Sajip <vinay_sajip at yahoo.co.uk>
Date:   Tue Oct 15 08:26:12 2019 +0100

    bpo-11410: Standardize and use symbol visibility attributes across POSIX and Windows. (GH-16347)

It means that functions which are not explicitly exported are no longer exported.

So yeah, _PyErr_GetTopmostException() symbol is not properly exported.

But the function remains private. IMHO if someone wants to add a *public* function, it should return a *strong* reference to the 3 variables (exc type, exc value, exc tb).

See also bpo-39947: "[C API] Make the PyThreadState structure opaque (move it to the internal C API)". I added multiple public getters for PyThreadState structure in Python 3.9.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40545>
_______________________________________


More information about the Python-bugs-list mailing list