self.assertIs(after2, None)
self.assertEqual(after3.type.__name__, 'AssertionError')
+ with self.assertRaises(ValueError):
+ # GH-127165: Embedded NULL characters broke the lookup
+ _interpreters.set___main___attrs(interpid, {"\x00": 1})
+
with self.subTest('from C-API'):
with self.interpreter_from_capi() as interpid:
with self.assertRaisesRegex(InterpreterError, 'unrecognized'):
return NULL;
}
+ if (size != (Py_ssize_t)strlen(str)) {
+ PyErr_SetString(PyExc_ValueError, "found embedded NULL character");
+ return NULL;
+ }
+
char *copied = PyMem_RawMalloc(size+1);
if (copied == NULL) {
PyErr_NoMemory();