mirror of
https://github.com/python/cpython.git
synced 2025-09-27 02:39:58 +00:00
gh-105873: Make _xxsubinterpreters
use exception type name in shared exception (#105874)
This commit is contained in:
parent
2ef1dc37f0
commit
69a39bd9ad
3 changed files with 4 additions and 4 deletions
|
@ -731,10 +731,10 @@ class RunStringTests(TestBase):
|
||||||
yield
|
yield
|
||||||
if msg is None:
|
if msg is None:
|
||||||
self.assertEqual(str(caught.exception).split(':')[0],
|
self.assertEqual(str(caught.exception).split(':')[0],
|
||||||
str(exctype))
|
exctype.__name__)
|
||||||
else:
|
else:
|
||||||
self.assertEqual(str(caught.exception),
|
self.assertEqual(str(caught.exception),
|
||||||
"{}: {}".format(exctype, msg))
|
"{}: {}".format(exctype.__name__, msg))
|
||||||
|
|
||||||
def test_invalid_syntax(self):
|
def test_invalid_syntax(self):
|
||||||
with self.assert_run_failed(SyntaxError):
|
with self.assert_run_failed(SyntaxError):
|
||||||
|
|
|
@ -655,7 +655,7 @@ class MagicNumberTests(unittest.TestCase):
|
||||||
@unittest.skipIf(_interpreters is None, 'subinterpreters required')
|
@unittest.skipIf(_interpreters is None, 'subinterpreters required')
|
||||||
class IncompatibleExtensionModuleRestrictionsTests(unittest.TestCase):
|
class IncompatibleExtensionModuleRestrictionsTests(unittest.TestCase):
|
||||||
|
|
||||||
ERROR = re.compile("^<class 'ImportError'>: module (.*) does not support loading in subinterpreters")
|
ERROR = re.compile("^ImportError: module (.*) does not support loading in subinterpreters")
|
||||||
|
|
||||||
def run_with_own_gil(self, script):
|
def run_with_own_gil(self, script):
|
||||||
interpid = _interpreters.create(isolated=True)
|
interpid = _interpreters.create(isolated=True)
|
||||||
|
|
|
@ -273,7 +273,7 @@ _sharedexception_bind(PyObject *exc, _sharedexception *sharedexc)
|
||||||
assert(exc != NULL);
|
assert(exc != NULL);
|
||||||
const char *failure = NULL;
|
const char *failure = NULL;
|
||||||
|
|
||||||
PyObject *nameobj = PyUnicode_FromFormat("%S", Py_TYPE(exc));
|
PyObject *nameobj = PyUnicode_FromString(Py_TYPE(exc)->tp_name);
|
||||||
if (nameobj == NULL) {
|
if (nameobj == NULL) {
|
||||||
failure = "unable to format exception type name";
|
failure = "unable to format exception type name";
|
||||||
goto error;
|
goto error;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue