diff options
author | Eric Snow <ericsnowcurrently@gmail.com> | 2025-04-25 20:43:38 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-25 20:43:38 (GMT) |
commit | cd9536a0872046cc7c151b61b457975e7718274a (patch) | |
tree | 97aeb24d67a984a1eedd1ef0944463a4b2a3ef05 /Lib/test/test__interpreters.py | |
parent | 4c20f46fa011df57190cc19b21bafde1f65e73a7 (diff) | |
download | cpython-cd9536a0872046cc7c151b61b457975e7718274a.zip cpython-cd9536a0872046cc7c151b61b457975e7718274a.tar.gz cpython-cd9536a0872046cc7c151b61b457975e7718274a.tar.bz2 |
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().
Diffstat (limited to 'Lib/test/test__interpreters.py')
-rw-r--r-- | Lib/test/test__interpreters.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/Lib/test/test__interpreters.py b/Lib/test/test__interpreters.py index ec37677..aa46eb4 100644 --- a/Lib/test/test__interpreters.py +++ b/Lib/test/test__interpreters.py @@ -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) |