gh-111089: Revert PyUnicode_AsUTF8() changes (#111833)

* Revert "gh-111089: Use PyUnicode_AsUTF8() in Argument Clinic (#111585)"

This reverts commit d9b606b3d0.

* Revert "gh-111089: Use PyUnicode_AsUTF8() in getargs.c (#111620)"

This reverts commit cde1071b2a.

* Revert "gh-111089: PyUnicode_AsUTF8() now raises on embedded NUL (#111091)"

This reverts commit d731579bfb.

* Revert "gh-111089: Add PyUnicode_AsUTF8() to the limited C API (#111121)"

This reverts commit d8f32be5b6.

* Revert "gh-111089: Use PyUnicode_AsUTF8() in sqlite3 (#111122)"

This reverts commit 37e4e20eaa.
This commit is contained in:
Victor Stinner 2023-11-07 23:36:13 +01:00 committed by GitHub
parent ea970fb116
commit 11e83488c5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
50 changed files with 951 additions and 243 deletions

View file

@ -1259,10 +1259,15 @@ sys_activate_stack_trampoline(PyObject *module, PyObject *arg)
_PyArg_BadArgument("activate_stack_trampoline", "argument", "str", arg);
goto exit;
}
backend = PyUnicode_AsUTF8(arg);
Py_ssize_t backend_length;
backend = PyUnicode_AsUTF8AndSize(arg, &backend_length);
if (backend == NULL) {
goto exit;
}
if (strlen(backend) != (size_t)backend_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
return_value = sys_activate_stack_trampoline_impl(module, backend);
exit:
@ -1447,4 +1452,4 @@ exit:
#ifndef SYS_GETANDROIDAPILEVEL_METHODDEF
#define SYS_GETANDROIDAPILEVEL_METHODDEF
#endif /* !defined(SYS_GETANDROIDAPILEVEL_METHODDEF) */
/*[clinic end generated code: output=cdfb714878deeaf1 input=a9049054013a1b77]*/
/*[clinic end generated code: output=f36d45c829250775 input=a9049054013a1b77]*/