mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
gh-132781: Cleanup Code Related to NotShareableError (gh-132782)
The following are added to the internal C-API: * _PyErr_FormatV() * _PyErr_SetModuleNotFoundError() * _PyXIData_GetNotShareableErrorType() * _PyXIData_FormatNotShareableError() We also drop _PyXIData_lookup_context_t and _PyXIData_GetLookupContext().
This commit is contained in:
parent
4c20f46fa0
commit
cd9536a087
14 changed files with 322 additions and 177 deletions
|
@ -15,7 +15,7 @@ from test.support import script_helper
|
|||
|
||||
_interpreters = import_helper.import_module('_interpreters')
|
||||
_testinternalcapi = import_helper.import_module('_testinternalcapi')
|
||||
from _interpreters import InterpreterNotFoundError
|
||||
from _interpreters import InterpreterNotFoundError, NotShareableError
|
||||
|
||||
|
||||
##################################
|
||||
|
@ -189,8 +189,9 @@ class ShareableTypeTests(unittest.TestCase):
|
|||
]
|
||||
for i in ints:
|
||||
with self.subTest(i):
|
||||
with self.assertRaises(OverflowError):
|
||||
with self.assertRaises(NotShareableError) as cm:
|
||||
_testinternalcapi.get_crossinterp_data(i)
|
||||
self.assertIsInstance(cm.exception.__cause__, OverflowError)
|
||||
|
||||
def test_bool(self):
|
||||
self._assert_values([True, False])
|
||||
|
@ -215,14 +216,12 @@ class ShareableTypeTests(unittest.TestCase):
|
|||
for s in non_shareables:
|
||||
value = tuple([0, 1.0, s])
|
||||
with self.subTest(repr(value)):
|
||||
# XXX Assert the NotShareableError when it is exported
|
||||
with self.assertRaises(ValueError):
|
||||
with self.assertRaises(NotShareableError):
|
||||
_testinternalcapi.get_crossinterp_data(value)
|
||||
# Check nested as well
|
||||
value = tuple([0, 1., (s,)])
|
||||
with self.subTest("nested " + repr(value)):
|
||||
# XXX Assert the NotShareableError when it is exported
|
||||
with self.assertRaises(ValueError):
|
||||
with self.assertRaises(NotShareableError):
|
||||
_testinternalcapi.get_crossinterp_data(value)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue