Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
self.assertIsInstance(interp, interpreters.Interpreter)
self.assertIn(interp, interpreters.list_all())
+ # GH-126221: Passing an invalid Unicode character used to cause a SystemError
+ self.assertRaises(UnicodeEncodeError, _interpreters.create, '\udc80')
+
def test_in_thread(self):
lock = threading.Lock()
interp = None
--- /dev/null
+Raise a :exc:`UnicodeEncodeError` instead of a :exc:`SystemError` upon
+calling :func:`!_interpreters.create` with an invalid Unicode character.
}
}
else if (PyUnicode_Check(configobj)) {
- if (init_named_config(config, PyUnicode_AsUTF8(configobj)) < 0) {
+ const char *utf8name = PyUnicode_AsUTF8(configobj);
+ if (utf8name == NULL) {
+ return -1;
+ }
+ if (init_named_config(config, utf8name) < 0) {
return -1;
}
}