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

Replace PyUnicode_AsUTF8AndSize() with PyUnicode_AsUTF8() to remove
the explicit check for embedded null characters.

The change avoids to have to include explicitly <string.h> to get the
strlen() function when using a recent version of the limited C API.
This commit is contained in:
Victor Stinner 2023-11-01 16:34:42 +01:00 committed by GitHub
parent 97b3cd38d1
commit d9b606b3d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
34 changed files with 180 additions and 907 deletions

View File

@ -188,15 +188,10 @@ _io_open(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kw
_PyArg_BadArgument("open", "argument 'mode'", "str", args[1]); _PyArg_BadArgument("open", "argument 'mode'", "str", args[1]);
goto exit; goto exit;
} }
Py_ssize_t mode_length; mode = PyUnicode_AsUTF8(args[1]);
mode = PyUnicode_AsUTF8AndSize(args[1], &mode_length);
if (mode == NULL) { if (mode == NULL) {
goto exit; goto exit;
} }
if (strlen(mode) != (size_t)mode_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
if (!--noptargs) { if (!--noptargs) {
goto skip_optional_pos; goto skip_optional_pos;
} }
@ -215,15 +210,10 @@ _io_open(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kw
encoding = NULL; encoding = NULL;
} }
else if (PyUnicode_Check(args[3])) { else if (PyUnicode_Check(args[3])) {
Py_ssize_t encoding_length; encoding = PyUnicode_AsUTF8(args[3]);
encoding = PyUnicode_AsUTF8AndSize(args[3], &encoding_length);
if (encoding == NULL) { if (encoding == NULL) {
goto exit; goto exit;
} }
if (strlen(encoding) != (size_t)encoding_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
} }
else { else {
_PyArg_BadArgument("open", "argument 'encoding'", "str or None", args[3]); _PyArg_BadArgument("open", "argument 'encoding'", "str or None", args[3]);
@ -238,15 +228,10 @@ _io_open(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kw
errors = NULL; errors = NULL;
} }
else if (PyUnicode_Check(args[4])) { else if (PyUnicode_Check(args[4])) {
Py_ssize_t errors_length; errors = PyUnicode_AsUTF8(args[4]);
errors = PyUnicode_AsUTF8AndSize(args[4], &errors_length);
if (errors == NULL) { if (errors == NULL) {
goto exit; goto exit;
} }
if (strlen(errors) != (size_t)errors_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
} }
else { else {
_PyArg_BadArgument("open", "argument 'errors'", "str or None", args[4]); _PyArg_BadArgument("open", "argument 'errors'", "str or None", args[4]);
@ -261,15 +246,10 @@ _io_open(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kw
newline = NULL; newline = NULL;
} }
else if (PyUnicode_Check(args[5])) { else if (PyUnicode_Check(args[5])) {
Py_ssize_t newline_length; newline = PyUnicode_AsUTF8(args[5]);
newline = PyUnicode_AsUTF8AndSize(args[5], &newline_length);
if (newline == NULL) { if (newline == NULL) {
goto exit; goto exit;
} }
if (strlen(newline) != (size_t)newline_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
} }
else { else {
_PyArg_BadArgument("open", "argument 'newline'", "str or None", args[5]); _PyArg_BadArgument("open", "argument 'newline'", "str or None", args[5]);
@ -404,4 +384,4 @@ _io_open_code(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObjec
exit: exit:
return return_value; return return_value;
} }
/*[clinic end generated code: output=5d60f4e778a600a4 input=a9049054013a1b77]*/ /*[clinic end generated code: output=feb173d5f2bfb98a input=a9049054013a1b77]*/

View File

@ -107,15 +107,10 @@ _io_FileIO___init__(PyObject *self, PyObject *args, PyObject *kwargs)
_PyArg_BadArgument("FileIO", "argument 'mode'", "str", fastargs[1]); _PyArg_BadArgument("FileIO", "argument 'mode'", "str", fastargs[1]);
goto exit; goto exit;
} }
Py_ssize_t mode_length; mode = PyUnicode_AsUTF8(fastargs[1]);
mode = PyUnicode_AsUTF8AndSize(fastargs[1], &mode_length);
if (mode == NULL) { if (mode == NULL) {
goto exit; goto exit;
} }
if (strlen(mode) != (size_t)mode_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
if (!--noptargs) { if (!--noptargs) {
goto skip_optional_pos; goto skip_optional_pos;
} }
@ -528,4 +523,4 @@ _io_FileIO_isatty(fileio *self, PyObject *Py_UNUSED(ignored))
#ifndef _IO_FILEIO_TRUNCATE_METHODDEF #ifndef _IO_FILEIO_TRUNCATE_METHODDEF
#define _IO_FILEIO_TRUNCATE_METHODDEF #define _IO_FILEIO_TRUNCATE_METHODDEF
#endif /* !defined(_IO_FILEIO_TRUNCATE_METHODDEF) */ #endif /* !defined(_IO_FILEIO_TRUNCATE_METHODDEF) */
/*[clinic end generated code: output=1c0f4a36f76b0c6a input=a9049054013a1b77]*/ /*[clinic end generated code: output=27cff9d0a618edb6 input=a9049054013a1b77]*/

View File

@ -185,15 +185,10 @@ _io__TextIOBase_write(PyObject *self, PyTypeObject *cls, PyObject *const *args,
_PyArg_BadArgument("write", "argument 1", "str", args[0]); _PyArg_BadArgument("write", "argument 1", "str", args[0]);
goto exit; goto exit;
} }
Py_ssize_t s_length; s = PyUnicode_AsUTF8(args[0]);
s = PyUnicode_AsUTF8AndSize(args[0], &s_length);
if (s == NULL) { if (s == NULL) {
goto exit; goto exit;
} }
if (strlen(s) != (size_t)s_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
return_value = _io__TextIOBase_write_impl(self, cls, s); return_value = _io__TextIOBase_write_impl(self, cls, s);
exit: exit:
@ -475,15 +470,10 @@ _io_TextIOWrapper___init__(PyObject *self, PyObject *args, PyObject *kwargs)
encoding = NULL; encoding = NULL;
} }
else if (PyUnicode_Check(fastargs[1])) { else if (PyUnicode_Check(fastargs[1])) {
Py_ssize_t encoding_length; encoding = PyUnicode_AsUTF8(fastargs[1]);
encoding = PyUnicode_AsUTF8AndSize(fastargs[1], &encoding_length);
if (encoding == NULL) { if (encoding == NULL) {
goto exit; goto exit;
} }
if (strlen(encoding) != (size_t)encoding_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
} }
else { else {
_PyArg_BadArgument("TextIOWrapper", "argument 'encoding'", "str or None", fastargs[1]); _PyArg_BadArgument("TextIOWrapper", "argument 'encoding'", "str or None", fastargs[1]);
@ -504,15 +494,10 @@ _io_TextIOWrapper___init__(PyObject *self, PyObject *args, PyObject *kwargs)
newline = NULL; newline = NULL;
} }
else if (PyUnicode_Check(fastargs[3])) { else if (PyUnicode_Check(fastargs[3])) {
Py_ssize_t newline_length; newline = PyUnicode_AsUTF8(fastargs[3]);
newline = PyUnicode_AsUTF8AndSize(fastargs[3], &newline_length);
if (newline == NULL) { if (newline == NULL) {
goto exit; goto exit;
} }
if (strlen(newline) != (size_t)newline_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
} }
else { else {
_PyArg_BadArgument("TextIOWrapper", "argument 'newline'", "str or None", fastargs[3]); _PyArg_BadArgument("TextIOWrapper", "argument 'newline'", "str or None", fastargs[3]);
@ -980,4 +965,4 @@ _io_TextIOWrapper_close(textio *self, PyObject *Py_UNUSED(ignored))
{ {
return _io_TextIOWrapper_close_impl(self); return _io_TextIOWrapper_close_impl(self);
} }
/*[clinic end generated code: output=e58ce89b7354e77a input=a9049054013a1b77]*/ /*[clinic end generated code: output=c9ffb48a5278cbd4 input=a9049054013a1b77]*/

View File

@ -106,15 +106,10 @@ _io__WindowsConsoleIO___init__(PyObject *self, PyObject *args, PyObject *kwargs)
_PyArg_BadArgument("_WindowsConsoleIO", "argument 'mode'", "str", fastargs[1]); _PyArg_BadArgument("_WindowsConsoleIO", "argument 'mode'", "str", fastargs[1]);
goto exit; goto exit;
} }
Py_ssize_t mode_length; mode = PyUnicode_AsUTF8(fastargs[1]);
mode = PyUnicode_AsUTF8AndSize(fastargs[1], &mode_length);
if (mode == NULL) { if (mode == NULL) {
goto exit; goto exit;
} }
if (strlen(mode) != (size_t)mode_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
if (!--noptargs) { if (!--noptargs) {
goto skip_optional_pos; goto skip_optional_pos;
} }
@ -457,4 +452,4 @@ _io__WindowsConsoleIO_isatty(winconsoleio *self, PyObject *Py_UNUSED(ignored))
#ifndef _IO__WINDOWSCONSOLEIO_ISATTY_METHODDEF #ifndef _IO__WINDOWSCONSOLEIO_ISATTY_METHODDEF
#define _IO__WINDOWSCONSOLEIO_ISATTY_METHODDEF #define _IO__WINDOWSCONSOLEIO_ISATTY_METHODDEF
#endif /* !defined(_IO__WINDOWSCONSOLEIO_ISATTY_METHODDEF) */ #endif /* !defined(_IO__WINDOWSCONSOLEIO_ISATTY_METHODDEF) */
/*[clinic end generated code: output=04108fc26b187386 input=a9049054013a1b77]*/ /*[clinic end generated code: output=76408dd67894bc9c input=a9049054013a1b77]*/

View File

@ -138,15 +138,10 @@ _multiprocessing_sem_unlink(PyObject *module, PyObject *arg)
_PyArg_BadArgument("sem_unlink", "argument", "str", arg); _PyArg_BadArgument("sem_unlink", "argument", "str", arg);
goto exit; goto exit;
} }
Py_ssize_t name_length; name = PyUnicode_AsUTF8(arg);
name = PyUnicode_AsUTF8AndSize(arg, &name_length);
if (name == NULL) { if (name == NULL) {
goto exit; goto exit;
} }
if (strlen(name) != (size_t)name_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
return_value = _multiprocessing_sem_unlink_impl(module, name); return_value = _multiprocessing_sem_unlink_impl(module, name);
exit: exit:
@ -164,4 +159,4 @@ exit:
#ifndef _MULTIPROCESSING_SEND_METHODDEF #ifndef _MULTIPROCESSING_SEND_METHODDEF
#define _MULTIPROCESSING_SEND_METHODDEF #define _MULTIPROCESSING_SEND_METHODDEF
#endif /* !defined(_MULTIPROCESSING_SEND_METHODDEF) */ #endif /* !defined(_MULTIPROCESSING_SEND_METHODDEF) */
/*[clinic end generated code: output=73b4cb8428d816da input=a9049054013a1b77]*/ /*[clinic end generated code: output=c6735cbc59b6f324 input=a9049054013a1b77]*/

View File

@ -266,15 +266,10 @@ _multiprocessing_SemLock(PyTypeObject *type, PyObject *args, PyObject *kwargs)
_PyArg_BadArgument("SemLock", "argument 'name'", "str", fastargs[3]); _PyArg_BadArgument("SemLock", "argument 'name'", "str", fastargs[3]);
goto exit; goto exit;
} }
Py_ssize_t name_length; name = PyUnicode_AsUTF8(fastargs[3]);
name = PyUnicode_AsUTF8AndSize(fastargs[3], &name_length);
if (name == NULL) { if (name == NULL) {
goto exit; goto exit;
} }
if (strlen(name) != (size_t)name_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
unlink = PyObject_IsTrue(fastargs[4]); unlink = PyObject_IsTrue(fastargs[4]);
if (unlink < 0) { if (unlink < 0) {
goto exit; goto exit;
@ -542,4 +537,4 @@ exit:
#ifndef _MULTIPROCESSING_SEMLOCK___EXIT___METHODDEF #ifndef _MULTIPROCESSING_SEMLOCK___EXIT___METHODDEF
#define _MULTIPROCESSING_SEMLOCK___EXIT___METHODDEF #define _MULTIPROCESSING_SEMLOCK___EXIT___METHODDEF
#endif /* !defined(_MULTIPROCESSING_SEMLOCK___EXIT___METHODDEF) */ #endif /* !defined(_MULTIPROCESSING_SEMLOCK___EXIT___METHODDEF) */
/*[clinic end generated code: output=d57992037e6770b6 input=a9049054013a1b77]*/ /*[clinic end generated code: output=fd94dc907e6ab57f input=a9049054013a1b77]*/

View File

@ -297,28 +297,18 @@ blobopen(pysqlite_Connection *self, PyObject *const *args, Py_ssize_t nargs, PyO
_PyArg_BadArgument("blobopen", "argument 1", "str", args[0]); _PyArg_BadArgument("blobopen", "argument 1", "str", args[0]);
goto exit; goto exit;
} }
Py_ssize_t table_length; table = PyUnicode_AsUTF8(args[0]);
table = PyUnicode_AsUTF8AndSize(args[0], &table_length);
if (table == NULL) { if (table == NULL) {
goto exit; goto exit;
} }
if (strlen(table) != (size_t)table_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
if (!PyUnicode_Check(args[1])) { if (!PyUnicode_Check(args[1])) {
_PyArg_BadArgument("blobopen", "argument 2", "str", args[1]); _PyArg_BadArgument("blobopen", "argument 2", "str", args[1]);
goto exit; goto exit;
} }
Py_ssize_t col_length; col = PyUnicode_AsUTF8(args[1]);
col = PyUnicode_AsUTF8AndSize(args[1], &col_length);
if (col == NULL) { if (col == NULL) {
goto exit; goto exit;
} }
if (strlen(col) != (size_t)col_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
if (!sqlite3_int64_converter(args[2], &row)) { if (!sqlite3_int64_converter(args[2], &row)) {
goto exit; goto exit;
} }
@ -338,15 +328,10 @@ blobopen(pysqlite_Connection *self, PyObject *const *args, Py_ssize_t nargs, PyO
_PyArg_BadArgument("blobopen", "argument 'name'", "str", args[4]); _PyArg_BadArgument("blobopen", "argument 'name'", "str", args[4]);
goto exit; goto exit;
} }
Py_ssize_t name_length; name = PyUnicode_AsUTF8(args[4]);
name = PyUnicode_AsUTF8AndSize(args[4], &name_length);
if (name == NULL) { if (name == NULL) {
goto exit; goto exit;
} }
if (strlen(name) != (size_t)name_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
skip_optional_kwonly: skip_optional_kwonly:
return_value = blobopen_impl(self, table, col, row, readonly, name); return_value = blobopen_impl(self, table, col, row, readonly, name);
@ -499,15 +484,10 @@ pysqlite_connection_create_function(pysqlite_Connection *self, PyTypeObject *cls
_PyArg_BadArgument("create_function", "argument 'name'", "str", args[0]); _PyArg_BadArgument("create_function", "argument 'name'", "str", args[0]);
goto exit; goto exit;
} }
Py_ssize_t name_length; name = PyUnicode_AsUTF8(args[0]);
name = PyUnicode_AsUTF8AndSize(args[0], &name_length);
if (name == NULL) { if (name == NULL) {
goto exit; goto exit;
} }
if (strlen(name) != (size_t)name_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
narg = PyLong_AsInt(args[1]); narg = PyLong_AsInt(args[1]);
if (narg == -1 && PyErr_Occurred()) { if (narg == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -582,15 +562,10 @@ create_window_function(pysqlite_Connection *self, PyTypeObject *cls, PyObject *c
_PyArg_BadArgument("create_window_function", "argument 1", "str", args[0]); _PyArg_BadArgument("create_window_function", "argument 1", "str", args[0]);
goto exit; goto exit;
} }
Py_ssize_t name_length; name = PyUnicode_AsUTF8(args[0]);
name = PyUnicode_AsUTF8AndSize(args[0], &name_length);
if (name == NULL) { if (name == NULL) {
goto exit; goto exit;
} }
if (strlen(name) != (size_t)name_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
num_params = PyLong_AsInt(args[1]); num_params = PyLong_AsInt(args[1]);
if (num_params == -1 && PyErr_Occurred()) { if (num_params == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -688,15 +663,10 @@ pysqlite_connection_create_aggregate(pysqlite_Connection *self, PyTypeObject *cl
_PyArg_BadArgument("create_aggregate", "argument 'name'", "str", args[0]); _PyArg_BadArgument("create_aggregate", "argument 'name'", "str", args[0]);
goto exit; goto exit;
} }
Py_ssize_t name_length; name = PyUnicode_AsUTF8(args[0]);
name = PyUnicode_AsUTF8AndSize(args[0], &name_length);
if (name == NULL) { if (name == NULL) {
goto exit; goto exit;
} }
if (strlen(name) != (size_t)name_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
n_arg = PyLong_AsInt(args[1]); n_arg = PyLong_AsInt(args[1]);
if (n_arg == -1 && PyErr_Occurred()) { if (n_arg == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -1063,15 +1033,10 @@ pysqlite_connection_load_extension(pysqlite_Connection *self, PyObject *const *a
_PyArg_BadArgument("load_extension", "argument 1", "str", args[0]); _PyArg_BadArgument("load_extension", "argument 1", "str", args[0]);
goto exit; goto exit;
} }
Py_ssize_t extension_name_length; extension_name = PyUnicode_AsUTF8(args[0]);
extension_name = PyUnicode_AsUTF8AndSize(args[0], &extension_name_length);
if (extension_name == NULL) { if (extension_name == NULL) {
goto exit; goto exit;
} }
if (strlen(extension_name) != (size_t)extension_name_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
if (!noptargs) { if (!noptargs) {
goto skip_optional_kwonly; goto skip_optional_kwonly;
} }
@ -1079,15 +1044,10 @@ pysqlite_connection_load_extension(pysqlite_Connection *self, PyObject *const *a
entrypoint = NULL; entrypoint = NULL;
} }
else if (PyUnicode_Check(args[1])) { else if (PyUnicode_Check(args[1])) {
Py_ssize_t entrypoint_length; entrypoint = PyUnicode_AsUTF8(args[1]);
entrypoint = PyUnicode_AsUTF8AndSize(args[1], &entrypoint_length);
if (entrypoint == NULL) { if (entrypoint == NULL) {
goto exit; goto exit;
} }
if (strlen(entrypoint) != (size_t)entrypoint_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
} }
else { else {
_PyArg_BadArgument("load_extension", "argument 'entrypoint'", "str or None", args[1]); _PyArg_BadArgument("load_extension", "argument 'entrypoint'", "str or None", args[1]);
@ -1306,15 +1266,10 @@ pysqlite_connection_backup(pysqlite_Connection *self, PyObject *const *args, Py_
_PyArg_BadArgument("backup", "argument 'name'", "str", args[3]); _PyArg_BadArgument("backup", "argument 'name'", "str", args[3]);
goto exit; goto exit;
} }
Py_ssize_t name_length; name = PyUnicode_AsUTF8(args[3]);
name = PyUnicode_AsUTF8AndSize(args[3], &name_length);
if (name == NULL) { if (name == NULL) {
goto exit; goto exit;
} }
if (strlen(name) != (size_t)name_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
if (!--noptargs) { if (!--noptargs) {
goto skip_optional_kwonly; goto skip_optional_kwonly;
} }
@ -1380,15 +1335,10 @@ pysqlite_connection_create_collation(pysqlite_Connection *self, PyTypeObject *cl
_PyArg_BadArgument("create_collation", "argument 1", "str", args[0]); _PyArg_BadArgument("create_collation", "argument 1", "str", args[0]);
goto exit; goto exit;
} }
Py_ssize_t name_length; name = PyUnicode_AsUTF8(args[0]);
name = PyUnicode_AsUTF8AndSize(args[0], &name_length);
if (name == NULL) { if (name == NULL) {
goto exit; goto exit;
} }
if (strlen(name) != (size_t)name_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
callable = args[1]; callable = args[1];
return_value = pysqlite_connection_create_collation_impl(self, cls, name, callable); return_value = pysqlite_connection_create_collation_impl(self, cls, name, callable);
@ -1462,15 +1412,10 @@ serialize(pysqlite_Connection *self, PyObject *const *args, Py_ssize_t nargs, Py
_PyArg_BadArgument("serialize", "argument 'name'", "str", args[0]); _PyArg_BadArgument("serialize", "argument 'name'", "str", args[0]);
goto exit; goto exit;
} }
Py_ssize_t name_length; name = PyUnicode_AsUTF8(args[0]);
name = PyUnicode_AsUTF8AndSize(args[0], &name_length);
if (name == NULL) { if (name == NULL) {
goto exit; goto exit;
} }
if (strlen(name) != (size_t)name_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
skip_optional_kwonly: skip_optional_kwonly:
return_value = serialize_impl(self, name); return_value = serialize_impl(self, name);
@ -1565,15 +1510,10 @@ deserialize(pysqlite_Connection *self, PyObject *const *args, Py_ssize_t nargs,
_PyArg_BadArgument("deserialize", "argument 'name'", "str", args[1]); _PyArg_BadArgument("deserialize", "argument 'name'", "str", args[1]);
goto exit; goto exit;
} }
Py_ssize_t name_length; name = PyUnicode_AsUTF8(args[1]);
name = PyUnicode_AsUTF8AndSize(args[1], &name_length);
if (name == NULL) { if (name == NULL) {
goto exit; goto exit;
} }
if (strlen(name) != (size_t)name_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
skip_optional_kwonly: skip_optional_kwonly:
return_value = deserialize_impl(self, &data, name); return_value = deserialize_impl(self, &data, name);
@ -1818,4 +1758,4 @@ exit:
#ifndef DESERIALIZE_METHODDEF #ifndef DESERIALIZE_METHODDEF
#define DESERIALIZE_METHODDEF #define DESERIALIZE_METHODDEF
#endif /* !defined(DESERIALIZE_METHODDEF) */ #endif /* !defined(DESERIALIZE_METHODDEF) */
/*[clinic end generated code: output=90b5b9c14261b8d7 input=a9049054013a1b77]*/ /*[clinic end generated code: output=7d2a4d9272f7cb9e input=a9049054013a1b77]*/

View File

@ -135,15 +135,10 @@ pysqlite_cursor_executescript(pysqlite_Cursor *self, PyObject *arg)
_PyArg_BadArgument("executescript", "argument", "str", arg); _PyArg_BadArgument("executescript", "argument", "str", arg);
goto exit; goto exit;
} }
Py_ssize_t sql_script_length; sql_script = PyUnicode_AsUTF8(arg);
sql_script = PyUnicode_AsUTF8AndSize(arg, &sql_script_length);
if (sql_script == NULL) { if (sql_script == NULL) {
goto exit; goto exit;
} }
if (strlen(sql_script) != (size_t)sql_script_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
return_value = pysqlite_cursor_executescript_impl(self, sql_script); return_value = pysqlite_cursor_executescript_impl(self, sql_script);
exit: exit:
@ -313,4 +308,4 @@ pysqlite_cursor_close(pysqlite_Cursor *self, PyObject *Py_UNUSED(ignored))
{ {
return pysqlite_cursor_close_impl(self); return pysqlite_cursor_close_impl(self);
} }
/*[clinic end generated code: output=a8ce095c3c80cf65 input=a9049054013a1b77]*/ /*[clinic end generated code: output=c772882c7df587ea input=a9049054013a1b77]*/

View File

@ -60,15 +60,10 @@ pysqlite_complete_statement(PyObject *module, PyObject *const *args, Py_ssize_t
_PyArg_BadArgument("complete_statement", "argument 'statement'", "str", args[0]); _PyArg_BadArgument("complete_statement", "argument 'statement'", "str", args[0]);
goto exit; goto exit;
} }
Py_ssize_t statement_length; statement = PyUnicode_AsUTF8(args[0]);
statement = PyUnicode_AsUTF8AndSize(args[0], &statement_length);
if (statement == NULL) { if (statement == NULL) {
goto exit; goto exit;
} }
if (strlen(statement) != (size_t)statement_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
return_value = pysqlite_complete_statement_impl(module, statement); return_value = pysqlite_complete_statement_impl(module, statement);
exit: exit:
@ -208,4 +203,4 @@ skip_optional:
exit: exit:
return return_value; return return_value;
} }
/*[clinic end generated code: output=457ab0fdbb9e1880 input=a9049054013a1b77]*/ /*[clinic end generated code: output=19016e67830c19eb input=a9049054013a1b77]*/

View File

@ -112,15 +112,10 @@ _testcapi_make_exception_with_doc(PyObject *module, PyObject *const *args, Py_ss
_PyArg_BadArgument("make_exception_with_doc", "argument 'name'", "str", args[0]); _PyArg_BadArgument("make_exception_with_doc", "argument 'name'", "str", args[0]);
goto exit; goto exit;
} }
Py_ssize_t name_length; name = PyUnicode_AsUTF8(args[0]);
name = PyUnicode_AsUTF8AndSize(args[0], &name_length);
if (name == NULL) { if (name == NULL) {
goto exit; goto exit;
} }
if (strlen(name) != (size_t)name_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
if (!noptargs) { if (!noptargs) {
goto skip_optional_pos; goto skip_optional_pos;
} }
@ -129,15 +124,10 @@ _testcapi_make_exception_with_doc(PyObject *module, PyObject *const *args, Py_ss
_PyArg_BadArgument("make_exception_with_doc", "argument 'doc'", "str", args[1]); _PyArg_BadArgument("make_exception_with_doc", "argument 'doc'", "str", args[1]);
goto exit; goto exit;
} }
Py_ssize_t doc_length; doc = PyUnicode_AsUTF8(args[1]);
doc = PyUnicode_AsUTF8AndSize(args[1], &doc_length);
if (doc == NULL) { if (doc == NULL) {
goto exit; goto exit;
} }
if (strlen(doc) != (size_t)doc_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
if (!--noptargs) { if (!--noptargs) {
goto skip_optional_pos; goto skip_optional_pos;
} }
@ -456,4 +446,4 @@ _testcapi_unstable_exc_prep_reraise_star(PyObject *module, PyObject *const *args
exit: exit:
return return_value; return return_value;
} }
/*[clinic end generated code: output=0b11ef105030a48e input=a9049054013a1b77]*/ /*[clinic end generated code: output=6f2b4f773e0ae755 input=a9049054013a1b77]*/

View File

@ -73,15 +73,10 @@ _multibytecodec_MultibyteCodec_encode(MultibyteCodecObject *self, PyObject *cons
errors = NULL; errors = NULL;
} }
else if (PyUnicode_Check(args[1])) { else if (PyUnicode_Check(args[1])) {
Py_ssize_t errors_length; errors = PyUnicode_AsUTF8(args[1]);
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
if (errors == NULL) { if (errors == NULL) {
goto exit; goto exit;
} }
if (strlen(errors) != (size_t)errors_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
} }
else { else {
_PyArg_BadArgument("encode", "argument 'errors'", "str or None", args[1]); _PyArg_BadArgument("encode", "argument 'errors'", "str or None", args[1]);
@ -161,15 +156,10 @@ _multibytecodec_MultibyteCodec_decode(MultibyteCodecObject *self, PyObject *cons
errors = NULL; errors = NULL;
} }
else if (PyUnicode_Check(args[1])) { else if (PyUnicode_Check(args[1])) {
Py_ssize_t errors_length; errors = PyUnicode_AsUTF8(args[1]);
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
if (errors == NULL) { if (errors == NULL) {
goto exit; goto exit;
} }
if (strlen(errors) != (size_t)errors_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
} }
else { else {
_PyArg_BadArgument("decode", "argument 'errors'", "str or None", args[1]); _PyArg_BadArgument("decode", "argument 'errors'", "str or None", args[1]);
@ -682,4 +672,4 @@ PyDoc_STRVAR(_multibytecodec___create_codec__doc__,
#define _MULTIBYTECODEC___CREATE_CODEC_METHODDEF \ #define _MULTIBYTECODEC___CREATE_CODEC_METHODDEF \
{"__create_codec", (PyCFunction)_multibytecodec___create_codec, METH_O, _multibytecodec___create_codec__doc__}, {"__create_codec", (PyCFunction)_multibytecodec___create_codec, METH_O, _multibytecodec___create_codec__doc__},
/*[clinic end generated code: output=219a363662d2fbff input=a9049054013a1b77]*/ /*[clinic end generated code: output=b35a5c3797e0e54a input=a9049054013a1b77]*/

View File

@ -54,15 +54,10 @@ _codecs_lookup(PyObject *module, PyObject *arg)
_PyArg_BadArgument("lookup", "argument", "str", arg); _PyArg_BadArgument("lookup", "argument", "str", arg);
goto exit; goto exit;
} }
Py_ssize_t encoding_length; encoding = PyUnicode_AsUTF8(arg);
encoding = PyUnicode_AsUTF8AndSize(arg, &encoding_length);
if (encoding == NULL) { if (encoding == NULL) {
goto exit; goto exit;
} }
if (strlen(encoding) != (size_t)encoding_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
return_value = _codecs_lookup_impl(module, encoding); return_value = _codecs_lookup_impl(module, encoding);
exit: exit:
@ -136,15 +131,10 @@ _codecs_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObje
_PyArg_BadArgument("encode", "argument 'encoding'", "str", args[1]); _PyArg_BadArgument("encode", "argument 'encoding'", "str", args[1]);
goto exit; goto exit;
} }
Py_ssize_t encoding_length; encoding = PyUnicode_AsUTF8(args[1]);
encoding = PyUnicode_AsUTF8AndSize(args[1], &encoding_length);
if (encoding == NULL) { if (encoding == NULL) {
goto exit; goto exit;
} }
if (strlen(encoding) != (size_t)encoding_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
if (!--noptargs) { if (!--noptargs) {
goto skip_optional_pos; goto skip_optional_pos;
} }
@ -153,15 +143,10 @@ _codecs_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObje
_PyArg_BadArgument("encode", "argument 'errors'", "str", args[2]); _PyArg_BadArgument("encode", "argument 'errors'", "str", args[2]);
goto exit; goto exit;
} }
Py_ssize_t errors_length; errors = PyUnicode_AsUTF8(args[2]);
errors = PyUnicode_AsUTF8AndSize(args[2], &errors_length);
if (errors == NULL) { if (errors == NULL) {
goto exit; goto exit;
} }
if (strlen(errors) != (size_t)errors_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
skip_optional_pos: skip_optional_pos:
return_value = _codecs_encode_impl(module, obj, encoding, errors); return_value = _codecs_encode_impl(module, obj, encoding, errors);
@ -236,15 +221,10 @@ _codecs_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObje
_PyArg_BadArgument("decode", "argument 'encoding'", "str", args[1]); _PyArg_BadArgument("decode", "argument 'encoding'", "str", args[1]);
goto exit; goto exit;
} }
Py_ssize_t encoding_length; encoding = PyUnicode_AsUTF8(args[1]);
encoding = PyUnicode_AsUTF8AndSize(args[1], &encoding_length);
if (encoding == NULL) { if (encoding == NULL) {
goto exit; goto exit;
} }
if (strlen(encoding) != (size_t)encoding_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
if (!--noptargs) { if (!--noptargs) {
goto skip_optional_pos; goto skip_optional_pos;
} }
@ -253,15 +233,10 @@ _codecs_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObje
_PyArg_BadArgument("decode", "argument 'errors'", "str", args[2]); _PyArg_BadArgument("decode", "argument 'errors'", "str", args[2]);
goto exit; goto exit;
} }
Py_ssize_t errors_length; errors = PyUnicode_AsUTF8(args[2]);
errors = PyUnicode_AsUTF8AndSize(args[2], &errors_length);
if (errors == NULL) { if (errors == NULL) {
goto exit; goto exit;
} }
if (strlen(errors) != (size_t)errors_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
skip_optional_pos: skip_optional_pos:
return_value = _codecs_decode_impl(module, obj, encoding, errors); return_value = _codecs_decode_impl(module, obj, encoding, errors);
@ -311,15 +286,10 @@ _codecs_escape_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
errors = NULL; errors = NULL;
} }
else if (PyUnicode_Check(args[1])) { else if (PyUnicode_Check(args[1])) {
Py_ssize_t errors_length; errors = PyUnicode_AsUTF8(args[1]);
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
if (errors == NULL) { if (errors == NULL) {
goto exit; goto exit;
} }
if (strlen(errors) != (size_t)errors_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
} }
else { else {
_PyArg_BadArgument("escape_decode", "argument 2", "str or None", args[1]); _PyArg_BadArgument("escape_decode", "argument 2", "str or None", args[1]);
@ -371,15 +341,10 @@ _codecs_escape_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
errors = NULL; errors = NULL;
} }
else if (PyUnicode_Check(args[1])) { else if (PyUnicode_Check(args[1])) {
Py_ssize_t errors_length; errors = PyUnicode_AsUTF8(args[1]);
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
if (errors == NULL) { if (errors == NULL) {
goto exit; goto exit;
} }
if (strlen(errors) != (size_t)errors_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
} }
else { else {
_PyArg_BadArgument("escape_encode", "argument 2", "str or None", args[1]); _PyArg_BadArgument("escape_encode", "argument 2", "str or None", args[1]);
@ -425,15 +390,10 @@ _codecs_utf_7_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
errors = NULL; errors = NULL;
} }
else if (PyUnicode_Check(args[1])) { else if (PyUnicode_Check(args[1])) {
Py_ssize_t errors_length; errors = PyUnicode_AsUTF8(args[1]);
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
if (errors == NULL) { if (errors == NULL) {
goto exit; goto exit;
} }
if (strlen(errors) != (size_t)errors_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
} }
else { else {
_PyArg_BadArgument("utf_7_decode", "argument 2", "str or None", args[1]); _PyArg_BadArgument("utf_7_decode", "argument 2", "str or None", args[1]);
@ -491,15 +451,10 @@ _codecs_utf_8_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
errors = NULL; errors = NULL;
} }
else if (PyUnicode_Check(args[1])) { else if (PyUnicode_Check(args[1])) {
Py_ssize_t errors_length; errors = PyUnicode_AsUTF8(args[1]);
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
if (errors == NULL) { if (errors == NULL) {
goto exit; goto exit;
} }
if (strlen(errors) != (size_t)errors_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
} }
else { else {
_PyArg_BadArgument("utf_8_decode", "argument 2", "str or None", args[1]); _PyArg_BadArgument("utf_8_decode", "argument 2", "str or None", args[1]);
@ -557,15 +512,10 @@ _codecs_utf_16_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
errors = NULL; errors = NULL;
} }
else if (PyUnicode_Check(args[1])) { else if (PyUnicode_Check(args[1])) {
Py_ssize_t errors_length; errors = PyUnicode_AsUTF8(args[1]);
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
if (errors == NULL) { if (errors == NULL) {
goto exit; goto exit;
} }
if (strlen(errors) != (size_t)errors_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
} }
else { else {
_PyArg_BadArgument("utf_16_decode", "argument 2", "str or None", args[1]); _PyArg_BadArgument("utf_16_decode", "argument 2", "str or None", args[1]);
@ -623,15 +573,10 @@ _codecs_utf_16_le_decode(PyObject *module, PyObject *const *args, Py_ssize_t nar
errors = NULL; errors = NULL;
} }
else if (PyUnicode_Check(args[1])) { else if (PyUnicode_Check(args[1])) {
Py_ssize_t errors_length; errors = PyUnicode_AsUTF8(args[1]);
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
if (errors == NULL) { if (errors == NULL) {
goto exit; goto exit;
} }
if (strlen(errors) != (size_t)errors_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
} }
else { else {
_PyArg_BadArgument("utf_16_le_decode", "argument 2", "str or None", args[1]); _PyArg_BadArgument("utf_16_le_decode", "argument 2", "str or None", args[1]);
@ -689,15 +634,10 @@ _codecs_utf_16_be_decode(PyObject *module, PyObject *const *args, Py_ssize_t nar
errors = NULL; errors = NULL;
} }
else if (PyUnicode_Check(args[1])) { else if (PyUnicode_Check(args[1])) {
Py_ssize_t errors_length; errors = PyUnicode_AsUTF8(args[1]);
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
if (errors == NULL) { if (errors == NULL) {
goto exit; goto exit;
} }
if (strlen(errors) != (size_t)errors_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
} }
else { else {
_PyArg_BadArgument("utf_16_be_decode", "argument 2", "str or None", args[1]); _PyArg_BadArgument("utf_16_be_decode", "argument 2", "str or None", args[1]);
@ -757,15 +697,10 @@ _codecs_utf_16_ex_decode(PyObject *module, PyObject *const *args, Py_ssize_t nar
errors = NULL; errors = NULL;
} }
else if (PyUnicode_Check(args[1])) { else if (PyUnicode_Check(args[1])) {
Py_ssize_t errors_length; errors = PyUnicode_AsUTF8(args[1]);
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
if (errors == NULL) { if (errors == NULL) {
goto exit; goto exit;
} }
if (strlen(errors) != (size_t)errors_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
} }
else { else {
_PyArg_BadArgument("utf_16_ex_decode", "argument 2", "str or None", args[1]); _PyArg_BadArgument("utf_16_ex_decode", "argument 2", "str or None", args[1]);
@ -830,15 +765,10 @@ _codecs_utf_32_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
errors = NULL; errors = NULL;
} }
else if (PyUnicode_Check(args[1])) { else if (PyUnicode_Check(args[1])) {
Py_ssize_t errors_length; errors = PyUnicode_AsUTF8(args[1]);
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
if (errors == NULL) { if (errors == NULL) {
goto exit; goto exit;
} }
if (strlen(errors) != (size_t)errors_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
} }
else { else {
_PyArg_BadArgument("utf_32_decode", "argument 2", "str or None", args[1]); _PyArg_BadArgument("utf_32_decode", "argument 2", "str or None", args[1]);
@ -896,15 +826,10 @@ _codecs_utf_32_le_decode(PyObject *module, PyObject *const *args, Py_ssize_t nar
errors = NULL; errors = NULL;
} }
else if (PyUnicode_Check(args[1])) { else if (PyUnicode_Check(args[1])) {
Py_ssize_t errors_length; errors = PyUnicode_AsUTF8(args[1]);
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
if (errors == NULL) { if (errors == NULL) {
goto exit; goto exit;
} }
if (strlen(errors) != (size_t)errors_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
} }
else { else {
_PyArg_BadArgument("utf_32_le_decode", "argument 2", "str or None", args[1]); _PyArg_BadArgument("utf_32_le_decode", "argument 2", "str or None", args[1]);
@ -962,15 +887,10 @@ _codecs_utf_32_be_decode(PyObject *module, PyObject *const *args, Py_ssize_t nar
errors = NULL; errors = NULL;
} }
else if (PyUnicode_Check(args[1])) { else if (PyUnicode_Check(args[1])) {
Py_ssize_t errors_length; errors = PyUnicode_AsUTF8(args[1]);
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
if (errors == NULL) { if (errors == NULL) {
goto exit; goto exit;
} }
if (strlen(errors) != (size_t)errors_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
} }
else { else {
_PyArg_BadArgument("utf_32_be_decode", "argument 2", "str or None", args[1]); _PyArg_BadArgument("utf_32_be_decode", "argument 2", "str or None", args[1]);
@ -1030,15 +950,10 @@ _codecs_utf_32_ex_decode(PyObject *module, PyObject *const *args, Py_ssize_t nar
errors = NULL; errors = NULL;
} }
else if (PyUnicode_Check(args[1])) { else if (PyUnicode_Check(args[1])) {
Py_ssize_t errors_length; errors = PyUnicode_AsUTF8(args[1]);
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
if (errors == NULL) { if (errors == NULL) {
goto exit; goto exit;
} }
if (strlen(errors) != (size_t)errors_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
} }
else { else {
_PyArg_BadArgument("utf_32_ex_decode", "argument 2", "str or None", args[1]); _PyArg_BadArgument("utf_32_ex_decode", "argument 2", "str or None", args[1]);
@ -1113,15 +1028,10 @@ _codecs_unicode_escape_decode(PyObject *module, PyObject *const *args, Py_ssize_
errors = NULL; errors = NULL;
} }
else if (PyUnicode_Check(args[1])) { else if (PyUnicode_Check(args[1])) {
Py_ssize_t errors_length; errors = PyUnicode_AsUTF8(args[1]);
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
if (errors == NULL) { if (errors == NULL) {
goto exit; goto exit;
} }
if (strlen(errors) != (size_t)errors_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
} }
else { else {
_PyArg_BadArgument("unicode_escape_decode", "argument 2", "str or None", args[1]); _PyArg_BadArgument("unicode_escape_decode", "argument 2", "str or None", args[1]);
@ -1189,15 +1099,10 @@ _codecs_raw_unicode_escape_decode(PyObject *module, PyObject *const *args, Py_ss
errors = NULL; errors = NULL;
} }
else if (PyUnicode_Check(args[1])) { else if (PyUnicode_Check(args[1])) {
Py_ssize_t errors_length; errors = PyUnicode_AsUTF8(args[1]);
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
if (errors == NULL) { if (errors == NULL) {
goto exit; goto exit;
} }
if (strlen(errors) != (size_t)errors_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
} }
else { else {
_PyArg_BadArgument("raw_unicode_escape_decode", "argument 2", "str or None", args[1]); _PyArg_BadArgument("raw_unicode_escape_decode", "argument 2", "str or None", args[1]);
@ -1254,15 +1159,10 @@ _codecs_latin_1_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs
errors = NULL; errors = NULL;
} }
else if (PyUnicode_Check(args[1])) { else if (PyUnicode_Check(args[1])) {
Py_ssize_t errors_length; errors = PyUnicode_AsUTF8(args[1]);
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
if (errors == NULL) { if (errors == NULL) {
goto exit; goto exit;
} }
if (strlen(errors) != (size_t)errors_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
} }
else { else {
_PyArg_BadArgument("latin_1_decode", "argument 2", "str or None", args[1]); _PyArg_BadArgument("latin_1_decode", "argument 2", "str or None", args[1]);
@ -1312,15 +1212,10 @@ _codecs_ascii_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
errors = NULL; errors = NULL;
} }
else if (PyUnicode_Check(args[1])) { else if (PyUnicode_Check(args[1])) {
Py_ssize_t errors_length; errors = PyUnicode_AsUTF8(args[1]);
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
if (errors == NULL) { if (errors == NULL) {
goto exit; goto exit;
} }
if (strlen(errors) != (size_t)errors_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
} }
else { else {
_PyArg_BadArgument("ascii_decode", "argument 2", "str or None", args[1]); _PyArg_BadArgument("ascii_decode", "argument 2", "str or None", args[1]);
@ -1371,15 +1266,10 @@ _codecs_charmap_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs
errors = NULL; errors = NULL;
} }
else if (PyUnicode_Check(args[1])) { else if (PyUnicode_Check(args[1])) {
Py_ssize_t errors_length; errors = PyUnicode_AsUTF8(args[1]);
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
if (errors == NULL) { if (errors == NULL) {
goto exit; goto exit;
} }
if (strlen(errors) != (size_t)errors_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
} }
else { else {
_PyArg_BadArgument("charmap_decode", "argument 2", "str or None", args[1]); _PyArg_BadArgument("charmap_decode", "argument 2", "str or None", args[1]);
@ -1436,15 +1326,10 @@ _codecs_mbcs_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
errors = NULL; errors = NULL;
} }
else if (PyUnicode_Check(args[1])) { else if (PyUnicode_Check(args[1])) {
Py_ssize_t errors_length; errors = PyUnicode_AsUTF8(args[1]);
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
if (errors == NULL) { if (errors == NULL) {
goto exit; goto exit;
} }
if (strlen(errors) != (size_t)errors_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
} }
else { else {
_PyArg_BadArgument("mbcs_decode", "argument 2", "str or None", args[1]); _PyArg_BadArgument("mbcs_decode", "argument 2", "str or None", args[1]);
@ -1506,15 +1391,10 @@ _codecs_oem_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
errors = NULL; errors = NULL;
} }
else if (PyUnicode_Check(args[1])) { else if (PyUnicode_Check(args[1])) {
Py_ssize_t errors_length; errors = PyUnicode_AsUTF8(args[1]);
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
if (errors == NULL) { if (errors == NULL) {
goto exit; goto exit;
} }
if (strlen(errors) != (size_t)errors_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
} }
else { else {
_PyArg_BadArgument("oem_decode", "argument 2", "str or None", args[1]); _PyArg_BadArgument("oem_decode", "argument 2", "str or None", args[1]);
@ -1581,15 +1461,10 @@ _codecs_code_page_decode(PyObject *module, PyObject *const *args, Py_ssize_t nar
errors = NULL; errors = NULL;
} }
else if (PyUnicode_Check(args[2])) { else if (PyUnicode_Check(args[2])) {
Py_ssize_t errors_length; errors = PyUnicode_AsUTF8(args[2]);
errors = PyUnicode_AsUTF8AndSize(args[2], &errors_length);
if (errors == NULL) { if (errors == NULL) {
goto exit; goto exit;
} }
if (strlen(errors) != (size_t)errors_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
} }
else { else {
_PyArg_BadArgument("code_page_decode", "argument 3", "str or None", args[2]); _PyArg_BadArgument("code_page_decode", "argument 3", "str or None", args[2]);
@ -1658,15 +1533,10 @@ _codecs_readbuffer_encode(PyObject *module, PyObject *const *args, Py_ssize_t na
errors = NULL; errors = NULL;
} }
else if (PyUnicode_Check(args[1])) { else if (PyUnicode_Check(args[1])) {
Py_ssize_t errors_length; errors = PyUnicode_AsUTF8(args[1]);
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
if (errors == NULL) { if (errors == NULL) {
goto exit; goto exit;
} }
if (strlen(errors) != (size_t)errors_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
} }
else { else {
_PyArg_BadArgument("readbuffer_encode", "argument 2", "str or None", args[1]); _PyArg_BadArgument("readbuffer_encode", "argument 2", "str or None", args[1]);
@ -1718,15 +1588,10 @@ _codecs_utf_7_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
errors = NULL; errors = NULL;
} }
else if (PyUnicode_Check(args[1])) { else if (PyUnicode_Check(args[1])) {
Py_ssize_t errors_length; errors = PyUnicode_AsUTF8(args[1]);
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
if (errors == NULL) { if (errors == NULL) {
goto exit; goto exit;
} }
if (strlen(errors) != (size_t)errors_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
} }
else { else {
_PyArg_BadArgument("utf_7_encode", "argument 2", "str or None", args[1]); _PyArg_BadArgument("utf_7_encode", "argument 2", "str or None", args[1]);
@ -1773,15 +1638,10 @@ _codecs_utf_8_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
errors = NULL; errors = NULL;
} }
else if (PyUnicode_Check(args[1])) { else if (PyUnicode_Check(args[1])) {
Py_ssize_t errors_length; errors = PyUnicode_AsUTF8(args[1]);
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
if (errors == NULL) { if (errors == NULL) {
goto exit; goto exit;
} }
if (strlen(errors) != (size_t)errors_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
} }
else { else {
_PyArg_BadArgument("utf_8_encode", "argument 2", "str or None", args[1]); _PyArg_BadArgument("utf_8_encode", "argument 2", "str or None", args[1]);
@ -1829,15 +1689,10 @@ _codecs_utf_16_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
errors = NULL; errors = NULL;
} }
else if (PyUnicode_Check(args[1])) { else if (PyUnicode_Check(args[1])) {
Py_ssize_t errors_length; errors = PyUnicode_AsUTF8(args[1]);
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
if (errors == NULL) { if (errors == NULL) {
goto exit; goto exit;
} }
if (strlen(errors) != (size_t)errors_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
} }
else { else {
_PyArg_BadArgument("utf_16_encode", "argument 2", "str or None", args[1]); _PyArg_BadArgument("utf_16_encode", "argument 2", "str or None", args[1]);
@ -1891,15 +1746,10 @@ _codecs_utf_16_le_encode(PyObject *module, PyObject *const *args, Py_ssize_t nar
errors = NULL; errors = NULL;
} }
else if (PyUnicode_Check(args[1])) { else if (PyUnicode_Check(args[1])) {
Py_ssize_t errors_length; errors = PyUnicode_AsUTF8(args[1]);
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
if (errors == NULL) { if (errors == NULL) {
goto exit; goto exit;
} }
if (strlen(errors) != (size_t)errors_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
} }
else { else {
_PyArg_BadArgument("utf_16_le_encode", "argument 2", "str or None", args[1]); _PyArg_BadArgument("utf_16_le_encode", "argument 2", "str or None", args[1]);
@ -1946,15 +1796,10 @@ _codecs_utf_16_be_encode(PyObject *module, PyObject *const *args, Py_ssize_t nar
errors = NULL; errors = NULL;
} }
else if (PyUnicode_Check(args[1])) { else if (PyUnicode_Check(args[1])) {
Py_ssize_t errors_length; errors = PyUnicode_AsUTF8(args[1]);
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
if (errors == NULL) { if (errors == NULL) {
goto exit; goto exit;
} }
if (strlen(errors) != (size_t)errors_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
} }
else { else {
_PyArg_BadArgument("utf_16_be_encode", "argument 2", "str or None", args[1]); _PyArg_BadArgument("utf_16_be_encode", "argument 2", "str or None", args[1]);
@ -2002,15 +1847,10 @@ _codecs_utf_32_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
errors = NULL; errors = NULL;
} }
else if (PyUnicode_Check(args[1])) { else if (PyUnicode_Check(args[1])) {
Py_ssize_t errors_length; errors = PyUnicode_AsUTF8(args[1]);
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
if (errors == NULL) { if (errors == NULL) {
goto exit; goto exit;
} }
if (strlen(errors) != (size_t)errors_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
} }
else { else {
_PyArg_BadArgument("utf_32_encode", "argument 2", "str or None", args[1]); _PyArg_BadArgument("utf_32_encode", "argument 2", "str or None", args[1]);
@ -2064,15 +1904,10 @@ _codecs_utf_32_le_encode(PyObject *module, PyObject *const *args, Py_ssize_t nar
errors = NULL; errors = NULL;
} }
else if (PyUnicode_Check(args[1])) { else if (PyUnicode_Check(args[1])) {
Py_ssize_t errors_length; errors = PyUnicode_AsUTF8(args[1]);
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
if (errors == NULL) { if (errors == NULL) {
goto exit; goto exit;
} }
if (strlen(errors) != (size_t)errors_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
} }
else { else {
_PyArg_BadArgument("utf_32_le_encode", "argument 2", "str or None", args[1]); _PyArg_BadArgument("utf_32_le_encode", "argument 2", "str or None", args[1]);
@ -2119,15 +1954,10 @@ _codecs_utf_32_be_encode(PyObject *module, PyObject *const *args, Py_ssize_t nar
errors = NULL; errors = NULL;
} }
else if (PyUnicode_Check(args[1])) { else if (PyUnicode_Check(args[1])) {
Py_ssize_t errors_length; errors = PyUnicode_AsUTF8(args[1]);
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
if (errors == NULL) { if (errors == NULL) {
goto exit; goto exit;
} }
if (strlen(errors) != (size_t)errors_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
} }
else { else {
_PyArg_BadArgument("utf_32_be_encode", "argument 2", "str or None", args[1]); _PyArg_BadArgument("utf_32_be_encode", "argument 2", "str or None", args[1]);
@ -2174,15 +2004,10 @@ _codecs_unicode_escape_encode(PyObject *module, PyObject *const *args, Py_ssize_
errors = NULL; errors = NULL;
} }
else if (PyUnicode_Check(args[1])) { else if (PyUnicode_Check(args[1])) {
Py_ssize_t errors_length; errors = PyUnicode_AsUTF8(args[1]);
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
if (errors == NULL) { if (errors == NULL) {
goto exit; goto exit;
} }
if (strlen(errors) != (size_t)errors_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
} }
else { else {
_PyArg_BadArgument("unicode_escape_encode", "argument 2", "str or None", args[1]); _PyArg_BadArgument("unicode_escape_encode", "argument 2", "str or None", args[1]);
@ -2229,15 +2054,10 @@ _codecs_raw_unicode_escape_encode(PyObject *module, PyObject *const *args, Py_ss
errors = NULL; errors = NULL;
} }
else if (PyUnicode_Check(args[1])) { else if (PyUnicode_Check(args[1])) {
Py_ssize_t errors_length; errors = PyUnicode_AsUTF8(args[1]);
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
if (errors == NULL) { if (errors == NULL) {
goto exit; goto exit;
} }
if (strlen(errors) != (size_t)errors_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
} }
else { else {
_PyArg_BadArgument("raw_unicode_escape_encode", "argument 2", "str or None", args[1]); _PyArg_BadArgument("raw_unicode_escape_encode", "argument 2", "str or None", args[1]);
@ -2284,15 +2104,10 @@ _codecs_latin_1_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs
errors = NULL; errors = NULL;
} }
else if (PyUnicode_Check(args[1])) { else if (PyUnicode_Check(args[1])) {
Py_ssize_t errors_length; errors = PyUnicode_AsUTF8(args[1]);
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
if (errors == NULL) { if (errors == NULL) {
goto exit; goto exit;
} }
if (strlen(errors) != (size_t)errors_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
} }
else { else {
_PyArg_BadArgument("latin_1_encode", "argument 2", "str or None", args[1]); _PyArg_BadArgument("latin_1_encode", "argument 2", "str or None", args[1]);
@ -2339,15 +2154,10 @@ _codecs_ascii_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
errors = NULL; errors = NULL;
} }
else if (PyUnicode_Check(args[1])) { else if (PyUnicode_Check(args[1])) {
Py_ssize_t errors_length; errors = PyUnicode_AsUTF8(args[1]);
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
if (errors == NULL) { if (errors == NULL) {
goto exit; goto exit;
} }
if (strlen(errors) != (size_t)errors_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
} }
else { else {
_PyArg_BadArgument("ascii_encode", "argument 2", "str or None", args[1]); _PyArg_BadArgument("ascii_encode", "argument 2", "str or None", args[1]);
@ -2395,15 +2205,10 @@ _codecs_charmap_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs
errors = NULL; errors = NULL;
} }
else if (PyUnicode_Check(args[1])) { else if (PyUnicode_Check(args[1])) {
Py_ssize_t errors_length; errors = PyUnicode_AsUTF8(args[1]);
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
if (errors == NULL) { if (errors == NULL) {
goto exit; goto exit;
} }
if (strlen(errors) != (size_t)errors_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
} }
else { else {
_PyArg_BadArgument("charmap_encode", "argument 2", "str or None", args[1]); _PyArg_BadArgument("charmap_encode", "argument 2", "str or None", args[1]);
@ -2483,15 +2288,10 @@ _codecs_mbcs_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
errors = NULL; errors = NULL;
} }
else if (PyUnicode_Check(args[1])) { else if (PyUnicode_Check(args[1])) {
Py_ssize_t errors_length; errors = PyUnicode_AsUTF8(args[1]);
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
if (errors == NULL) { if (errors == NULL) {
goto exit; goto exit;
} }
if (strlen(errors) != (size_t)errors_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
} }
else { else {
_PyArg_BadArgument("mbcs_encode", "argument 2", "str or None", args[1]); _PyArg_BadArgument("mbcs_encode", "argument 2", "str or None", args[1]);
@ -2541,15 +2341,10 @@ _codecs_oem_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
errors = NULL; errors = NULL;
} }
else if (PyUnicode_Check(args[1])) { else if (PyUnicode_Check(args[1])) {
Py_ssize_t errors_length; errors = PyUnicode_AsUTF8(args[1]);
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
if (errors == NULL) { if (errors == NULL) {
goto exit; goto exit;
} }
if (strlen(errors) != (size_t)errors_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
} }
else { else {
_PyArg_BadArgument("oem_encode", "argument 2", "str or None", args[1]); _PyArg_BadArgument("oem_encode", "argument 2", "str or None", args[1]);
@ -2605,15 +2400,10 @@ _codecs_code_page_encode(PyObject *module, PyObject *const *args, Py_ssize_t nar
errors = NULL; errors = NULL;
} }
else if (PyUnicode_Check(args[2])) { else if (PyUnicode_Check(args[2])) {
Py_ssize_t errors_length; errors = PyUnicode_AsUTF8(args[2]);
errors = PyUnicode_AsUTF8AndSize(args[2], &errors_length);
if (errors == NULL) { if (errors == NULL) {
goto exit; goto exit;
} }
if (strlen(errors) != (size_t)errors_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
} }
else { else {
_PyArg_BadArgument("code_page_encode", "argument 3", "str or None", args[2]); _PyArg_BadArgument("code_page_encode", "argument 3", "str or None", args[2]);
@ -2659,15 +2449,10 @@ _codecs_register_error(PyObject *module, PyObject *const *args, Py_ssize_t nargs
_PyArg_BadArgument("register_error", "argument 1", "str", args[0]); _PyArg_BadArgument("register_error", "argument 1", "str", args[0]);
goto exit; goto exit;
} }
Py_ssize_t errors_length; errors = PyUnicode_AsUTF8(args[0]);
errors = PyUnicode_AsUTF8AndSize(args[0], &errors_length);
if (errors == NULL) { if (errors == NULL) {
goto exit; goto exit;
} }
if (strlen(errors) != (size_t)errors_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
handler = args[1]; handler = args[1];
return_value = _codecs_register_error_impl(module, errors, handler); return_value = _codecs_register_error_impl(module, errors, handler);
@ -2700,15 +2485,10 @@ _codecs_lookup_error(PyObject *module, PyObject *arg)
_PyArg_BadArgument("lookup_error", "argument", "str", arg); _PyArg_BadArgument("lookup_error", "argument", "str", arg);
goto exit; goto exit;
} }
Py_ssize_t name_length; name = PyUnicode_AsUTF8(arg);
name = PyUnicode_AsUTF8AndSize(arg, &name_length);
if (name == NULL) { if (name == NULL) {
goto exit; goto exit;
} }
if (strlen(name) != (size_t)name_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
return_value = _codecs_lookup_error_impl(module, name); return_value = _codecs_lookup_error_impl(module, name);
exit: exit:
@ -2738,4 +2518,4 @@ exit:
#ifndef _CODECS_CODE_PAGE_ENCODE_METHODDEF #ifndef _CODECS_CODE_PAGE_ENCODE_METHODDEF
#define _CODECS_CODE_PAGE_ENCODE_METHODDEF #define _CODECS_CODE_PAGE_ENCODE_METHODDEF
#endif /* !defined(_CODECS_CODE_PAGE_ENCODE_METHODDEF) */ #endif /* !defined(_CODECS_CODE_PAGE_ENCODE_METHODDEF) */
/*[clinic end generated code: output=d8d9e372f7ccba35 input=a9049054013a1b77]*/ /*[clinic end generated code: output=5c95a170d813a46f input=a9049054013a1b77]*/

View File

@ -2726,15 +2726,10 @@ _curses_setupterm(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyO
term = NULL; term = NULL;
} }
else if (PyUnicode_Check(args[0])) { else if (PyUnicode_Check(args[0])) {
Py_ssize_t term_length; term = PyUnicode_AsUTF8(args[0]);
term = PyUnicode_AsUTF8AndSize(args[0], &term_length);
if (term == NULL) { if (term == NULL) {
goto exit; goto exit;
} }
if (strlen(term) != (size_t)term_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
} }
else { else {
_PyArg_BadArgument("setupterm", "argument 'term'", "str or None", args[0]); _PyArg_BadArgument("setupterm", "argument 'term'", "str or None", args[0]);
@ -3926,15 +3921,10 @@ _curses_tigetflag(PyObject *module, PyObject *arg)
_PyArg_BadArgument("tigetflag", "argument", "str", arg); _PyArg_BadArgument("tigetflag", "argument", "str", arg);
goto exit; goto exit;
} }
Py_ssize_t capname_length; capname = PyUnicode_AsUTF8(arg);
capname = PyUnicode_AsUTF8AndSize(arg, &capname_length);
if (capname == NULL) { if (capname == NULL) {
goto exit; goto exit;
} }
if (strlen(capname) != (size_t)capname_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
return_value = _curses_tigetflag_impl(module, capname); return_value = _curses_tigetflag_impl(module, capname);
exit: exit:
@ -3969,15 +3959,10 @@ _curses_tigetnum(PyObject *module, PyObject *arg)
_PyArg_BadArgument("tigetnum", "argument", "str", arg); _PyArg_BadArgument("tigetnum", "argument", "str", arg);
goto exit; goto exit;
} }
Py_ssize_t capname_length; capname = PyUnicode_AsUTF8(arg);
capname = PyUnicode_AsUTF8AndSize(arg, &capname_length);
if (capname == NULL) { if (capname == NULL) {
goto exit; goto exit;
} }
if (strlen(capname) != (size_t)capname_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
return_value = _curses_tigetnum_impl(module, capname); return_value = _curses_tigetnum_impl(module, capname);
exit: exit:
@ -4012,15 +3997,10 @@ _curses_tigetstr(PyObject *module, PyObject *arg)
_PyArg_BadArgument("tigetstr", "argument", "str", arg); _PyArg_BadArgument("tigetstr", "argument", "str", arg);
goto exit; goto exit;
} }
Py_ssize_t capname_length; capname = PyUnicode_AsUTF8(arg);
capname = PyUnicode_AsUTF8AndSize(arg, &capname_length);
if (capname == NULL) { if (capname == NULL) {
goto exit; goto exit;
} }
if (strlen(capname) != (size_t)capname_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
return_value = _curses_tigetstr_impl(module, capname); return_value = _curses_tigetstr_impl(module, capname);
exit: exit:
@ -4318,4 +4298,4 @@ _curses_has_extended_color_support(PyObject *module, PyObject *Py_UNUSED(ignored
#ifndef _CURSES_USE_DEFAULT_COLORS_METHODDEF #ifndef _CURSES_USE_DEFAULT_COLORS_METHODDEF
#define _CURSES_USE_DEFAULT_COLORS_METHODDEF #define _CURSES_USE_DEFAULT_COLORS_METHODDEF
#endif /* !defined(_CURSES_USE_DEFAULT_COLORS_METHODDEF) */ #endif /* !defined(_CURSES_USE_DEFAULT_COLORS_METHODDEF) */
/*[clinic end generated code: output=96887782374f070a input=a9049054013a1b77]*/ /*[clinic end generated code: output=555e266fc4838612 input=a9049054013a1b77]*/

View File

@ -196,15 +196,10 @@ dbmopen(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
_PyArg_BadArgument("open", "argument 2", "str", args[1]); _PyArg_BadArgument("open", "argument 2", "str", args[1]);
goto exit; goto exit;
} }
Py_ssize_t flags_length; flags = PyUnicode_AsUTF8(args[1]);
flags = PyUnicode_AsUTF8AndSize(args[1], &flags_length);
if (flags == NULL) { if (flags == NULL) {
goto exit; goto exit;
} }
if (strlen(flags) != (size_t)flags_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
if (nargs < 3) { if (nargs < 3) {
goto skip_optional; goto skip_optional;
} }
@ -218,4 +213,4 @@ skip_optional:
exit: exit:
return return_value; return return_value;
} }
/*[clinic end generated code: output=96fdd4bd7bd256c5 input=a9049054013a1b77]*/ /*[clinic end generated code: output=48183905532205c2 input=a9049054013a1b77]*/

View File

@ -1131,15 +1131,10 @@ _elementtree_XMLParser___init__(PyObject *self, PyObject *args, PyObject *kwargs
encoding = NULL; encoding = NULL;
} }
else if (PyUnicode_Check(fastargs[1])) { else if (PyUnicode_Check(fastargs[1])) {
Py_ssize_t encoding_length; encoding = PyUnicode_AsUTF8(fastargs[1]);
encoding = PyUnicode_AsUTF8AndSize(fastargs[1], &encoding_length);
if (encoding == NULL) { if (encoding == NULL) {
goto exit; goto exit;
} }
if (strlen(encoding) != (size_t)encoding_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
} }
else { else {
_PyArg_BadArgument("XMLParser", "argument 'encoding'", "str or None", fastargs[1]); _PyArg_BadArgument("XMLParser", "argument 'encoding'", "str or None", fastargs[1]);
@ -1219,4 +1214,4 @@ skip_optional:
exit: exit:
return return_value; return return_value;
} }
/*[clinic end generated code: output=8fdaa17d3262800a input=a9049054013a1b77]*/ /*[clinic end generated code: output=399d9d5c9435070b input=a9049054013a1b77]*/

View File

@ -318,15 +318,10 @@ dbmopen(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
_PyArg_BadArgument("open", "argument 2", "str", args[1]); _PyArg_BadArgument("open", "argument 2", "str", args[1]);
goto exit; goto exit;
} }
Py_ssize_t flags_length; flags = PyUnicode_AsUTF8(args[1]);
flags = PyUnicode_AsUTF8AndSize(args[1], &flags_length);
if (flags == NULL) { if (flags == NULL) {
goto exit; goto exit;
} }
if (strlen(flags) != (size_t)flags_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
if (nargs < 3) { if (nargs < 3) {
goto skip_optional; goto skip_optional;
} }
@ -340,4 +335,4 @@ skip_optional:
exit: exit:
return return_value; return return_value;
} }
/*[clinic end generated code: output=c5ee922363d5a81f input=a9049054013a1b77]*/ /*[clinic end generated code: output=725cafd8b2d8cfdb input=a9049054013a1b77]*/

View File

@ -1278,15 +1278,10 @@ pbkdf2_hmac(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
_PyArg_BadArgument("pbkdf2_hmac", "argument 'hash_name'", "str", args[0]); _PyArg_BadArgument("pbkdf2_hmac", "argument 'hash_name'", "str", args[0]);
goto exit; goto exit;
} }
Py_ssize_t hash_name_length; hash_name = PyUnicode_AsUTF8(args[0]);
hash_name = PyUnicode_AsUTF8AndSize(args[0], &hash_name_length);
if (hash_name == NULL) { if (hash_name == NULL) {
goto exit; goto exit;
} }
if (strlen(hash_name) != (size_t)hash_name_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
if (PyObject_GetBuffer(args[1], &password, PyBUF_SIMPLE) != 0) { if (PyObject_GetBuffer(args[1], &password, PyBUF_SIMPLE) != 0) {
goto exit; goto exit;
} }
@ -1824,4 +1819,4 @@ exit:
#ifndef _HASHLIB_SCRYPT_METHODDEF #ifndef _HASHLIB_SCRYPT_METHODDEF
#define _HASHLIB_SCRYPT_METHODDEF #define _HASHLIB_SCRYPT_METHODDEF
#endif /* !defined(_HASHLIB_SCRYPT_METHODDEF) */ #endif /* !defined(_HASHLIB_SCRYPT_METHODDEF) */
/*[clinic end generated code: output=b7eddeb3d6ccdeec input=a9049054013a1b77]*/ /*[clinic end generated code: output=bc372898eaa3e000 input=a9049054013a1b77]*/

View File

@ -37,15 +37,10 @@ _locale_setlocale(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
locale = NULL; locale = NULL;
} }
else if (PyUnicode_Check(args[1])) { else if (PyUnicode_Check(args[1])) {
Py_ssize_t locale_length; locale = PyUnicode_AsUTF8(args[1]);
locale = PyUnicode_AsUTF8AndSize(args[1], &locale_length);
if (locale == NULL) { if (locale == NULL) {
goto exit; goto exit;
} }
if (strlen(locale) != (size_t)locale_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
} }
else { else {
_PyArg_BadArgument("setlocale", "argument 2", "str or None", args[1]); _PyArg_BadArgument("setlocale", "argument 2", "str or None", args[1]);
@ -230,15 +225,10 @@ _locale_gettext(PyObject *module, PyObject *arg)
_PyArg_BadArgument("gettext", "argument", "str", arg); _PyArg_BadArgument("gettext", "argument", "str", arg);
goto exit; goto exit;
} }
Py_ssize_t in_length; in = PyUnicode_AsUTF8(arg);
in = PyUnicode_AsUTF8AndSize(arg, &in_length);
if (in == NULL) { if (in == NULL) {
goto exit; goto exit;
} }
if (strlen(in) != (size_t)in_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
return_value = _locale_gettext_impl(module, in); return_value = _locale_gettext_impl(module, in);
exit: exit:
@ -277,15 +267,10 @@ _locale_dgettext(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
domain = NULL; domain = NULL;
} }
else if (PyUnicode_Check(args[0])) { else if (PyUnicode_Check(args[0])) {
Py_ssize_t domain_length; domain = PyUnicode_AsUTF8(args[0]);
domain = PyUnicode_AsUTF8AndSize(args[0], &domain_length);
if (domain == NULL) { if (domain == NULL) {
goto exit; goto exit;
} }
if (strlen(domain) != (size_t)domain_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
} }
else { else {
_PyArg_BadArgument("dgettext", "argument 1", "str or None", args[0]); _PyArg_BadArgument("dgettext", "argument 1", "str or None", args[0]);
@ -295,15 +280,10 @@ _locale_dgettext(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
_PyArg_BadArgument("dgettext", "argument 2", "str", args[1]); _PyArg_BadArgument("dgettext", "argument 2", "str", args[1]);
goto exit; goto exit;
} }
Py_ssize_t in_length; in = PyUnicode_AsUTF8(args[1]);
in = PyUnicode_AsUTF8AndSize(args[1], &in_length);
if (in == NULL) { if (in == NULL) {
goto exit; goto exit;
} }
if (strlen(in) != (size_t)in_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
return_value = _locale_dgettext_impl(module, domain, in); return_value = _locale_dgettext_impl(module, domain, in);
exit: exit:
@ -342,15 +322,10 @@ _locale_dcgettext(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
domain = NULL; domain = NULL;
} }
else if (PyUnicode_Check(args[0])) { else if (PyUnicode_Check(args[0])) {
Py_ssize_t domain_length; domain = PyUnicode_AsUTF8(args[0]);
domain = PyUnicode_AsUTF8AndSize(args[0], &domain_length);
if (domain == NULL) { if (domain == NULL) {
goto exit; goto exit;
} }
if (strlen(domain) != (size_t)domain_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
} }
else { else {
_PyArg_BadArgument("dcgettext", "argument 1", "str or None", args[0]); _PyArg_BadArgument("dcgettext", "argument 1", "str or None", args[0]);
@ -360,15 +335,10 @@ _locale_dcgettext(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
_PyArg_BadArgument("dcgettext", "argument 2", "str", args[1]); _PyArg_BadArgument("dcgettext", "argument 2", "str", args[1]);
goto exit; goto exit;
} }
Py_ssize_t msgid_length; msgid = PyUnicode_AsUTF8(args[1]);
msgid = PyUnicode_AsUTF8AndSize(args[1], &msgid_length);
if (msgid == NULL) { if (msgid == NULL) {
goto exit; goto exit;
} }
if (strlen(msgid) != (size_t)msgid_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
category = PyLong_AsInt(args[2]); category = PyLong_AsInt(args[2]);
if (category == -1 && PyErr_Occurred()) { if (category == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -405,15 +375,10 @@ _locale_textdomain(PyObject *module, PyObject *arg)
domain = NULL; domain = NULL;
} }
else if (PyUnicode_Check(arg)) { else if (PyUnicode_Check(arg)) {
Py_ssize_t domain_length; domain = PyUnicode_AsUTF8(arg);
domain = PyUnicode_AsUTF8AndSize(arg, &domain_length);
if (domain == NULL) { if (domain == NULL) {
goto exit; goto exit;
} }
if (strlen(domain) != (size_t)domain_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
} }
else { else {
_PyArg_BadArgument("textdomain", "argument", "str or None", arg); _PyArg_BadArgument("textdomain", "argument", "str or None", arg);
@ -456,15 +421,10 @@ _locale_bindtextdomain(PyObject *module, PyObject *const *args, Py_ssize_t nargs
_PyArg_BadArgument("bindtextdomain", "argument 1", "str", args[0]); _PyArg_BadArgument("bindtextdomain", "argument 1", "str", args[0]);
goto exit; goto exit;
} }
Py_ssize_t domain_length; domain = PyUnicode_AsUTF8(args[0]);
domain = PyUnicode_AsUTF8AndSize(args[0], &domain_length);
if (domain == NULL) { if (domain == NULL) {
goto exit; goto exit;
} }
if (strlen(domain) != (size_t)domain_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
dirname_obj = args[1]; dirname_obj = args[1];
return_value = _locale_bindtextdomain_impl(module, domain, dirname_obj); return_value = _locale_bindtextdomain_impl(module, domain, dirname_obj);
@ -503,28 +463,18 @@ _locale_bind_textdomain_codeset(PyObject *module, PyObject *const *args, Py_ssiz
_PyArg_BadArgument("bind_textdomain_codeset", "argument 1", "str", args[0]); _PyArg_BadArgument("bind_textdomain_codeset", "argument 1", "str", args[0]);
goto exit; goto exit;
} }
Py_ssize_t domain_length; domain = PyUnicode_AsUTF8(args[0]);
domain = PyUnicode_AsUTF8AndSize(args[0], &domain_length);
if (domain == NULL) { if (domain == NULL) {
goto exit; goto exit;
} }
if (strlen(domain) != (size_t)domain_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
if (args[1] == Py_None) { if (args[1] == Py_None) {
codeset = NULL; codeset = NULL;
} }
else if (PyUnicode_Check(args[1])) { else if (PyUnicode_Check(args[1])) {
Py_ssize_t codeset_length; codeset = PyUnicode_AsUTF8(args[1]);
codeset = PyUnicode_AsUTF8AndSize(args[1], &codeset_length);
if (codeset == NULL) { if (codeset == NULL) {
goto exit; goto exit;
} }
if (strlen(codeset) != (size_t)codeset_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
} }
else { else {
_PyArg_BadArgument("bind_textdomain_codeset", "argument 2", "str or None", args[1]); _PyArg_BadArgument("bind_textdomain_codeset", "argument 2", "str or None", args[1]);
@ -595,4 +545,4 @@ _locale_getencoding(PyObject *module, PyObject *Py_UNUSED(ignored))
#ifndef _LOCALE_BIND_TEXTDOMAIN_CODESET_METHODDEF #ifndef _LOCALE_BIND_TEXTDOMAIN_CODESET_METHODDEF
#define _LOCALE_BIND_TEXTDOMAIN_CODESET_METHODDEF #define _LOCALE_BIND_TEXTDOMAIN_CODESET_METHODDEF
#endif /* !defined(_LOCALE_BIND_TEXTDOMAIN_CODESET_METHODDEF) */ #endif /* !defined(_LOCALE_BIND_TEXTDOMAIN_CODESET_METHODDEF) */
/*[clinic end generated code: output=034a3c219466d207 input=a9049054013a1b77]*/ /*[clinic end generated code: output=14a4bffed066ebb3 input=a9049054013a1b77]*/

View File

@ -466,15 +466,10 @@ _pickle_Unpickler___init__(PyObject *self, PyObject *args, PyObject *kwargs)
_PyArg_BadArgument("Unpickler", "argument 'encoding'", "str", fastargs[2]); _PyArg_BadArgument("Unpickler", "argument 'encoding'", "str", fastargs[2]);
goto exit; goto exit;
} }
Py_ssize_t encoding_length; encoding = PyUnicode_AsUTF8(fastargs[2]);
encoding = PyUnicode_AsUTF8AndSize(fastargs[2], &encoding_length);
if (encoding == NULL) { if (encoding == NULL) {
goto exit; goto exit;
} }
if (strlen(encoding) != (size_t)encoding_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
if (!--noptargs) { if (!--noptargs) {
goto skip_optional_kwonly; goto skip_optional_kwonly;
} }
@ -484,15 +479,10 @@ _pickle_Unpickler___init__(PyObject *self, PyObject *args, PyObject *kwargs)
_PyArg_BadArgument("Unpickler", "argument 'errors'", "str", fastargs[3]); _PyArg_BadArgument("Unpickler", "argument 'errors'", "str", fastargs[3]);
goto exit; goto exit;
} }
Py_ssize_t errors_length; errors = PyUnicode_AsUTF8(fastargs[3]);
errors = PyUnicode_AsUTF8AndSize(fastargs[3], &errors_length);
if (errors == NULL) { if (errors == NULL) {
goto exit; goto exit;
} }
if (strlen(errors) != (size_t)errors_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
if (!--noptargs) { if (!--noptargs) {
goto skip_optional_kwonly; goto skip_optional_kwonly;
} }
@ -870,15 +860,10 @@ _pickle_load(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
_PyArg_BadArgument("load", "argument 'encoding'", "str", args[2]); _PyArg_BadArgument("load", "argument 'encoding'", "str", args[2]);
goto exit; goto exit;
} }
Py_ssize_t encoding_length; encoding = PyUnicode_AsUTF8(args[2]);
encoding = PyUnicode_AsUTF8AndSize(args[2], &encoding_length);
if (encoding == NULL) { if (encoding == NULL) {
goto exit; goto exit;
} }
if (strlen(encoding) != (size_t)encoding_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
if (!--noptargs) { if (!--noptargs) {
goto skip_optional_kwonly; goto skip_optional_kwonly;
} }
@ -888,15 +873,10 @@ _pickle_load(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
_PyArg_BadArgument("load", "argument 'errors'", "str", args[3]); _PyArg_BadArgument("load", "argument 'errors'", "str", args[3]);
goto exit; goto exit;
} }
Py_ssize_t errors_length; errors = PyUnicode_AsUTF8(args[3]);
errors = PyUnicode_AsUTF8AndSize(args[3], &errors_length);
if (errors == NULL) { if (errors == NULL) {
goto exit; goto exit;
} }
if (strlen(errors) != (size_t)errors_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
if (!--noptargs) { if (!--noptargs) {
goto skip_optional_kwonly; goto skip_optional_kwonly;
} }
@ -996,15 +976,10 @@ _pickle_loads(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObjec
_PyArg_BadArgument("loads", "argument 'encoding'", "str", args[2]); _PyArg_BadArgument("loads", "argument 'encoding'", "str", args[2]);
goto exit; goto exit;
} }
Py_ssize_t encoding_length; encoding = PyUnicode_AsUTF8(args[2]);
encoding = PyUnicode_AsUTF8AndSize(args[2], &encoding_length);
if (encoding == NULL) { if (encoding == NULL) {
goto exit; goto exit;
} }
if (strlen(encoding) != (size_t)encoding_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
if (!--noptargs) { if (!--noptargs) {
goto skip_optional_kwonly; goto skip_optional_kwonly;
} }
@ -1014,15 +989,10 @@ _pickle_loads(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObjec
_PyArg_BadArgument("loads", "argument 'errors'", "str", args[3]); _PyArg_BadArgument("loads", "argument 'errors'", "str", args[3]);
goto exit; goto exit;
} }
Py_ssize_t errors_length; errors = PyUnicode_AsUTF8(args[3]);
errors = PyUnicode_AsUTF8AndSize(args[3], &errors_length);
if (errors == NULL) { if (errors == NULL) {
goto exit; goto exit;
} }
if (strlen(errors) != (size_t)errors_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
if (!--noptargs) { if (!--noptargs) {
goto skip_optional_kwonly; goto skip_optional_kwonly;
} }
@ -1034,4 +1004,4 @@ skip_optional_kwonly:
exit: exit:
return return_value; return return_value;
} }
/*[clinic end generated code: output=7f0564b5fb5410a8 input=a9049054013a1b77]*/ /*[clinic end generated code: output=1c675a6680a6b90c input=a9049054013a1b77]*/

View File

@ -391,15 +391,10 @@ _ssl__SSLSocket_get_channel_binding(PySSLSocket *self, PyObject *const *args, Py
_PyArg_BadArgument("get_channel_binding", "argument 'cb_type'", "str", args[0]); _PyArg_BadArgument("get_channel_binding", "argument 'cb_type'", "str", args[0]);
goto exit; goto exit;
} }
Py_ssize_t cb_type_length; cb_type = PyUnicode_AsUTF8(args[0]);
cb_type = PyUnicode_AsUTF8AndSize(args[0], &cb_type_length);
if (cb_type == NULL) { if (cb_type == NULL) {
goto exit; goto exit;
} }
if (strlen(cb_type) != (size_t)cb_type_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
skip_optional_pos: skip_optional_pos:
return_value = _ssl__SSLSocket_get_channel_binding_impl(self, cb_type); return_value = _ssl__SSLSocket_get_channel_binding_impl(self, cb_type);
@ -473,15 +468,10 @@ _ssl__SSLContext_set_ciphers(PySSLContext *self, PyObject *arg)
_PyArg_BadArgument("set_ciphers", "argument", "str", arg); _PyArg_BadArgument("set_ciphers", "argument", "str", arg);
goto exit; goto exit;
} }
Py_ssize_t cipherlist_length; cipherlist = PyUnicode_AsUTF8(arg);
cipherlist = PyUnicode_AsUTF8AndSize(arg, &cipherlist_length);
if (cipherlist == NULL) { if (cipherlist == NULL) {
goto exit; goto exit;
} }
if (strlen(cipherlist) != (size_t)cipherlist_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
return_value = _ssl__SSLContext_set_ciphers_impl(self, cipherlist); return_value = _ssl__SSLContext_set_ciphers_impl(self, cipherlist);
exit: exit:
@ -1316,15 +1306,10 @@ _ssl_txt2obj(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
_PyArg_BadArgument("txt2obj", "argument 'txt'", "str", args[0]); _PyArg_BadArgument("txt2obj", "argument 'txt'", "str", args[0]);
goto exit; goto exit;
} }
Py_ssize_t txt_length; txt = PyUnicode_AsUTF8(args[0]);
txt = PyUnicode_AsUTF8AndSize(args[0], &txt_length);
if (txt == NULL) { if (txt == NULL) {
goto exit; goto exit;
} }
if (strlen(txt) != (size_t)txt_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
if (!noptargs) { if (!noptargs) {
goto skip_optional_pos; goto skip_optional_pos;
} }
@ -1427,15 +1412,10 @@ _ssl_enum_certificates(PyObject *module, PyObject *const *args, Py_ssize_t nargs
_PyArg_BadArgument("enum_certificates", "argument 'store_name'", "str", args[0]); _PyArg_BadArgument("enum_certificates", "argument 'store_name'", "str", args[0]);
goto exit; goto exit;
} }
Py_ssize_t store_name_length; store_name = PyUnicode_AsUTF8(args[0]);
store_name = PyUnicode_AsUTF8AndSize(args[0], &store_name_length);
if (store_name == NULL) { if (store_name == NULL) {
goto exit; goto exit;
} }
if (strlen(store_name) != (size_t)store_name_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
return_value = _ssl_enum_certificates_impl(module, store_name); return_value = _ssl_enum_certificates_impl(module, store_name);
exit: exit:
@ -1503,15 +1483,10 @@ _ssl_enum_crls(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObje
_PyArg_BadArgument("enum_crls", "argument 'store_name'", "str", args[0]); _PyArg_BadArgument("enum_crls", "argument 'store_name'", "str", args[0]);
goto exit; goto exit;
} }
Py_ssize_t store_name_length; store_name = PyUnicode_AsUTF8(args[0]);
store_name = PyUnicode_AsUTF8AndSize(args[0], &store_name_length);
if (store_name == NULL) { if (store_name == NULL) {
goto exit; goto exit;
} }
if (strlen(store_name) != (size_t)store_name_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
return_value = _ssl_enum_crls_impl(module, store_name); return_value = _ssl_enum_crls_impl(module, store_name);
exit: exit:
@ -1527,4 +1502,4 @@ exit:
#ifndef _SSL_ENUM_CRLS_METHODDEF #ifndef _SSL_ENUM_CRLS_METHODDEF
#define _SSL_ENUM_CRLS_METHODDEF #define _SSL_ENUM_CRLS_METHODDEF
#endif /* !defined(_SSL_ENUM_CRLS_METHODDEF) */ #endif /* !defined(_SSL_ENUM_CRLS_METHODDEF) */
/*[clinic end generated code: output=aa6b0a898b6077fe input=a9049054013a1b77]*/ /*[clinic end generated code: output=8350af68e0a56792 input=a9049054013a1b77]*/

View File

@ -2935,15 +2935,10 @@ clone_f1(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kw
_PyArg_BadArgument("clone_f1", "argument 'path'", "str", args[0]); _PyArg_BadArgument("clone_f1", "argument 'path'", "str", args[0]);
goto exit; goto exit;
} }
Py_ssize_t path_length; path = PyUnicode_AsUTF8(args[0]);
path = PyUnicode_AsUTF8AndSize(args[0], &path_length);
if (path == NULL) { if (path == NULL) {
goto exit; goto exit;
} }
if (strlen(path) != (size_t)path_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
return_value = clone_f1_impl(module, path); return_value = clone_f1_impl(module, path);
exit: exit:
@ -3001,15 +2996,10 @@ clone_f2(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kw
_PyArg_BadArgument("clone_f2", "argument 'path'", "str", args[0]); _PyArg_BadArgument("clone_f2", "argument 'path'", "str", args[0]);
goto exit; goto exit;
} }
Py_ssize_t path_length; path = PyUnicode_AsUTF8(args[0]);
path = PyUnicode_AsUTF8AndSize(args[0], &path_length);
if (path == NULL) { if (path == NULL) {
goto exit; goto exit;
} }
if (strlen(path) != (size_t)path_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
return_value = clone_f2_impl(module, path); return_value = clone_f2_impl(module, path);
exit: exit:
@ -3141,4 +3131,4 @@ skip_optional_pos:
exit: exit:
return return_value; return return_value;
} }
/*[clinic end generated code: output=90743ac900d60f9f input=a9049054013a1b77]*/ /*[clinic end generated code: output=32dc6ac90757da7a input=a9049054013a1b77]*/

View File

@ -25,15 +25,10 @@ _tkinter_tkapp_eval(TkappObject *self, PyObject *arg)
_PyArg_BadArgument("eval", "argument", "str", arg); _PyArg_BadArgument("eval", "argument", "str", arg);
goto exit; goto exit;
} }
Py_ssize_t script_length; script = PyUnicode_AsUTF8(arg);
script = PyUnicode_AsUTF8AndSize(arg, &script_length);
if (script == NULL) { if (script == NULL) {
goto exit; goto exit;
} }
if (strlen(script) != (size_t)script_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
return_value = _tkinter_tkapp_eval_impl(self, script); return_value = _tkinter_tkapp_eval_impl(self, script);
exit: exit:
@ -61,15 +56,10 @@ _tkinter_tkapp_evalfile(TkappObject *self, PyObject *arg)
_PyArg_BadArgument("evalfile", "argument", "str", arg); _PyArg_BadArgument("evalfile", "argument", "str", arg);
goto exit; goto exit;
} }
Py_ssize_t fileName_length; fileName = PyUnicode_AsUTF8(arg);
fileName = PyUnicode_AsUTF8AndSize(arg, &fileName_length);
if (fileName == NULL) { if (fileName == NULL) {
goto exit; goto exit;
} }
if (strlen(fileName) != (size_t)fileName_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
return_value = _tkinter_tkapp_evalfile_impl(self, fileName); return_value = _tkinter_tkapp_evalfile_impl(self, fileName);
exit: exit:
@ -97,15 +87,10 @@ _tkinter_tkapp_record(TkappObject *self, PyObject *arg)
_PyArg_BadArgument("record", "argument", "str", arg); _PyArg_BadArgument("record", "argument", "str", arg);
goto exit; goto exit;
} }
Py_ssize_t script_length; script = PyUnicode_AsUTF8(arg);
script = PyUnicode_AsUTF8AndSize(arg, &script_length);
if (script == NULL) { if (script == NULL) {
goto exit; goto exit;
} }
if (strlen(script) != (size_t)script_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
return_value = _tkinter_tkapp_record_impl(self, script); return_value = _tkinter_tkapp_record_impl(self, script);
exit: exit:
@ -133,15 +118,10 @@ _tkinter_tkapp_adderrorinfo(TkappObject *self, PyObject *arg)
_PyArg_BadArgument("adderrorinfo", "argument", "str", arg); _PyArg_BadArgument("adderrorinfo", "argument", "str", arg);
goto exit; goto exit;
} }
Py_ssize_t msg_length; msg = PyUnicode_AsUTF8(arg);
msg = PyUnicode_AsUTF8AndSize(arg, &msg_length);
if (msg == NULL) { if (msg == NULL) {
goto exit; goto exit;
} }
if (strlen(msg) != (size_t)msg_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
return_value = _tkinter_tkapp_adderrorinfo_impl(self, msg); return_value = _tkinter_tkapp_adderrorinfo_impl(self, msg);
exit: exit:
@ -193,15 +173,10 @@ _tkinter_tkapp_exprstring(TkappObject *self, PyObject *arg)
_PyArg_BadArgument("exprstring", "argument", "str", arg); _PyArg_BadArgument("exprstring", "argument", "str", arg);
goto exit; goto exit;
} }
Py_ssize_t s_length; s = PyUnicode_AsUTF8(arg);
s = PyUnicode_AsUTF8AndSize(arg, &s_length);
if (s == NULL) { if (s == NULL) {
goto exit; goto exit;
} }
if (strlen(s) != (size_t)s_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
return_value = _tkinter_tkapp_exprstring_impl(self, s); return_value = _tkinter_tkapp_exprstring_impl(self, s);
exit: exit:
@ -229,15 +204,10 @@ _tkinter_tkapp_exprlong(TkappObject *self, PyObject *arg)
_PyArg_BadArgument("exprlong", "argument", "str", arg); _PyArg_BadArgument("exprlong", "argument", "str", arg);
goto exit; goto exit;
} }
Py_ssize_t s_length; s = PyUnicode_AsUTF8(arg);
s = PyUnicode_AsUTF8AndSize(arg, &s_length);
if (s == NULL) { if (s == NULL) {
goto exit; goto exit;
} }
if (strlen(s) != (size_t)s_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
return_value = _tkinter_tkapp_exprlong_impl(self, s); return_value = _tkinter_tkapp_exprlong_impl(self, s);
exit: exit:
@ -265,15 +235,10 @@ _tkinter_tkapp_exprdouble(TkappObject *self, PyObject *arg)
_PyArg_BadArgument("exprdouble", "argument", "str", arg); _PyArg_BadArgument("exprdouble", "argument", "str", arg);
goto exit; goto exit;
} }
Py_ssize_t s_length; s = PyUnicode_AsUTF8(arg);
s = PyUnicode_AsUTF8AndSize(arg, &s_length);
if (s == NULL) { if (s == NULL) {
goto exit; goto exit;
} }
if (strlen(s) != (size_t)s_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
return_value = _tkinter_tkapp_exprdouble_impl(self, s); return_value = _tkinter_tkapp_exprdouble_impl(self, s);
exit: exit:
@ -301,15 +266,10 @@ _tkinter_tkapp_exprboolean(TkappObject *self, PyObject *arg)
_PyArg_BadArgument("exprboolean", "argument", "str", arg); _PyArg_BadArgument("exprboolean", "argument", "str", arg);
goto exit; goto exit;
} }
Py_ssize_t s_length; s = PyUnicode_AsUTF8(arg);
s = PyUnicode_AsUTF8AndSize(arg, &s_length);
if (s == NULL) { if (s == NULL) {
goto exit; goto exit;
} }
if (strlen(s) != (size_t)s_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
return_value = _tkinter_tkapp_exprboolean_impl(self, s); return_value = _tkinter_tkapp_exprboolean_impl(self, s);
exit: exit:
@ -350,15 +310,10 @@ _tkinter_tkapp_createcommand(TkappObject *self, PyObject *const *args, Py_ssize_
_PyArg_BadArgument("createcommand", "argument 1", "str", args[0]); _PyArg_BadArgument("createcommand", "argument 1", "str", args[0]);
goto exit; goto exit;
} }
Py_ssize_t name_length; name = PyUnicode_AsUTF8(args[0]);
name = PyUnicode_AsUTF8AndSize(args[0], &name_length);
if (name == NULL) { if (name == NULL) {
goto exit; goto exit;
} }
if (strlen(name) != (size_t)name_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
func = args[1]; func = args[1];
return_value = _tkinter_tkapp_createcommand_impl(self, name, func); return_value = _tkinter_tkapp_createcommand_impl(self, name, func);
@ -387,15 +342,10 @@ _tkinter_tkapp_deletecommand(TkappObject *self, PyObject *arg)
_PyArg_BadArgument("deletecommand", "argument", "str", arg); _PyArg_BadArgument("deletecommand", "argument", "str", arg);
goto exit; goto exit;
} }
Py_ssize_t name_length; name = PyUnicode_AsUTF8(arg);
name = PyUnicode_AsUTF8AndSize(arg, &name_length);
if (name == NULL) { if (name == NULL) {
goto exit; goto exit;
} }
if (strlen(name) != (size_t)name_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
return_value = _tkinter_tkapp_deletecommand_impl(self, name); return_value = _tkinter_tkapp_deletecommand_impl(self, name);
exit: exit:
@ -694,15 +644,10 @@ _tkinter_create(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
screenName = NULL; screenName = NULL;
} }
else if (PyUnicode_Check(args[0])) { else if (PyUnicode_Check(args[0])) {
Py_ssize_t screenName_length; screenName = PyUnicode_AsUTF8(args[0]);
screenName = PyUnicode_AsUTF8AndSize(args[0], &screenName_length);
if (screenName == NULL) { if (screenName == NULL) {
goto exit; goto exit;
} }
if (strlen(screenName) != (size_t)screenName_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
} }
else { else {
_PyArg_BadArgument("create", "argument 1", "str or None", args[0]); _PyArg_BadArgument("create", "argument 1", "str or None", args[0]);
@ -715,15 +660,10 @@ _tkinter_create(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
_PyArg_BadArgument("create", "argument 2", "str", args[1]); _PyArg_BadArgument("create", "argument 2", "str", args[1]);
goto exit; goto exit;
} }
Py_ssize_t baseName_length; baseName = PyUnicode_AsUTF8(args[1]);
baseName = PyUnicode_AsUTF8AndSize(args[1], &baseName_length);
if (baseName == NULL) { if (baseName == NULL) {
goto exit; goto exit;
} }
if (strlen(baseName) != (size_t)baseName_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
if (nargs < 3) { if (nargs < 3) {
goto skip_optional; goto skip_optional;
} }
@ -731,15 +671,10 @@ _tkinter_create(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
_PyArg_BadArgument("create", "argument 3", "str", args[2]); _PyArg_BadArgument("create", "argument 3", "str", args[2]);
goto exit; goto exit;
} }
Py_ssize_t className_length; className = PyUnicode_AsUTF8(args[2]);
className = PyUnicode_AsUTF8AndSize(args[2], &className_length);
if (className == NULL) { if (className == NULL) {
goto exit; goto exit;
} }
if (strlen(className) != (size_t)className_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
if (nargs < 4) { if (nargs < 4) {
goto skip_optional; goto skip_optional;
} }
@ -775,15 +710,10 @@ _tkinter_create(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
use = NULL; use = NULL;
} }
else if (PyUnicode_Check(args[7])) { else if (PyUnicode_Check(args[7])) {
Py_ssize_t use_length; use = PyUnicode_AsUTF8(args[7]);
use = PyUnicode_AsUTF8AndSize(args[7], &use_length);
if (use == NULL) { if (use == NULL) {
goto exit; goto exit;
} }
if (strlen(use) != (size_t)use_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
} }
else { else {
_PyArg_BadArgument("create", "argument 8", "str or None", args[7]); _PyArg_BadArgument("create", "argument 8", "str or None", args[7]);
@ -861,4 +791,4 @@ exit:
#ifndef _TKINTER_TKAPP_DELETEFILEHANDLER_METHODDEF #ifndef _TKINTER_TKAPP_DELETEFILEHANDLER_METHODDEF
#define _TKINTER_TKAPP_DELETEFILEHANDLER_METHODDEF #define _TKINTER_TKAPP_DELETEFILEHANDLER_METHODDEF
#endif /* !defined(_TKINTER_TKAPP_DELETEFILEHANDLER_METHODDEF) */ #endif /* !defined(_TKINTER_TKAPP_DELETEFILEHANDLER_METHODDEF) */
/*[clinic end generated code: output=d447501ec5aa9447 input=a9049054013a1b77]*/ /*[clinic end generated code: output=0c8b5f960d7738fd input=a9049054013a1b77]*/

View File

@ -4672,15 +4672,10 @@ os_getgrouplist(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
_PyArg_BadArgument("getgrouplist", "argument 1", "str", args[0]); _PyArg_BadArgument("getgrouplist", "argument 1", "str", args[0]);
goto exit; goto exit;
} }
Py_ssize_t user_length; user = PyUnicode_AsUTF8(args[0]);
user = PyUnicode_AsUTF8AndSize(args[0], &user_length);
if (user == NULL) { if (user == NULL) {
goto exit; goto exit;
} }
if (strlen(user) != (size_t)user_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
basegid = PyLong_AsInt(args[1]); basegid = PyLong_AsInt(args[1]);
if (basegid == -1 && PyErr_Occurred()) { if (basegid == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -4726,15 +4721,10 @@ os_getgrouplist(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
_PyArg_BadArgument("getgrouplist", "argument 1", "str", args[0]); _PyArg_BadArgument("getgrouplist", "argument 1", "str", args[0]);
goto exit; goto exit;
} }
Py_ssize_t user_length; user = PyUnicode_AsUTF8(args[0]);
user = PyUnicode_AsUTF8AndSize(args[0], &user_length);
if (user == NULL) { if (user == NULL) {
goto exit; goto exit;
} }
if (strlen(user) != (size_t)user_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
if (!_Py_Gid_Converter(args[1], &basegid)) { if (!_Py_Gid_Converter(args[1], &basegid)) {
goto exit; goto exit;
} }
@ -12403,4 +12393,4 @@ exit:
#ifndef OS_WAITSTATUS_TO_EXITCODE_METHODDEF #ifndef OS_WAITSTATUS_TO_EXITCODE_METHODDEF
#define OS_WAITSTATUS_TO_EXITCODE_METHODDEF #define OS_WAITSTATUS_TO_EXITCODE_METHODDEF
#endif /* !defined(OS_WAITSTATUS_TO_EXITCODE_METHODDEF) */ #endif /* !defined(OS_WAITSTATUS_TO_EXITCODE_METHODDEF) */
/*[clinic end generated code: output=a05abdc48e3def44 input=a9049054013a1b77]*/ /*[clinic end generated code: output=a377982a6d1e77b9 input=a9049054013a1b77]*/

View File

@ -129,15 +129,10 @@ pyexpat_xmlparser_SetBase(xmlparseobject *self, PyObject *arg)
_PyArg_BadArgument("SetBase", "argument", "str", arg); _PyArg_BadArgument("SetBase", "argument", "str", arg);
goto exit; goto exit;
} }
Py_ssize_t base_length; base = PyUnicode_AsUTF8(arg);
base = PyUnicode_AsUTF8AndSize(arg, &base_length);
if (base == NULL) { if (base == NULL) {
goto exit; goto exit;
} }
if (strlen(base) != (size_t)base_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
return_value = pyexpat_xmlparser_SetBase_impl(self, base); return_value = pyexpat_xmlparser_SetBase_impl(self, base);
exit: exit:
@ -228,15 +223,10 @@ pyexpat_xmlparser_ExternalEntityParserCreate(xmlparseobject *self, PyTypeObject
context = NULL; context = NULL;
} }
else if (PyUnicode_Check(args[0])) { else if (PyUnicode_Check(args[0])) {
Py_ssize_t context_length; context = PyUnicode_AsUTF8(args[0]);
context = PyUnicode_AsUTF8AndSize(args[0], &context_length);
if (context == NULL) { if (context == NULL) {
goto exit; goto exit;
} }
if (strlen(context) != (size_t)context_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
} }
else { else {
_PyArg_BadArgument("ExternalEntityParserCreate", "argument 1", "str or None", args[0]); _PyArg_BadArgument("ExternalEntityParserCreate", "argument 1", "str or None", args[0]);
@ -249,15 +239,10 @@ pyexpat_xmlparser_ExternalEntityParserCreate(xmlparseobject *self, PyTypeObject
_PyArg_BadArgument("ExternalEntityParserCreate", "argument 2", "str", args[1]); _PyArg_BadArgument("ExternalEntityParserCreate", "argument 2", "str", args[1]);
goto exit; goto exit;
} }
Py_ssize_t encoding_length; encoding = PyUnicode_AsUTF8(args[1]);
encoding = PyUnicode_AsUTF8AndSize(args[1], &encoding_length);
if (encoding == NULL) { if (encoding == NULL) {
goto exit; goto exit;
} }
if (strlen(encoding) != (size_t)encoding_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
skip_optional_posonly: skip_optional_posonly:
return_value = pyexpat_xmlparser_ExternalEntityParserCreate_impl(self, cls, context, encoding); return_value = pyexpat_xmlparser_ExternalEntityParserCreate_impl(self, cls, context, encoding);
@ -418,15 +403,10 @@ pyexpat_ParserCreate(PyObject *module, PyObject *const *args, Py_ssize_t nargs,
encoding = NULL; encoding = NULL;
} }
else if (PyUnicode_Check(args[0])) { else if (PyUnicode_Check(args[0])) {
Py_ssize_t encoding_length; encoding = PyUnicode_AsUTF8(args[0]);
encoding = PyUnicode_AsUTF8AndSize(args[0], &encoding_length);
if (encoding == NULL) { if (encoding == NULL) {
goto exit; goto exit;
} }
if (strlen(encoding) != (size_t)encoding_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
} }
else { else {
_PyArg_BadArgument("ParserCreate", "argument 'encoding'", "str or None", args[0]); _PyArg_BadArgument("ParserCreate", "argument 'encoding'", "str or None", args[0]);
@ -441,15 +421,10 @@ pyexpat_ParserCreate(PyObject *module, PyObject *const *args, Py_ssize_t nargs,
namespace_separator = NULL; namespace_separator = NULL;
} }
else if (PyUnicode_Check(args[1])) { else if (PyUnicode_Check(args[1])) {
Py_ssize_t namespace_separator_length; namespace_separator = PyUnicode_AsUTF8(args[1]);
namespace_separator = PyUnicode_AsUTF8AndSize(args[1], &namespace_separator_length);
if (namespace_separator == NULL) { if (namespace_separator == NULL) {
goto exit; goto exit;
} }
if (strlen(namespace_separator) != (size_t)namespace_separator_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
} }
else { else {
_PyArg_BadArgument("ParserCreate", "argument 'namespace_separator'", "str or None", args[1]); _PyArg_BadArgument("ParserCreate", "argument 'namespace_separator'", "str or None", args[1]);
@ -498,4 +473,4 @@ exit:
#ifndef PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF #ifndef PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF
#define PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF #define PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF
#endif /* !defined(PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF) */ #endif /* !defined(PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF) */
/*[clinic end generated code: output=48c4296e43777df4 input=a9049054013a1b77]*/ /*[clinic end generated code: output=bfc1f3d3e2cbc8dc input=a9049054013a1b77]*/

View File

@ -36,18 +36,13 @@ _symtable_symtable(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
_PyArg_BadArgument("symtable", "argument 3", "str", args[2]); _PyArg_BadArgument("symtable", "argument 3", "str", args[2]);
goto exit; goto exit;
} }
Py_ssize_t startstr_length; startstr = PyUnicode_AsUTF8(args[2]);
startstr = PyUnicode_AsUTF8AndSize(args[2], &startstr_length);
if (startstr == NULL) { if (startstr == NULL) {
goto exit; goto exit;
} }
if (strlen(startstr) != (size_t)startstr_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
return_value = _symtable_symtable_impl(module, source, filename, startstr); return_value = _symtable_symtable_impl(module, source, filename, startstr);
exit: exit:
return return_value; return return_value;
} }
/*[clinic end generated code: output=931964a76a72f850 input=a9049054013a1b77]*/ /*[clinic end generated code: output=9af1ab5a114a1ec7 input=a9049054013a1b77]*/

View File

@ -68,15 +68,10 @@ bytearray___init__(PyObject *self, PyObject *args, PyObject *kwargs)
_PyArg_BadArgument("bytearray", "argument 'encoding'", "str", fastargs[1]); _PyArg_BadArgument("bytearray", "argument 'encoding'", "str", fastargs[1]);
goto exit; goto exit;
} }
Py_ssize_t encoding_length; encoding = PyUnicode_AsUTF8(fastargs[1]);
encoding = PyUnicode_AsUTF8AndSize(fastargs[1], &encoding_length);
if (encoding == NULL) { if (encoding == NULL) {
goto exit; goto exit;
} }
if (strlen(encoding) != (size_t)encoding_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
if (!--noptargs) { if (!--noptargs) {
goto skip_optional_pos; goto skip_optional_pos;
} }
@ -85,15 +80,10 @@ bytearray___init__(PyObject *self, PyObject *args, PyObject *kwargs)
_PyArg_BadArgument("bytearray", "argument 'errors'", "str", fastargs[2]); _PyArg_BadArgument("bytearray", "argument 'errors'", "str", fastargs[2]);
goto exit; goto exit;
} }
Py_ssize_t errors_length; errors = PyUnicode_AsUTF8(fastargs[2]);
errors = PyUnicode_AsUTF8AndSize(fastargs[2], &errors_length);
if (errors == NULL) { if (errors == NULL) {
goto exit; goto exit;
} }
if (strlen(errors) != (size_t)errors_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
skip_optional_pos: skip_optional_pos:
return_value = bytearray___init___impl((PyByteArrayObject *)self, arg, encoding, errors); return_value = bytearray___init___impl((PyByteArrayObject *)self, arg, encoding, errors);
@ -960,15 +950,10 @@ bytearray_decode(PyByteArrayObject *self, PyObject *const *args, Py_ssize_t narg
_PyArg_BadArgument("decode", "argument 'encoding'", "str", args[0]); _PyArg_BadArgument("decode", "argument 'encoding'", "str", args[0]);
goto exit; goto exit;
} }
Py_ssize_t encoding_length; encoding = PyUnicode_AsUTF8(args[0]);
encoding = PyUnicode_AsUTF8AndSize(args[0], &encoding_length);
if (encoding == NULL) { if (encoding == NULL) {
goto exit; goto exit;
} }
if (strlen(encoding) != (size_t)encoding_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
if (!--noptargs) { if (!--noptargs) {
goto skip_optional_pos; goto skip_optional_pos;
} }
@ -977,15 +962,10 @@ bytearray_decode(PyByteArrayObject *self, PyObject *const *args, Py_ssize_t narg
_PyArg_BadArgument("decode", "argument 'errors'", "str", args[1]); _PyArg_BadArgument("decode", "argument 'errors'", "str", args[1]);
goto exit; goto exit;
} }
Py_ssize_t errors_length; errors = PyUnicode_AsUTF8(args[1]);
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
if (errors == NULL) { if (errors == NULL) {
goto exit; goto exit;
} }
if (strlen(errors) != (size_t)errors_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
skip_optional_pos: skip_optional_pos:
return_value = bytearray_decode_impl(self, encoding, errors); return_value = bytearray_decode_impl(self, encoding, errors);
@ -1261,4 +1241,4 @@ bytearray_sizeof(PyByteArrayObject *self, PyObject *Py_UNUSED(ignored))
{ {
return bytearray_sizeof_impl(self); return bytearray_sizeof_impl(self);
} }
/*[clinic end generated code: output=0797a5e03cda2a16 input=a9049054013a1b77]*/ /*[clinic end generated code: output=5a7de6295a7ce6cc input=a9049054013a1b77]*/

View File

@ -720,15 +720,10 @@ bytes_decode(PyBytesObject *self, PyObject *const *args, Py_ssize_t nargs, PyObj
_PyArg_BadArgument("decode", "argument 'encoding'", "str", args[0]); _PyArg_BadArgument("decode", "argument 'encoding'", "str", args[0]);
goto exit; goto exit;
} }
Py_ssize_t encoding_length; encoding = PyUnicode_AsUTF8(args[0]);
encoding = PyUnicode_AsUTF8AndSize(args[0], &encoding_length);
if (encoding == NULL) { if (encoding == NULL) {
goto exit; goto exit;
} }
if (strlen(encoding) != (size_t)encoding_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
if (!--noptargs) { if (!--noptargs) {
goto skip_optional_pos; goto skip_optional_pos;
} }
@ -737,15 +732,10 @@ bytes_decode(PyBytesObject *self, PyObject *const *args, Py_ssize_t nargs, PyObj
_PyArg_BadArgument("decode", "argument 'errors'", "str", args[1]); _PyArg_BadArgument("decode", "argument 'errors'", "str", args[1]);
goto exit; goto exit;
} }
Py_ssize_t errors_length; errors = PyUnicode_AsUTF8(args[1]);
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
if (errors == NULL) { if (errors == NULL) {
goto exit; goto exit;
} }
if (strlen(errors) != (size_t)errors_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
skip_optional_pos: skip_optional_pos:
return_value = bytes_decode_impl(self, encoding, errors); return_value = bytes_decode_impl(self, encoding, errors);
@ -997,15 +987,10 @@ bytes_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
_PyArg_BadArgument("bytes", "argument 'encoding'", "str", fastargs[1]); _PyArg_BadArgument("bytes", "argument 'encoding'", "str", fastargs[1]);
goto exit; goto exit;
} }
Py_ssize_t encoding_length; encoding = PyUnicode_AsUTF8(fastargs[1]);
encoding = PyUnicode_AsUTF8AndSize(fastargs[1], &encoding_length);
if (encoding == NULL) { if (encoding == NULL) {
goto exit; goto exit;
} }
if (strlen(encoding) != (size_t)encoding_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
if (!--noptargs) { if (!--noptargs) {
goto skip_optional_pos; goto skip_optional_pos;
} }
@ -1014,19 +999,14 @@ bytes_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
_PyArg_BadArgument("bytes", "argument 'errors'", "str", fastargs[2]); _PyArg_BadArgument("bytes", "argument 'errors'", "str", fastargs[2]);
goto exit; goto exit;
} }
Py_ssize_t errors_length; errors = PyUnicode_AsUTF8(fastargs[2]);
errors = PyUnicode_AsUTF8AndSize(fastargs[2], &errors_length);
if (errors == NULL) { if (errors == NULL) {
goto exit; goto exit;
} }
if (strlen(errors) != (size_t)errors_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
skip_optional_pos: skip_optional_pos:
return_value = bytes_new_impl(type, x, encoding, errors); return_value = bytes_new_impl(type, x, encoding, errors);
exit: exit:
return return_value; return return_value;
} }
/*[clinic end generated code: output=8a49dbbd78914a6f input=a9049054013a1b77]*/ /*[clinic end generated code: output=97aab3f6ae398664 input=a9049054013a1b77]*/

View File

@ -275,15 +275,10 @@ float___getformat__(PyTypeObject *type, PyObject *arg)
_PyArg_BadArgument("__getformat__", "argument", "str", arg); _PyArg_BadArgument("__getformat__", "argument", "str", arg);
goto exit; goto exit;
} }
Py_ssize_t typestr_length; typestr = PyUnicode_AsUTF8(arg);
typestr = PyUnicode_AsUTF8AndSize(arg, &typestr_length);
if (typestr == NULL) { if (typestr == NULL) {
goto exit; goto exit;
} }
if (strlen(typestr) != (size_t)typestr_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
return_value = float___getformat___impl(type, typestr); return_value = float___getformat___impl(type, typestr);
exit: exit:
@ -318,4 +313,4 @@ float___format__(PyObject *self, PyObject *arg)
exit: exit:
return return_value; return return_value;
} }
/*[clinic end generated code: output=c79743c8551c30d9 input=a9049054013a1b77]*/ /*[clinic end generated code: output=01f6fbd082eefead input=a9049054013a1b77]*/

View File

@ -305,15 +305,10 @@ memoryview_tobytes(PyMemoryViewObject *self, PyObject *const *args, Py_ssize_t n
order = NULL; order = NULL;
} }
else if (PyUnicode_Check(args[0])) { else if (PyUnicode_Check(args[0])) {
Py_ssize_t order_length; order = PyUnicode_AsUTF8(args[0]);
order = PyUnicode_AsUTF8AndSize(args[0], &order_length);
if (order == NULL) { if (order == NULL) {
goto exit; goto exit;
} }
if (strlen(order) != (size_t)order_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
} }
else { else {
_PyArg_BadArgument("tobytes", "argument 'order'", "str or None", args[0]); _PyArg_BadArgument("tobytes", "argument 'order'", "str or None", args[0]);
@ -413,4 +408,4 @@ skip_optional_pos:
exit: exit:
return return_value; return return_value;
} }
/*[clinic end generated code: output=7e76a09106921ba2 input=a9049054013a1b77]*/ /*[clinic end generated code: output=abd8c0ce804d8992 input=a9049054013a1b77]*/

View File

@ -203,15 +203,10 @@ unicode_encode(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject
_PyArg_BadArgument("encode", "argument 'encoding'", "str", args[0]); _PyArg_BadArgument("encode", "argument 'encoding'", "str", args[0]);
goto exit; goto exit;
} }
Py_ssize_t encoding_length; encoding = PyUnicode_AsUTF8(args[0]);
encoding = PyUnicode_AsUTF8AndSize(args[0], &encoding_length);
if (encoding == NULL) { if (encoding == NULL) {
goto exit; goto exit;
} }
if (strlen(encoding) != (size_t)encoding_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
if (!--noptargs) { if (!--noptargs) {
goto skip_optional_pos; goto skip_optional_pos;
} }
@ -220,15 +215,10 @@ unicode_encode(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject
_PyArg_BadArgument("encode", "argument 'errors'", "str", args[1]); _PyArg_BadArgument("encode", "argument 'errors'", "str", args[1]);
goto exit; goto exit;
} }
Py_ssize_t errors_length; errors = PyUnicode_AsUTF8(args[1]);
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
if (errors == NULL) { if (errors == NULL) {
goto exit; goto exit;
} }
if (strlen(errors) != (size_t)errors_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
skip_optional_pos: skip_optional_pos:
return_value = unicode_encode_impl(self, encoding, errors); return_value = unicode_encode_impl(self, encoding, errors);
@ -1473,15 +1463,10 @@ unicode_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
_PyArg_BadArgument("str", "argument 'encoding'", "str", fastargs[1]); _PyArg_BadArgument("str", "argument 'encoding'", "str", fastargs[1]);
goto exit; goto exit;
} }
Py_ssize_t encoding_length; encoding = PyUnicode_AsUTF8(fastargs[1]);
encoding = PyUnicode_AsUTF8AndSize(fastargs[1], &encoding_length);
if (encoding == NULL) { if (encoding == NULL) {
goto exit; goto exit;
} }
if (strlen(encoding) != (size_t)encoding_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
if (!--noptargs) { if (!--noptargs) {
goto skip_optional_pos; goto skip_optional_pos;
} }
@ -1490,19 +1475,14 @@ unicode_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
_PyArg_BadArgument("str", "argument 'errors'", "str", fastargs[2]); _PyArg_BadArgument("str", "argument 'errors'", "str", fastargs[2]);
goto exit; goto exit;
} }
Py_ssize_t errors_length; errors = PyUnicode_AsUTF8(fastargs[2]);
errors = PyUnicode_AsUTF8AndSize(fastargs[2], &errors_length);
if (errors == NULL) { if (errors == NULL) {
goto exit; goto exit;
} }
if (strlen(errors) != (size_t)errors_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
skip_optional_pos: skip_optional_pos:
return_value = unicode_new_impl(type, x, encoding, errors); return_value = unicode_new_impl(type, x, encoding, errors);
exit: exit:
return return_value; return return_value;
} }
/*[clinic end generated code: output=873d8b3d09af3095 input=a9049054013a1b77]*/ /*[clinic end generated code: output=20313d6339272ddc input=a9049054013a1b77]*/

View File

@ -65,19 +65,14 @@ tokenizeriter_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
_PyArg_BadArgument("tokenizeriter", "argument 'encoding'", "str", fastargs[2]); _PyArg_BadArgument("tokenizeriter", "argument 'encoding'", "str", fastargs[2]);
goto exit; goto exit;
} }
Py_ssize_t encoding_length; encoding = PyUnicode_AsUTF8(fastargs[2]);
encoding = PyUnicode_AsUTF8AndSize(fastargs[2], &encoding_length);
if (encoding == NULL) { if (encoding == NULL) {
goto exit; goto exit;
} }
if (strlen(encoding) != (size_t)encoding_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
skip_optional_kwonly: skip_optional_kwonly:
return_value = tokenizeriter_new_impl(type, readline, extra_tokens, encoding); return_value = tokenizeriter_new_impl(type, readline, extra_tokens, encoding);
exit: exit:
return return_value; return return_value;
} }
/*[clinic end generated code: output=dcd6ec48f06a092e input=a9049054013a1b77]*/ /*[clinic end generated code: output=92cb8176149f0924 input=a9049054013a1b77]*/

View File

@ -329,15 +329,10 @@ builtin_compile(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
_PyArg_BadArgument("compile", "argument 'mode'", "str", args[2]); _PyArg_BadArgument("compile", "argument 'mode'", "str", args[2]);
goto exit; goto exit;
} }
Py_ssize_t mode_length; mode = PyUnicode_AsUTF8(args[2]);
mode = PyUnicode_AsUTF8AndSize(args[2], &mode_length);
if (mode == NULL) { if (mode == NULL) {
goto exit; goto exit;
} }
if (strlen(mode) != (size_t)mode_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
if (!noptargs) { if (!noptargs) {
goto skip_optional_pos; goto skip_optional_pos;
} }
@ -1212,4 +1207,4 @@ builtin_issubclass(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
exit: exit:
return return_value; return return_value;
} }
/*[clinic end generated code: output=31bded5d08647a57 input=a9049054013a1b77]*/ /*[clinic end generated code: output=95d3813b1798f018 input=a9049054013a1b77]*/

View File

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

View File

@ -4350,34 +4350,23 @@ class str_converter(CConverter):
{bad_argument} {bad_argument}
goto exit; goto exit;
}}}} }}}}
Py_ssize_t {length_name}; {paramname} = PyUnicode_AsUTF8({argname});
{paramname} = PyUnicode_AsUTF8AndSize({argname}, &{length_name});
if ({paramname} == NULL) {{{{ if ({paramname} == NULL) {{{{
goto exit; goto exit;
}}}} }}}}
if (strlen({paramname}) != (size_t){length_name}) {{{{
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}}}}
""", """,
argname=argname, argname=argname,
bad_argument=self.bad_argument(displayname, 'str', limited_capi=limited_capi), bad_argument=self.bad_argument(displayname, 'str', limited_capi=limited_capi))
length_name=self.length_name)
if self.format_unit == 'z': if self.format_unit == 'z':
return self.format_code(""" return self.format_code("""
if ({argname} == Py_None) {{{{ if ({argname} == Py_None) {{{{
{paramname} = NULL; {paramname} = NULL;
}}}} }}}}
else if (PyUnicode_Check({argname})) {{{{ else if (PyUnicode_Check({argname})) {{{{
Py_ssize_t {length_name}; {paramname} = PyUnicode_AsUTF8({argname});
{paramname} = PyUnicode_AsUTF8AndSize({argname}, &{length_name});
if ({paramname} == NULL) {{{{ if ({paramname} == NULL) {{{{
goto exit; goto exit;
}}}} }}}}
if (strlen({paramname}) != (size_t){length_name}) {{{{
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}}}}
}}}} }}}}
else {{{{ else {{{{
{bad_argument} {bad_argument}
@ -4385,8 +4374,7 @@ class str_converter(CConverter):
}}}} }}}}
""", """,
argname=argname, argname=argname,
bad_argument=self.bad_argument(displayname, 'str or None', limited_capi=limited_capi), bad_argument=self.bad_argument(displayname, 'str or None', limited_capi=limited_capi))
length_name=self.length_name)
return super().parse_arg(argname, displayname, limited_capi=limited_capi) return super().parse_arg(argname, displayname, limited_capi=limited_capi)
# #