gh-106320: Remove private _PyErr_ChainExceptions() (#108713)

Remove _PyErr_ChainExceptions(), _PyErr_ChainExceptions1() and
_PyErr_SetFromPyStatus() functions from the public C API.

* Move the private _PyErr_ChainExceptions() and
  _PyErr_ChainExceptions1() function to the internal C API
  (pycore_pyerrors.h).
* Move the private _PyErr_SetFromPyStatus() to the internal C API
  (pycore_initconfig.h).
* No longer export the _PyErr_ChainExceptions() function.
* Move run_in_subinterp_with_config() from _testcapi to
  _testinternalcapi.
This commit is contained in:
Victor Stinner 2023-08-31 13:53:19 +02:00 committed by GitHub
parent 059bd4d299
commit 79823c103b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 140 additions and 117 deletions

View file

@ -1821,11 +1821,11 @@ def run_in_subinterp_with_config(code, *, own_gil=None, **config):
module is enabled.
"""
_check_tracemalloc()
import _testcapi
import _testinternalcapi
if own_gil is not None:
assert 'gil' not in config, (own_gil, config)
config['gil'] = 2 if own_gil else 1
return _testcapi.run_in_subinterp_with_config(code, **config)
return _testinternalcapi.run_in_subinterp_with_config(code, **config)
def _check_tracemalloc():