mirror of
https://github.com/python/cpython.git
synced 2026-10-28 10:25:05 +08:00
gh-157407: Use _PyUnicode_AsUTF8NoNUL for AC 's' and 'z' converters (#158210)
* gh-157407: Use _PyUnicode_AsUTF8NoNUL for AC 's' and 'z' converters The code was doing the same as the helper added in GH-111957 but inline. That resulted in significantly more `.text` for most functions. Refactor the Arguemnt Clinic converters code to deduplicate a bit while keeping generated code close to original. On my Linux x64 box this reduces `.text` by ~6200 bytes in a clang release build (no PGO or LTO). Performance is flat. The helper was already exported for `_sqlite3`, update the comment that it is used in AC generated code as well. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * Update Include/internal/pycore_unicodeobject.h Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com> * Remove NEWS, add period --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
This commit is contained in:
47 files changed
+309
-1115
No files matched your search
@@ -468,7 +468,7 @@ extern void _PyUnicode_InternStatic(PyInterpreterState *interp, PyObject **);
|
||||
extern void _PyUnicode_ClearInterned(PyInterpreterState *interp);
|
||||
|
||||
// Like PyUnicode_AsUTF8(), but check for embedded null characters.
|
||||
// Export for '_sqlite3' shared extension.
|
||||
// Export for '_sqlite3' shared extension, and for Argument Clinic code.
|
||||
PyAPI_FUNC(const char *) _PyUnicode_AsUTF8NoNUL(PyObject *);
|
||||
|
||||
|
||||
|
||||
Generated
+3
-7
@@ -5,6 +5,7 @@ preserve
|
||||
#include "pycore_abstract.h" // _PyNumber_Index()
|
||||
#include "pycore_critical_section.h"// Py_BEGIN_CRITICAL_SECTION()
|
||||
#include "pycore_modsupport.h" // _PyArg_CheckPositional()
|
||||
#include "pycore_unicodeobject.h" // _PyUnicode_AsUTF8NoNUL()
|
||||
|
||||
PyDoc_STRVAR(_ctypes_CType_Type___sizeof____doc__,
|
||||
"__sizeof__($self, /)\n"
|
||||
@@ -240,15 +241,10 @@ CDataType_in_dll(PyObject *type, PyTypeObject *cls, PyObject *const *args, Py_ss
|
||||
_PyArg_BadArgument("in_dll", "argument 2", "str", args[1]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t name_length;
|
||||
name = PyUnicode_AsUTF8AndSize(args[1], &name_length);
|
||||
name = _PyUnicode_AsUTF8NoNUL(args[1]);
|
||||
if (name == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(name) != (size_t)name_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
return_value = CDataType_in_dll_impl(type, cls, dll, name);
|
||||
|
||||
exit:
|
||||
@@ -822,4 +818,4 @@ Simple_from_outparm(PyObject *self, PyTypeObject *cls, PyObject *const *args, Py
|
||||
|
||||
#define _CTYPES_SIMPLE_VALUE_GETSETDEF {"value", (getter)_ctypes_Simple_value_get, (setter)_ctypes_Simple_value_set, NULL},
|
||||
|
||||
/*[clinic end generated code: output=1d81035cd8b2015d input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=e7e9bd957c3d7362 input=a9049054013a1b77]*/
|
||||
Generated
+3
-7
@@ -5,6 +5,7 @@ preserve
|
||||
#include "pycore_abstract.h" // _PyNumber_Index()
|
||||
#include "pycore_critical_section.h"// Py_BEGIN_CRITICAL_SECTION()
|
||||
#include "pycore_modsupport.h" // _PyArg_CheckPositional()
|
||||
#include "pycore_unicodeobject.h" // _PyUnicode_AsUTF8NoNUL()
|
||||
|
||||
PyDoc_STRVAR(_ctypes_get_errno__doc__,
|
||||
"get_errno($module, /)\n"
|
||||
@@ -406,15 +407,10 @@ _ctypes_dlsym(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
|
||||
_PyArg_BadArgument("dlsym", "argument 2", "str", args[1]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t name_length;
|
||||
name = PyUnicode_AsUTF8AndSize(args[1], &name_length);
|
||||
name = _PyUnicode_AsUTF8NoNUL(args[1]);
|
||||
if (name == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(name) != (size_t)name_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
return_value = _ctypes_dlsym_impl(module, handle, name);
|
||||
|
||||
exit:
|
||||
@@ -797,4 +793,4 @@ PyDoc_STRVAR(_ctypes_buffer_info__doc__,
|
||||
#ifndef _CTYPES_DLLIST_METHODDEF
|
||||
#define _CTYPES_DLLIST_METHODDEF
|
||||
#endif /* !defined(_CTYPES_DLLIST_METHODDEF) */
|
||||
/*[clinic end generated code: output=71a41a6d90e69821 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=615c411ddc01d0a4 input=a9049054013a1b77]*/
|
||||
Generated
+6
-25
@@ -7,6 +7,7 @@ preserve
|
||||
# include "pycore_runtime.h" // _Py_ID()
|
||||
#endif
|
||||
#include "pycore_modsupport.h" // _PyArg_UnpackKeywords()
|
||||
#include "pycore_unicodeobject.h" // _PyUnicode_AsUTF8NoNUL()
|
||||
|
||||
PyDoc_STRVAR(_io_open__doc__,
|
||||
"open($module, /, file, mode=\'r\', buffering=-1, encoding=None,\n"
|
||||
@@ -192,15 +193,10 @@ _io_open(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kw
|
||||
_PyArg_BadArgument("open", "argument 'mode'", "str", args[1]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t mode_length;
|
||||
mode = PyUnicode_AsUTF8AndSize(args[1], &mode_length);
|
||||
mode = _PyUnicode_AsUTF8NoNUL(args[1]);
|
||||
if (mode == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(mode) != (size_t)mode_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
if (!--noptargs) {
|
||||
goto skip_optional_pos;
|
||||
}
|
||||
@@ -219,15 +215,10 @@ _io_open(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kw
|
||||
encoding = NULL;
|
||||
}
|
||||
else if (PyUnicode_Check(args[3])) {
|
||||
Py_ssize_t encoding_length;
|
||||
encoding = PyUnicode_AsUTF8AndSize(args[3], &encoding_length);
|
||||
encoding = _PyUnicode_AsUTF8NoNUL(args[3]);
|
||||
if (encoding == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(encoding) != (size_t)encoding_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_PyArg_BadArgument("open", "argument 'encoding'", "str or None", args[3]);
|
||||
@@ -242,15 +233,10 @@ _io_open(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kw
|
||||
errors = NULL;
|
||||
}
|
||||
else if (PyUnicode_Check(args[4])) {
|
||||
Py_ssize_t errors_length;
|
||||
errors = PyUnicode_AsUTF8AndSize(args[4], &errors_length);
|
||||
errors = _PyUnicode_AsUTF8NoNUL(args[4]);
|
||||
if (errors == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(errors) != (size_t)errors_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_PyArg_BadArgument("open", "argument 'errors'", "str or None", args[4]);
|
||||
@@ -265,15 +251,10 @@ _io_open(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kw
|
||||
newline = NULL;
|
||||
}
|
||||
else if (PyUnicode_Check(args[5])) {
|
||||
Py_ssize_t newline_length;
|
||||
newline = PyUnicode_AsUTF8AndSize(args[5], &newline_length);
|
||||
newline = _PyUnicode_AsUTF8NoNUL(args[5]);
|
||||
if (newline == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(newline) != (size_t)newline_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_PyArg_BadArgument("open", "argument 'newline'", "str or None", args[5]);
|
||||
@@ -411,4 +392,4 @@ _io_open_code(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObjec
|
||||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=5190d11f0803bfe8 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=4570f4466d711d60 input=a9049054013a1b77]*/
|
||||
Generated
+3
-7
@@ -8,6 +8,7 @@ preserve
|
||||
#endif
|
||||
#include "pycore_abstract.h" // _Py_convert_optional_to_ssize_t()
|
||||
#include "pycore_modsupport.h" // _PyArg_UnpackKeywords()
|
||||
#include "pycore_unicodeobject.h" // _PyUnicode_AsUTF8NoNUL()
|
||||
|
||||
PyDoc_STRVAR(_io_FileIO__dealloc_warn__doc__,
|
||||
"_dealloc_warn($self, source, /)\n"
|
||||
@@ -134,15 +135,10 @@ _io_FileIO___init__(PyObject *self, PyObject *args, PyObject *kwargs)
|
||||
_PyArg_BadArgument("FileIO", "argument 'mode'", "str", fastargs[1]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t mode_length;
|
||||
mode = PyUnicode_AsUTF8AndSize(fastargs[1], &mode_length);
|
||||
mode = _PyUnicode_AsUTF8NoNUL(fastargs[1]);
|
||||
if (mode == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(mode) != (size_t)mode_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
if (!--noptargs) {
|
||||
goto skip_optional_pos;
|
||||
}
|
||||
@@ -625,4 +621,4 @@ exit:
|
||||
|
||||
#define _IO_FILEIO__BLKSIZE_GETSETDEF {"_blksize", (getter)_io_FileIO__blksize_get, (setter)NULL, _io_FileIO__blksize__doc__},
|
||||
|
||||
/*[clinic end generated code: output=6ad45da113899288 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=b8d6d338bfd0a58f input=a9049054013a1b77]*/
|
||||
Generated
+5
-19
@@ -9,6 +9,7 @@ preserve
|
||||
#include "pycore_abstract.h" // _Py_convert_optional_to_ssize_t()
|
||||
#include "pycore_critical_section.h"// Py_BEGIN_CRITICAL_SECTION()
|
||||
#include "pycore_modsupport.h" // _PyArg_CheckPositional()
|
||||
#include "pycore_unicodeobject.h" // _PyUnicode_AsUTF8NoNUL()
|
||||
|
||||
PyDoc_STRVAR(_io__TextIOBase_detach__doc__,
|
||||
"detach($self, /)\n"
|
||||
@@ -151,15 +152,10 @@ _io__TextIOBase_write(PyObject *self, PyTypeObject *cls, PyObject *const *args,
|
||||
_PyArg_BadArgument("write", "argument 1", "str", args[0]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t s_length;
|
||||
s = PyUnicode_AsUTF8AndSize(args[0], &s_length);
|
||||
s = _PyUnicode_AsUTF8NoNUL(args[0]);
|
||||
if (s == NULL) {
|
||||
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);
|
||||
|
||||
exit:
|
||||
@@ -533,15 +529,10 @@ _io_TextIOWrapper___init__(PyObject *self, PyObject *args, PyObject *kwargs)
|
||||
encoding = NULL;
|
||||
}
|
||||
else if (PyUnicode_Check(fastargs[1])) {
|
||||
Py_ssize_t encoding_length;
|
||||
encoding = PyUnicode_AsUTF8AndSize(fastargs[1], &encoding_length);
|
||||
encoding = _PyUnicode_AsUTF8NoNUL(fastargs[1]);
|
||||
if (encoding == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(encoding) != (size_t)encoding_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_PyArg_BadArgument("TextIOWrapper", "argument 'encoding'", "str or None", fastargs[1]);
|
||||
@@ -562,15 +553,10 @@ _io_TextIOWrapper___init__(PyObject *self, PyObject *args, PyObject *kwargs)
|
||||
newline = NULL;
|
||||
}
|
||||
else if (PyUnicode_Check(fastargs[3])) {
|
||||
Py_ssize_t newline_length;
|
||||
newline = PyUnicode_AsUTF8AndSize(fastargs[3], &newline_length);
|
||||
newline = _PyUnicode_AsUTF8NoNUL(fastargs[3]);
|
||||
if (newline == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(newline) != (size_t)newline_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_PyArg_BadArgument("TextIOWrapper", "argument 'newline'", "str or None", fastargs[3]);
|
||||
@@ -1260,4 +1246,4 @@ _io_TextIOWrapper_buffer_get(PyObject *self, void *Py_UNUSED(context))
|
||||
|
||||
#define _IO_TEXTIOWRAPPER_BUFFER_GETSETDEF {"buffer", (getter)_io_TextIOWrapper_buffer_get, (setter)NULL, NULL},
|
||||
|
||||
/*[clinic end generated code: output=8b82c8fba47166e9 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=89de9ab341df9f66 input=a9049054013a1b77]*/
|
||||
Generated
+3
-7
@@ -8,6 +8,7 @@ preserve
|
||||
#endif
|
||||
#include "pycore_abstract.h" // _Py_convert_optional_to_ssize_t()
|
||||
#include "pycore_modsupport.h" // _PyArg_UnpackKeywords()
|
||||
#include "pycore_unicodeobject.h" // _PyUnicode_AsUTF8NoNUL()
|
||||
|
||||
#if defined(HAVE_WINDOWS_CONSOLE_IO)
|
||||
|
||||
@@ -109,15 +110,10 @@ _io__WindowsConsoleIO___init__(PyObject *self, PyObject *args, PyObject *kwargs)
|
||||
_PyArg_BadArgument("_WindowsConsoleIO", "argument 'mode'", "str", fastargs[1]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t mode_length;
|
||||
mode = PyUnicode_AsUTF8AndSize(fastargs[1], &mode_length);
|
||||
mode = _PyUnicode_AsUTF8NoNUL(fastargs[1]);
|
||||
if (mode == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(mode) != (size_t)mode_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
if (!--noptargs) {
|
||||
goto skip_optional_pos;
|
||||
}
|
||||
@@ -555,4 +551,4 @@ _io__WindowsConsoleIO_mode_get(PyObject *self, void *Py_UNUSED(context))
|
||||
# define _IO__WINDOWSCONSOLEIO_MODE_GETSETDEF
|
||||
#endif
|
||||
|
||||
/*[clinic end generated code: output=97863abe2990b665 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=7c7499116eefd498 input=a9049054013a1b77]*/
|
||||
+3
-7
@@ -3,6 +3,7 @@ preserve
|
||||
[clinic start generated code]*/
|
||||
|
||||
#include "pycore_modsupport.h" // _PyArg_CheckPositional()
|
||||
#include "pycore_unicodeobject.h" // _PyUnicode_AsUTF8NoNUL()
|
||||
|
||||
#if defined(MS_WINDOWS)
|
||||
|
||||
@@ -138,15 +139,10 @@ _multiprocessing_sem_unlink(PyObject *module, PyObject *arg)
|
||||
_PyArg_BadArgument("sem_unlink", "argument", "str", arg);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t name_length;
|
||||
name = PyUnicode_AsUTF8AndSize(arg, &name_length);
|
||||
name = _PyUnicode_AsUTF8NoNUL(arg);
|
||||
if (name == NULL) {
|
||||
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);
|
||||
|
||||
exit:
|
||||
@@ -164,4 +160,4 @@ exit:
|
||||
#ifndef _MULTIPROCESSING_SEND_METHODDEF
|
||||
#define _MULTIPROCESSING_SEND_METHODDEF
|
||||
#endif /* !defined(_MULTIPROCESSING_SEND_METHODDEF) */
|
||||
/*[clinic end generated code: output=73b4cb8428d816da input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=f5147f6a6e2cbd17 input=a9049054013a1b77]*/
|
||||
+3
-7
@@ -8,6 +8,7 @@ preserve
|
||||
#endif
|
||||
#include "pycore_critical_section.h"// Py_BEGIN_CRITICAL_SECTION()
|
||||
#include "pycore_modsupport.h" // _PyArg_UnpackKeywords()
|
||||
#include "pycore_unicodeobject.h" // _PyUnicode_AsUTF8NoNUL()
|
||||
|
||||
#if defined(HAVE_MP_SEMAPHORE) && defined(MS_WINDOWS)
|
||||
|
||||
@@ -292,15 +293,10 @@ _multiprocessing_SemLock(PyTypeObject *type, PyObject *args, PyObject *kwargs)
|
||||
_PyArg_BadArgument("SemLock", "argument 'name'", "str", fastargs[3]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t name_length;
|
||||
name = PyUnicode_AsUTF8AndSize(fastargs[3], &name_length);
|
||||
name = _PyUnicode_AsUTF8NoNUL(fastargs[3]);
|
||||
if (name == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(name) != (size_t)name_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
unlink = PyObject_IsTrue(fastargs[4]);
|
||||
if (unlink < 0) {
|
||||
goto exit;
|
||||
@@ -582,4 +578,4 @@ exit:
|
||||
#ifndef _MULTIPROCESSING_SEMLOCK___EXIT___METHODDEF
|
||||
#define _MULTIPROCESSING_SEMLOCK___EXIT___METHODDEF
|
||||
#endif /* !defined(_MULTIPROCESSING_SEMLOCK___EXIT___METHODDEF) */
|
||||
/*[clinic end generated code: output=d1e349d4ee3d4bbf input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=5c3a00b85537e647 input=a9049054013a1b77]*/
|
||||
+2
-1
@@ -7,6 +7,7 @@ preserve
|
||||
# include "pycore_runtime.h" // _Py_ID()
|
||||
#endif
|
||||
#include "pycore_modsupport.h" // _PyArg_UnpackKeywords()
|
||||
#include "pycore_unicodeobject.h" // _PyUnicode_AsUTF8NoNUL()
|
||||
|
||||
PyDoc_STRVAR(pysqlite_connect__doc__,
|
||||
"connect($module, /, database, *, timeout=5.0, detect_types=0,\n"
|
||||
@@ -22,4 +23,4 @@ PyDoc_STRVAR(pysqlite_connect__doc__,
|
||||
|
||||
#define PYSQLITE_CONNECT_METHODDEF \
|
||||
{"connect", _PyCFunction_CAST(pysqlite_connect), METH_FASTCALL|METH_KEYWORDS, pysqlite_connect__doc__},
|
||||
/*[clinic end generated code: output=3d83139ba65e0bb5 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=07d5692e22b0fdf2 input=a9049054013a1b77]*/
|
||||
Generated
+14
-73
@@ -7,6 +7,7 @@ preserve
|
||||
# include "pycore_runtime.h" // _Py_ID()
|
||||
#endif
|
||||
#include "pycore_modsupport.h" // _PyArg_UnpackKeywords()
|
||||
#include "pycore_unicodeobject.h" // _PyUnicode_AsUTF8NoNUL()
|
||||
|
||||
static int
|
||||
pysqlite_connection_init_impl(pysqlite_Connection *self, PyObject *database,
|
||||
@@ -280,28 +281,18 @@ blobopen(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwna
|
||||
_PyArg_BadArgument("blobopen", "argument 1", "str", args[0]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t table_length;
|
||||
table = PyUnicode_AsUTF8AndSize(args[0], &table_length);
|
||||
table = _PyUnicode_AsUTF8NoNUL(args[0]);
|
||||
if (table == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(table) != (size_t)table_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
if (!PyUnicode_Check(args[1])) {
|
||||
_PyArg_BadArgument("blobopen", "argument 2", "str", args[1]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t col_length;
|
||||
col = PyUnicode_AsUTF8AndSize(args[1], &col_length);
|
||||
col = _PyUnicode_AsUTF8NoNUL(args[1]);
|
||||
if (col == NULL) {
|
||||
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)) {
|
||||
goto exit;
|
||||
}
|
||||
@@ -321,15 +312,10 @@ blobopen(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwna
|
||||
_PyArg_BadArgument("blobopen", "argument 'name'", "str", args[4]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t name_length;
|
||||
name = PyUnicode_AsUTF8AndSize(args[4], &name_length);
|
||||
name = _PyUnicode_AsUTF8NoNUL(args[4]);
|
||||
if (name == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(name) != (size_t)name_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
skip_optional_kwonly:
|
||||
return_value = blobopen_impl((pysqlite_Connection *)self, table, col, row, readonly, name);
|
||||
|
||||
@@ -459,15 +445,10 @@ pysqlite_connection_create_function(PyObject *self, PyTypeObject *cls, PyObject
|
||||
_PyArg_BadArgument("create_function", "argument 1", "str", args[0]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t name_length;
|
||||
name = PyUnicode_AsUTF8AndSize(args[0], &name_length);
|
||||
name = _PyUnicode_AsUTF8NoNUL(args[0]);
|
||||
if (name == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(name) != (size_t)name_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
narg = PyLong_AsInt(args[1]);
|
||||
if (narg == -1 && PyErr_Occurred()) {
|
||||
goto exit;
|
||||
@@ -530,15 +511,10 @@ create_window_function(PyObject *self, PyTypeObject *cls, PyObject *const *args,
|
||||
_PyArg_BadArgument("create_window_function", "argument 1", "str", args[0]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t name_length;
|
||||
name = PyUnicode_AsUTF8AndSize(args[0], &name_length);
|
||||
name = _PyUnicode_AsUTF8NoNUL(args[0]);
|
||||
if (name == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(name) != (size_t)name_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
num_params = PyLong_AsInt(args[1]);
|
||||
if (num_params == -1 && PyErr_Occurred()) {
|
||||
goto exit;
|
||||
@@ -585,15 +561,10 @@ pysqlite_connection_create_aggregate(PyObject *self, PyTypeObject *cls, PyObject
|
||||
_PyArg_BadArgument("create_aggregate", "argument 1", "str", args[0]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t name_length;
|
||||
name = PyUnicode_AsUTF8AndSize(args[0], &name_length);
|
||||
name = _PyUnicode_AsUTF8NoNUL(args[0]);
|
||||
if (name == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(name) != (size_t)name_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
n_arg = PyLong_AsInt(args[1]);
|
||||
if (n_arg == -1 && PyErr_Occurred()) {
|
||||
goto exit;
|
||||
@@ -841,15 +812,10 @@ pysqlite_connection_load_extension(PyObject *self, PyObject *const *args, Py_ssi
|
||||
_PyArg_BadArgument("load_extension", "argument 1", "str", args[0]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t extension_name_length;
|
||||
extension_name = PyUnicode_AsUTF8AndSize(args[0], &extension_name_length);
|
||||
extension_name = _PyUnicode_AsUTF8NoNUL(args[0]);
|
||||
if (extension_name == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(extension_name) != (size_t)extension_name_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
if (!noptargs) {
|
||||
goto skip_optional_kwonly;
|
||||
}
|
||||
@@ -857,15 +823,10 @@ pysqlite_connection_load_extension(PyObject *self, PyObject *const *args, Py_ssi
|
||||
entrypoint = NULL;
|
||||
}
|
||||
else if (PyUnicode_Check(args[1])) {
|
||||
Py_ssize_t entrypoint_length;
|
||||
entrypoint = PyUnicode_AsUTF8AndSize(args[1], &entrypoint_length);
|
||||
entrypoint = _PyUnicode_AsUTF8NoNUL(args[1]);
|
||||
if (entrypoint == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(entrypoint) != (size_t)entrypoint_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_PyArg_BadArgument("load_extension", "argument 'entrypoint'", "str or None", args[1]);
|
||||
@@ -1150,15 +1111,10 @@ pysqlite_connection_backup(PyObject *self, PyObject *const *args, Py_ssize_t nar
|
||||
_PyArg_BadArgument("backup", "argument 'name'", "str", args[3]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t name_length;
|
||||
name = PyUnicode_AsUTF8AndSize(args[3], &name_length);
|
||||
name = _PyUnicode_AsUTF8NoNUL(args[3]);
|
||||
if (name == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(name) != (size_t)name_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
if (!--noptargs) {
|
||||
goto skip_optional_kwonly;
|
||||
}
|
||||
@@ -1212,15 +1168,10 @@ pysqlite_connection_create_collation(PyObject *self, PyTypeObject *cls, PyObject
|
||||
_PyArg_BadArgument("create_collation", "argument 1", "str", args[0]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t name_length;
|
||||
name = PyUnicode_AsUTF8AndSize(args[0], &name_length);
|
||||
name = _PyUnicode_AsUTF8NoNUL(args[0]);
|
||||
if (name == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(name) != (size_t)name_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
callable = args[1];
|
||||
return_value = pysqlite_connection_create_collation_impl((pysqlite_Connection *)self, cls, name, callable);
|
||||
|
||||
@@ -1297,15 +1248,10 @@ serialize(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwn
|
||||
_PyArg_BadArgument("serialize", "argument 'name'", "str", args[0]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t name_length;
|
||||
name = PyUnicode_AsUTF8AndSize(args[0], &name_length);
|
||||
name = _PyUnicode_AsUTF8NoNUL(args[0]);
|
||||
if (name == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(name) != (size_t)name_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
skip_optional_kwonly:
|
||||
return_value = serialize_impl((pysqlite_Connection *)self, name);
|
||||
|
||||
@@ -1406,15 +1352,10 @@ deserialize(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *k
|
||||
_PyArg_BadArgument("deserialize", "argument 'name'", "str", args[1]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t name_length;
|
||||
name = PyUnicode_AsUTF8AndSize(args[1], &name_length);
|
||||
name = _PyUnicode_AsUTF8NoNUL(args[1]);
|
||||
if (name == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(name) != (size_t)name_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
skip_optional_kwonly:
|
||||
return_value = deserialize_impl((pysqlite_Connection *)self, &data, name);
|
||||
|
||||
@@ -1660,4 +1601,4 @@ exit:
|
||||
#ifndef DESERIALIZE_METHODDEF
|
||||
#define DESERIALIZE_METHODDEF
|
||||
#endif /* !defined(DESERIALIZE_METHODDEF) */
|
||||
/*[clinic end generated code: output=c3e7157ea43130f8 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=faee86c7feaa0937 input=a9049054013a1b77]*/
|
||||
Generated
+3
-7
@@ -8,6 +8,7 @@ preserve
|
||||
#endif
|
||||
#include "pycore_long.h" // _PyLong_UInt32_Converter()
|
||||
#include "pycore_modsupport.h" // _PyArg_CheckPositional()
|
||||
#include "pycore_unicodeobject.h" // _PyUnicode_AsUTF8NoNUL()
|
||||
|
||||
static int
|
||||
pysqlite_cursor_init_impl(pysqlite_Cursor *self,
|
||||
@@ -136,15 +137,10 @@ pysqlite_cursor_executescript(PyObject *self, PyObject *arg)
|
||||
_PyArg_BadArgument("executescript", "argument", "str", arg);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t sql_script_length;
|
||||
sql_script = PyUnicode_AsUTF8AndSize(arg, &sql_script_length);
|
||||
sql_script = _PyUnicode_AsUTF8NoNUL(arg);
|
||||
if (sql_script == NULL) {
|
||||
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((pysqlite_Cursor *)self, sql_script);
|
||||
|
||||
exit:
|
||||
@@ -364,4 +360,4 @@ exit:
|
||||
}
|
||||
#define _SQLITE3_CURSOR_ARRAYSIZE_GETSETDEF {"arraysize", (getter)_sqlite3_Cursor_arraysize_get, (setter)_sqlite3_Cursor_arraysize_set, NULL},
|
||||
|
||||
/*[clinic end generated code: output=e920343d84bd4976 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=c24b4d93900ed908 input=a9049054013a1b77]*/
|
||||
Generated
+3
-7
@@ -7,6 +7,7 @@ preserve
|
||||
# include "pycore_runtime.h" // _Py_ID()
|
||||
#endif
|
||||
#include "pycore_modsupport.h" // _PyArg_UnpackKeywords()
|
||||
#include "pycore_unicodeobject.h" // _PyUnicode_AsUTF8NoNUL()
|
||||
|
||||
PyDoc_STRVAR(pysqlite_complete_statement__doc__,
|
||||
"complete_statement($module, /, statement)\n"
|
||||
@@ -63,15 +64,10 @@ pysqlite_complete_statement(PyObject *module, PyObject *const *args, Py_ssize_t
|
||||
_PyArg_BadArgument("complete_statement", "argument 'statement'", "str", args[0]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t statement_length;
|
||||
statement = PyUnicode_AsUTF8AndSize(args[0], &statement_length);
|
||||
statement = _PyUnicode_AsUTF8NoNUL(args[0]);
|
||||
if (statement == NULL) {
|
||||
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);
|
||||
|
||||
exit:
|
||||
@@ -211,4 +207,4 @@ skip_optional:
|
||||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=17c4e031680a5168 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=02aee45b7f9f14f0 input=a9049054013a1b77]*/
|
||||
Generated
+4
-13
@@ -7,6 +7,7 @@ preserve
|
||||
# include "pycore_runtime.h" // _Py_ID()
|
||||
#endif
|
||||
#include "pycore_modsupport.h" // _PyArg_CheckPositional()
|
||||
#include "pycore_unicodeobject.h" // _PyUnicode_AsUTF8NoNUL()
|
||||
|
||||
PyDoc_STRVAR(_testcapi_err_set_raised__doc__,
|
||||
"err_set_raised($module, exception, /)\n"
|
||||
@@ -146,15 +147,10 @@ _testcapi_make_exception_with_doc(PyObject *module, PyObject *const *args, Py_ss
|
||||
_PyArg_BadArgument("make_exception_with_doc", "argument 'name'", "str", args[0]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t name_length;
|
||||
name = PyUnicode_AsUTF8AndSize(args[0], &name_length);
|
||||
name = _PyUnicode_AsUTF8NoNUL(args[0]);
|
||||
if (name == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(name) != (size_t)name_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
if (!noptargs) {
|
||||
goto skip_optional_pos;
|
||||
}
|
||||
@@ -163,15 +159,10 @@ _testcapi_make_exception_with_doc(PyObject *module, PyObject *const *args, Py_ss
|
||||
_PyArg_BadArgument("make_exception_with_doc", "argument 'doc'", "str", args[1]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t doc_length;
|
||||
doc = PyUnicode_AsUTF8AndSize(args[1], &doc_length);
|
||||
doc = _PyUnicode_AsUTF8NoNUL(args[1]);
|
||||
if (doc == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(doc) != (size_t)doc_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
if (!--noptargs) {
|
||||
goto skip_optional_pos;
|
||||
}
|
||||
@@ -490,4 +481,4 @@ _testcapi_unstable_exc_prep_reraise_star(PyObject *module, PyObject *const *args
|
||||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=a21ce5554900dba1 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=89fd3856718cf39c input=a9049054013a1b77]*/
|
||||
+4
-13
@@ -7,6 +7,7 @@ preserve
|
||||
# include "pycore_runtime.h" // _Py_ID()
|
||||
#endif
|
||||
#include "pycore_modsupport.h" // _PyArg_UnpackKeywords()
|
||||
#include "pycore_unicodeobject.h" // _PyUnicode_AsUTF8NoNUL()
|
||||
|
||||
PyDoc_STRVAR(_multibytecodec_MultibyteCodec_encode__doc__,
|
||||
"encode($self, /, input, errors=None)\n"
|
||||
@@ -77,15 +78,10 @@ _multibytecodec_MultibyteCodec_encode(PyObject *self, PyObject *const *args, Py_
|
||||
errors = NULL;
|
||||
}
|
||||
else if (PyUnicode_Check(args[1])) {
|
||||
Py_ssize_t errors_length;
|
||||
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
|
||||
errors = _PyUnicode_AsUTF8NoNUL(args[1]);
|
||||
if (errors == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(errors) != (size_t)errors_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_PyArg_BadArgument("encode", "argument 'errors'", "str or None", args[1]);
|
||||
@@ -169,15 +165,10 @@ _multibytecodec_MultibyteCodec_decode(PyObject *self, PyObject *const *args, Py_
|
||||
errors = NULL;
|
||||
}
|
||||
else if (PyUnicode_Check(args[1])) {
|
||||
Py_ssize_t errors_length;
|
||||
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
|
||||
errors = _PyUnicode_AsUTF8NoNUL(args[1]);
|
||||
if (errors == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(errors) != (size_t)errors_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_PyArg_BadArgument("decode", "argument 'errors'", "str or None", args[1]);
|
||||
@@ -672,4 +663,4 @@ PyDoc_STRVAR(_multibytecodec___create_codec__doc__,
|
||||
|
||||
#define _MULTIBYTECODEC___CREATE_CODEC_METHODDEF \
|
||||
{"__create_codec", (PyCFunction)_multibytecodec___create_codec, METH_O, _multibytecodec___create_codec__doc__},
|
||||
/*[clinic end generated code: output=b7eb6679d9f627b7 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=20fec21d79e87a15 input=a9049054013a1b77]*/
|
||||
Generated
+51
-295
@@ -7,6 +7,7 @@ preserve
|
||||
# include "pycore_runtime.h" // _Py_ID()
|
||||
#endif
|
||||
#include "pycore_modsupport.h" // _PyArg_BadArgument()
|
||||
#include "pycore_unicodeobject.h" // _PyUnicode_AsUTF8NoNUL()
|
||||
|
||||
PyDoc_STRVAR(_codecs_register__doc__,
|
||||
"register($module, search_function, /)\n"
|
||||
@@ -55,15 +56,10 @@ _codecs_lookup(PyObject *module, PyObject *arg)
|
||||
_PyArg_BadArgument("lookup", "argument", "str", arg);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t encoding_length;
|
||||
encoding = PyUnicode_AsUTF8AndSize(arg, &encoding_length);
|
||||
encoding = _PyUnicode_AsUTF8NoNUL(arg);
|
||||
if (encoding == NULL) {
|
||||
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);
|
||||
|
||||
exit:
|
||||
@@ -140,15 +136,10 @@ _codecs_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObje
|
||||
_PyArg_BadArgument("encode", "argument 'encoding'", "str", args[1]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t encoding_length;
|
||||
encoding = PyUnicode_AsUTF8AndSize(args[1], &encoding_length);
|
||||
encoding = _PyUnicode_AsUTF8NoNUL(args[1]);
|
||||
if (encoding == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(encoding) != (size_t)encoding_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
if (!--noptargs) {
|
||||
goto skip_optional_pos;
|
||||
}
|
||||
@@ -157,15 +148,10 @@ _codecs_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObje
|
||||
_PyArg_BadArgument("encode", "argument 'errors'", "str", args[2]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t errors_length;
|
||||
errors = PyUnicode_AsUTF8AndSize(args[2], &errors_length);
|
||||
errors = _PyUnicode_AsUTF8NoNUL(args[2]);
|
||||
if (errors == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(errors) != (size_t)errors_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
skip_optional_pos:
|
||||
return_value = _codecs_encode_impl(module, obj, encoding, errors);
|
||||
|
||||
@@ -243,15 +229,10 @@ _codecs_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObje
|
||||
_PyArg_BadArgument("decode", "argument 'encoding'", "str", args[1]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t encoding_length;
|
||||
encoding = PyUnicode_AsUTF8AndSize(args[1], &encoding_length);
|
||||
encoding = _PyUnicode_AsUTF8NoNUL(args[1]);
|
||||
if (encoding == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(encoding) != (size_t)encoding_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
if (!--noptargs) {
|
||||
goto skip_optional_pos;
|
||||
}
|
||||
@@ -260,15 +241,10 @@ _codecs_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObje
|
||||
_PyArg_BadArgument("decode", "argument 'errors'", "str", args[2]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t errors_length;
|
||||
errors = PyUnicode_AsUTF8AndSize(args[2], &errors_length);
|
||||
errors = _PyUnicode_AsUTF8NoNUL(args[2]);
|
||||
if (errors == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(errors) != (size_t)errors_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
skip_optional_pos:
|
||||
return_value = _codecs_decode_impl(module, obj, encoding, errors);
|
||||
|
||||
@@ -320,15 +296,10 @@ _codecs_escape_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
|
||||
errors = NULL;
|
||||
}
|
||||
else if (PyUnicode_Check(args[1])) {
|
||||
Py_ssize_t errors_length;
|
||||
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
|
||||
errors = _PyUnicode_AsUTF8NoNUL(args[1]);
|
||||
if (errors == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(errors) != (size_t)errors_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_PyArg_BadArgument("escape_decode", "argument 2", "str or None", args[1]);
|
||||
@@ -380,15 +351,10 @@ _codecs_escape_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
|
||||
errors = NULL;
|
||||
}
|
||||
else if (PyUnicode_Check(args[1])) {
|
||||
Py_ssize_t errors_length;
|
||||
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
|
||||
errors = _PyUnicode_AsUTF8NoNUL(args[1]);
|
||||
if (errors == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(errors) != (size_t)errors_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_PyArg_BadArgument("escape_encode", "argument 2", "str or None", args[1]);
|
||||
@@ -434,15 +400,10 @@ _codecs_utf_7_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
|
||||
errors = NULL;
|
||||
}
|
||||
else if (PyUnicode_Check(args[1])) {
|
||||
Py_ssize_t errors_length;
|
||||
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
|
||||
errors = _PyUnicode_AsUTF8NoNUL(args[1]);
|
||||
if (errors == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(errors) != (size_t)errors_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_PyArg_BadArgument("utf_7_decode", "argument 2", "str or None", args[1]);
|
||||
@@ -500,15 +461,10 @@ _codecs_utf_8_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
|
||||
errors = NULL;
|
||||
}
|
||||
else if (PyUnicode_Check(args[1])) {
|
||||
Py_ssize_t errors_length;
|
||||
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
|
||||
errors = _PyUnicode_AsUTF8NoNUL(args[1]);
|
||||
if (errors == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(errors) != (size_t)errors_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_PyArg_BadArgument("utf_8_decode", "argument 2", "str or None", args[1]);
|
||||
@@ -566,15 +522,10 @@ _codecs_utf_16_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
|
||||
errors = NULL;
|
||||
}
|
||||
else if (PyUnicode_Check(args[1])) {
|
||||
Py_ssize_t errors_length;
|
||||
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
|
||||
errors = _PyUnicode_AsUTF8NoNUL(args[1]);
|
||||
if (errors == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(errors) != (size_t)errors_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_PyArg_BadArgument("utf_16_decode", "argument 2", "str or None", args[1]);
|
||||
@@ -632,15 +583,10 @@ _codecs_utf_16_le_decode(PyObject *module, PyObject *const *args, Py_ssize_t nar
|
||||
errors = NULL;
|
||||
}
|
||||
else if (PyUnicode_Check(args[1])) {
|
||||
Py_ssize_t errors_length;
|
||||
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
|
||||
errors = _PyUnicode_AsUTF8NoNUL(args[1]);
|
||||
if (errors == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(errors) != (size_t)errors_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_PyArg_BadArgument("utf_16_le_decode", "argument 2", "str or None", args[1]);
|
||||
@@ -698,15 +644,10 @@ _codecs_utf_16_be_decode(PyObject *module, PyObject *const *args, Py_ssize_t nar
|
||||
errors = NULL;
|
||||
}
|
||||
else if (PyUnicode_Check(args[1])) {
|
||||
Py_ssize_t errors_length;
|
||||
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
|
||||
errors = _PyUnicode_AsUTF8NoNUL(args[1]);
|
||||
if (errors == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(errors) != (size_t)errors_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_PyArg_BadArgument("utf_16_be_decode", "argument 2", "str or None", args[1]);
|
||||
@@ -766,15 +707,10 @@ _codecs_utf_16_ex_decode(PyObject *module, PyObject *const *args, Py_ssize_t nar
|
||||
errors = NULL;
|
||||
}
|
||||
else if (PyUnicode_Check(args[1])) {
|
||||
Py_ssize_t errors_length;
|
||||
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
|
||||
errors = _PyUnicode_AsUTF8NoNUL(args[1]);
|
||||
if (errors == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(errors) != (size_t)errors_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_PyArg_BadArgument("utf_16_ex_decode", "argument 2", "str or None", args[1]);
|
||||
@@ -839,15 +775,10 @@ _codecs_utf_32_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
|
||||
errors = NULL;
|
||||
}
|
||||
else if (PyUnicode_Check(args[1])) {
|
||||
Py_ssize_t errors_length;
|
||||
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
|
||||
errors = _PyUnicode_AsUTF8NoNUL(args[1]);
|
||||
if (errors == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(errors) != (size_t)errors_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_PyArg_BadArgument("utf_32_decode", "argument 2", "str or None", args[1]);
|
||||
@@ -905,15 +836,10 @@ _codecs_utf_32_le_decode(PyObject *module, PyObject *const *args, Py_ssize_t nar
|
||||
errors = NULL;
|
||||
}
|
||||
else if (PyUnicode_Check(args[1])) {
|
||||
Py_ssize_t errors_length;
|
||||
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
|
||||
errors = _PyUnicode_AsUTF8NoNUL(args[1]);
|
||||
if (errors == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(errors) != (size_t)errors_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_PyArg_BadArgument("utf_32_le_decode", "argument 2", "str or None", args[1]);
|
||||
@@ -971,15 +897,10 @@ _codecs_utf_32_be_decode(PyObject *module, PyObject *const *args, Py_ssize_t nar
|
||||
errors = NULL;
|
||||
}
|
||||
else if (PyUnicode_Check(args[1])) {
|
||||
Py_ssize_t errors_length;
|
||||
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
|
||||
errors = _PyUnicode_AsUTF8NoNUL(args[1]);
|
||||
if (errors == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(errors) != (size_t)errors_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_PyArg_BadArgument("utf_32_be_decode", "argument 2", "str or None", args[1]);
|
||||
@@ -1039,15 +960,10 @@ _codecs_utf_32_ex_decode(PyObject *module, PyObject *const *args, Py_ssize_t nar
|
||||
errors = NULL;
|
||||
}
|
||||
else if (PyUnicode_Check(args[1])) {
|
||||
Py_ssize_t errors_length;
|
||||
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
|
||||
errors = _PyUnicode_AsUTF8NoNUL(args[1]);
|
||||
if (errors == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(errors) != (size_t)errors_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_PyArg_BadArgument("utf_32_ex_decode", "argument 2", "str or None", args[1]);
|
||||
@@ -1124,15 +1040,10 @@ _codecs_unicode_escape_decode(PyObject *module, PyObject *const *args, Py_ssize_
|
||||
errors = NULL;
|
||||
}
|
||||
else if (PyUnicode_Check(args[1])) {
|
||||
Py_ssize_t errors_length;
|
||||
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
|
||||
errors = _PyUnicode_AsUTF8NoNUL(args[1]);
|
||||
if (errors == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(errors) != (size_t)errors_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_PyArg_BadArgument("unicode_escape_decode", "argument 2", "str or None", args[1]);
|
||||
@@ -1202,15 +1113,10 @@ _codecs_raw_unicode_escape_decode(PyObject *module, PyObject *const *args, Py_ss
|
||||
errors = NULL;
|
||||
}
|
||||
else if (PyUnicode_Check(args[1])) {
|
||||
Py_ssize_t errors_length;
|
||||
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
|
||||
errors = _PyUnicode_AsUTF8NoNUL(args[1]);
|
||||
if (errors == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(errors) != (size_t)errors_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_PyArg_BadArgument("raw_unicode_escape_decode", "argument 2", "str or None", args[1]);
|
||||
@@ -1267,15 +1173,10 @@ _codecs_latin_1_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs
|
||||
errors = NULL;
|
||||
}
|
||||
else if (PyUnicode_Check(args[1])) {
|
||||
Py_ssize_t errors_length;
|
||||
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
|
||||
errors = _PyUnicode_AsUTF8NoNUL(args[1]);
|
||||
if (errors == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(errors) != (size_t)errors_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_PyArg_BadArgument("latin_1_decode", "argument 2", "str or None", args[1]);
|
||||
@@ -1325,15 +1226,10 @@ _codecs_ascii_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
|
||||
errors = NULL;
|
||||
}
|
||||
else if (PyUnicode_Check(args[1])) {
|
||||
Py_ssize_t errors_length;
|
||||
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
|
||||
errors = _PyUnicode_AsUTF8NoNUL(args[1]);
|
||||
if (errors == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(errors) != (size_t)errors_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_PyArg_BadArgument("ascii_decode", "argument 2", "str or None", args[1]);
|
||||
@@ -1384,15 +1280,10 @@ _codecs_charmap_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs
|
||||
errors = NULL;
|
||||
}
|
||||
else if (PyUnicode_Check(args[1])) {
|
||||
Py_ssize_t errors_length;
|
||||
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
|
||||
errors = _PyUnicode_AsUTF8NoNUL(args[1]);
|
||||
if (errors == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(errors) != (size_t)errors_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_PyArg_BadArgument("charmap_decode", "argument 2", "str or None", args[1]);
|
||||
@@ -1449,15 +1340,10 @@ _codecs_mbcs_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
|
||||
errors = NULL;
|
||||
}
|
||||
else if (PyUnicode_Check(args[1])) {
|
||||
Py_ssize_t errors_length;
|
||||
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
|
||||
errors = _PyUnicode_AsUTF8NoNUL(args[1]);
|
||||
if (errors == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(errors) != (size_t)errors_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_PyArg_BadArgument("mbcs_decode", "argument 2", "str or None", args[1]);
|
||||
@@ -1519,15 +1405,10 @@ _codecs_oem_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
|
||||
errors = NULL;
|
||||
}
|
||||
else if (PyUnicode_Check(args[1])) {
|
||||
Py_ssize_t errors_length;
|
||||
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
|
||||
errors = _PyUnicode_AsUTF8NoNUL(args[1]);
|
||||
if (errors == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(errors) != (size_t)errors_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_PyArg_BadArgument("oem_decode", "argument 2", "str or None", args[1]);
|
||||
@@ -1594,15 +1475,10 @@ _codecs_code_page_decode(PyObject *module, PyObject *const *args, Py_ssize_t nar
|
||||
errors = NULL;
|
||||
}
|
||||
else if (PyUnicode_Check(args[2])) {
|
||||
Py_ssize_t errors_length;
|
||||
errors = PyUnicode_AsUTF8AndSize(args[2], &errors_length);
|
||||
errors = _PyUnicode_AsUTF8NoNUL(args[2]);
|
||||
if (errors == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(errors) != (size_t)errors_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_PyArg_BadArgument("code_page_decode", "argument 3", "str or None", args[2]);
|
||||
@@ -1659,15 +1535,10 @@ _codecs_iconv_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
|
||||
_PyArg_BadArgument("iconv_decode", "argument 1", "str", args[0]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t encoding_length;
|
||||
encoding = PyUnicode_AsUTF8AndSize(args[0], &encoding_length);
|
||||
encoding = _PyUnicode_AsUTF8NoNUL(args[0]);
|
||||
if (encoding == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(encoding) != (size_t)encoding_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
if (PyObject_GetBuffer(args[1], &data, PyBUF_SIMPLE) != 0) {
|
||||
goto exit;
|
||||
}
|
||||
@@ -1678,15 +1549,10 @@ _codecs_iconv_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
|
||||
errors = NULL;
|
||||
}
|
||||
else if (PyUnicode_Check(args[2])) {
|
||||
Py_ssize_t errors_length;
|
||||
errors = PyUnicode_AsUTF8AndSize(args[2], &errors_length);
|
||||
errors = _PyUnicode_AsUTF8NoNUL(args[2]);
|
||||
if (errors == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(errors) != (size_t)errors_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_PyArg_BadArgument("iconv_decode", "argument 3", "str or None", args[2]);
|
||||
@@ -1757,15 +1623,10 @@ _codecs_readbuffer_encode(PyObject *module, PyObject *const *args, Py_ssize_t na
|
||||
errors = NULL;
|
||||
}
|
||||
else if (PyUnicode_Check(args[1])) {
|
||||
Py_ssize_t errors_length;
|
||||
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
|
||||
errors = _PyUnicode_AsUTF8NoNUL(args[1]);
|
||||
if (errors == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(errors) != (size_t)errors_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_PyArg_BadArgument("readbuffer_encode", "argument 2", "str or None", args[1]);
|
||||
@@ -1817,15 +1678,10 @@ _codecs_utf_7_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
|
||||
errors = NULL;
|
||||
}
|
||||
else if (PyUnicode_Check(args[1])) {
|
||||
Py_ssize_t errors_length;
|
||||
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
|
||||
errors = _PyUnicode_AsUTF8NoNUL(args[1]);
|
||||
if (errors == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(errors) != (size_t)errors_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_PyArg_BadArgument("utf_7_encode", "argument 2", "str or None", args[1]);
|
||||
@@ -1872,15 +1728,10 @@ _codecs_utf_8_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
|
||||
errors = NULL;
|
||||
}
|
||||
else if (PyUnicode_Check(args[1])) {
|
||||
Py_ssize_t errors_length;
|
||||
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
|
||||
errors = _PyUnicode_AsUTF8NoNUL(args[1]);
|
||||
if (errors == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(errors) != (size_t)errors_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_PyArg_BadArgument("utf_8_encode", "argument 2", "str or None", args[1]);
|
||||
@@ -1928,15 +1779,10 @@ _codecs_utf_16_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
|
||||
errors = NULL;
|
||||
}
|
||||
else if (PyUnicode_Check(args[1])) {
|
||||
Py_ssize_t errors_length;
|
||||
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
|
||||
errors = _PyUnicode_AsUTF8NoNUL(args[1]);
|
||||
if (errors == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(errors) != (size_t)errors_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_PyArg_BadArgument("utf_16_encode", "argument 2", "str or None", args[1]);
|
||||
@@ -1990,15 +1836,10 @@ _codecs_utf_16_le_encode(PyObject *module, PyObject *const *args, Py_ssize_t nar
|
||||
errors = NULL;
|
||||
}
|
||||
else if (PyUnicode_Check(args[1])) {
|
||||
Py_ssize_t errors_length;
|
||||
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
|
||||
errors = _PyUnicode_AsUTF8NoNUL(args[1]);
|
||||
if (errors == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(errors) != (size_t)errors_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_PyArg_BadArgument("utf_16_le_encode", "argument 2", "str or None", args[1]);
|
||||
@@ -2045,15 +1886,10 @@ _codecs_utf_16_be_encode(PyObject *module, PyObject *const *args, Py_ssize_t nar
|
||||
errors = NULL;
|
||||
}
|
||||
else if (PyUnicode_Check(args[1])) {
|
||||
Py_ssize_t errors_length;
|
||||
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
|
||||
errors = _PyUnicode_AsUTF8NoNUL(args[1]);
|
||||
if (errors == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(errors) != (size_t)errors_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_PyArg_BadArgument("utf_16_be_encode", "argument 2", "str or None", args[1]);
|
||||
@@ -2101,15 +1937,10 @@ _codecs_utf_32_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
|
||||
errors = NULL;
|
||||
}
|
||||
else if (PyUnicode_Check(args[1])) {
|
||||
Py_ssize_t errors_length;
|
||||
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
|
||||
errors = _PyUnicode_AsUTF8NoNUL(args[1]);
|
||||
if (errors == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(errors) != (size_t)errors_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_PyArg_BadArgument("utf_32_encode", "argument 2", "str or None", args[1]);
|
||||
@@ -2163,15 +1994,10 @@ _codecs_utf_32_le_encode(PyObject *module, PyObject *const *args, Py_ssize_t nar
|
||||
errors = NULL;
|
||||
}
|
||||
else if (PyUnicode_Check(args[1])) {
|
||||
Py_ssize_t errors_length;
|
||||
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
|
||||
errors = _PyUnicode_AsUTF8NoNUL(args[1]);
|
||||
if (errors == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(errors) != (size_t)errors_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_PyArg_BadArgument("utf_32_le_encode", "argument 2", "str or None", args[1]);
|
||||
@@ -2218,15 +2044,10 @@ _codecs_utf_32_be_encode(PyObject *module, PyObject *const *args, Py_ssize_t nar
|
||||
errors = NULL;
|
||||
}
|
||||
else if (PyUnicode_Check(args[1])) {
|
||||
Py_ssize_t errors_length;
|
||||
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
|
||||
errors = _PyUnicode_AsUTF8NoNUL(args[1]);
|
||||
if (errors == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(errors) != (size_t)errors_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_PyArg_BadArgument("utf_32_be_encode", "argument 2", "str or None", args[1]);
|
||||
@@ -2273,15 +2094,10 @@ _codecs_unicode_escape_encode(PyObject *module, PyObject *const *args, Py_ssize_
|
||||
errors = NULL;
|
||||
}
|
||||
else if (PyUnicode_Check(args[1])) {
|
||||
Py_ssize_t errors_length;
|
||||
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
|
||||
errors = _PyUnicode_AsUTF8NoNUL(args[1]);
|
||||
if (errors == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(errors) != (size_t)errors_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_PyArg_BadArgument("unicode_escape_encode", "argument 2", "str or None", args[1]);
|
||||
@@ -2328,15 +2144,10 @@ _codecs_raw_unicode_escape_encode(PyObject *module, PyObject *const *args, Py_ss
|
||||
errors = NULL;
|
||||
}
|
||||
else if (PyUnicode_Check(args[1])) {
|
||||
Py_ssize_t errors_length;
|
||||
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
|
||||
errors = _PyUnicode_AsUTF8NoNUL(args[1]);
|
||||
if (errors == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(errors) != (size_t)errors_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_PyArg_BadArgument("raw_unicode_escape_encode", "argument 2", "str or None", args[1]);
|
||||
@@ -2383,15 +2194,10 @@ _codecs_latin_1_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs
|
||||
errors = NULL;
|
||||
}
|
||||
else if (PyUnicode_Check(args[1])) {
|
||||
Py_ssize_t errors_length;
|
||||
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
|
||||
errors = _PyUnicode_AsUTF8NoNUL(args[1]);
|
||||
if (errors == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(errors) != (size_t)errors_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_PyArg_BadArgument("latin_1_encode", "argument 2", "str or None", args[1]);
|
||||
@@ -2438,15 +2244,10 @@ _codecs_ascii_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
|
||||
errors = NULL;
|
||||
}
|
||||
else if (PyUnicode_Check(args[1])) {
|
||||
Py_ssize_t errors_length;
|
||||
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
|
||||
errors = _PyUnicode_AsUTF8NoNUL(args[1]);
|
||||
if (errors == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(errors) != (size_t)errors_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_PyArg_BadArgument("ascii_encode", "argument 2", "str or None", args[1]);
|
||||
@@ -2494,15 +2295,10 @@ _codecs_charmap_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs
|
||||
errors = NULL;
|
||||
}
|
||||
else if (PyUnicode_Check(args[1])) {
|
||||
Py_ssize_t errors_length;
|
||||
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
|
||||
errors = _PyUnicode_AsUTF8NoNUL(args[1]);
|
||||
if (errors == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(errors) != (size_t)errors_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_PyArg_BadArgument("charmap_encode", "argument 2", "str or None", args[1]);
|
||||
@@ -2582,15 +2378,10 @@ _codecs_mbcs_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
|
||||
errors = NULL;
|
||||
}
|
||||
else if (PyUnicode_Check(args[1])) {
|
||||
Py_ssize_t errors_length;
|
||||
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
|
||||
errors = _PyUnicode_AsUTF8NoNUL(args[1]);
|
||||
if (errors == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(errors) != (size_t)errors_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_PyArg_BadArgument("mbcs_encode", "argument 2", "str or None", args[1]);
|
||||
@@ -2640,15 +2431,10 @@ _codecs_oem_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
|
||||
errors = NULL;
|
||||
}
|
||||
else if (PyUnicode_Check(args[1])) {
|
||||
Py_ssize_t errors_length;
|
||||
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
|
||||
errors = _PyUnicode_AsUTF8NoNUL(args[1]);
|
||||
if (errors == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(errors) != (size_t)errors_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_PyArg_BadArgument("oem_encode", "argument 2", "str or None", args[1]);
|
||||
@@ -2704,15 +2490,10 @@ _codecs_code_page_encode(PyObject *module, PyObject *const *args, Py_ssize_t nar
|
||||
errors = NULL;
|
||||
}
|
||||
else if (PyUnicode_Check(args[2])) {
|
||||
Py_ssize_t errors_length;
|
||||
errors = PyUnicode_AsUTF8AndSize(args[2], &errors_length);
|
||||
errors = _PyUnicode_AsUTF8NoNUL(args[2]);
|
||||
if (errors == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(errors) != (size_t)errors_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_PyArg_BadArgument("code_page_encode", "argument 3", "str or None", args[2]);
|
||||
@@ -2756,15 +2537,10 @@ _codecs_iconv_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
|
||||
_PyArg_BadArgument("iconv_encode", "argument 1", "str", args[0]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t encoding_length;
|
||||
encoding = PyUnicode_AsUTF8AndSize(args[0], &encoding_length);
|
||||
encoding = _PyUnicode_AsUTF8NoNUL(args[0]);
|
||||
if (encoding == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(encoding) != (size_t)encoding_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
if (!PyUnicode_Check(args[1])) {
|
||||
_PyArg_BadArgument("iconv_encode", "argument 2", "str", args[1]);
|
||||
goto exit;
|
||||
@@ -2777,15 +2553,10 @@ _codecs_iconv_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
|
||||
errors = NULL;
|
||||
}
|
||||
else if (PyUnicode_Check(args[2])) {
|
||||
Py_ssize_t errors_length;
|
||||
errors = PyUnicode_AsUTF8AndSize(args[2], &errors_length);
|
||||
errors = _PyUnicode_AsUTF8NoNUL(args[2]);
|
||||
if (errors == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(errors) != (size_t)errors_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_PyArg_BadArgument("iconv_encode", "argument 3", "str or None", args[2]);
|
||||
@@ -2832,15 +2603,10 @@ _codecs_register_error(PyObject *module, PyObject *const *args, Py_ssize_t nargs
|
||||
_PyArg_BadArgument("register_error", "argument 1", "str", args[0]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t errors_length;
|
||||
errors = PyUnicode_AsUTF8AndSize(args[0], &errors_length);
|
||||
errors = _PyUnicode_AsUTF8NoNUL(args[0]);
|
||||
if (errors == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(errors) != (size_t)errors_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
handler = args[1];
|
||||
return_value = _codecs_register_error_impl(module, errors, handler);
|
||||
|
||||
@@ -2879,15 +2645,10 @@ _codecs__unregister_error(PyObject *module, PyObject *arg)
|
||||
_PyArg_BadArgument("_unregister_error", "argument", "str", arg);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t errors_length;
|
||||
errors = PyUnicode_AsUTF8AndSize(arg, &errors_length);
|
||||
errors = _PyUnicode_AsUTF8NoNUL(arg);
|
||||
if (errors == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(errors) != (size_t)errors_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
_return_value = _codecs__unregister_error_impl(module, errors);
|
||||
if ((_return_value == -1) && PyErr_Occurred()) {
|
||||
goto exit;
|
||||
@@ -2923,15 +2684,10 @@ _codecs_lookup_error(PyObject *module, PyObject *arg)
|
||||
_PyArg_BadArgument("lookup_error", "argument", "str", arg);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t name_length;
|
||||
name = PyUnicode_AsUTF8AndSize(arg, &name_length);
|
||||
name = _PyUnicode_AsUTF8NoNUL(arg);
|
||||
if (name == NULL) {
|
||||
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);
|
||||
|
||||
exit:
|
||||
@@ -3033,4 +2789,4 @@ exit:
|
||||
#ifndef _CODECS_ICONV_ENCODE_METHODDEF
|
||||
#define _CODECS_ICONV_ENCODE_METHODDEF
|
||||
#endif /* !defined(_CODECS_ICONV_ENCODE_METHODDEF) */
|
||||
/*[clinic end generated code: output=d6e155d435335482 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=2bf386d7e284e6f3 input=a9049054013a1b77]*/
|
||||
Generated
+9
-43
@@ -8,6 +8,7 @@ preserve
|
||||
#endif
|
||||
#include "pycore_long.h" // _PyLong_UnsignedInt_Converter()
|
||||
#include "pycore_modsupport.h" // _PyArg_UnpackKeywords()
|
||||
#include "pycore_unicodeobject.h" // _PyUnicode_AsUTF8NoNUL()
|
||||
|
||||
PyDoc_STRVAR(complexchar_new__doc__,
|
||||
"complexchar(text, /, attr=0, pair=0)\n"
|
||||
@@ -3814,15 +3815,10 @@ _curses_define_key(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
|
||||
definition = NULL;
|
||||
}
|
||||
else if (PyUnicode_Check(args[0])) {
|
||||
Py_ssize_t definition_length;
|
||||
definition = PyUnicode_AsUTF8AndSize(args[0], &definition_length);
|
||||
definition = _PyUnicode_AsUTF8NoNUL(args[0]);
|
||||
if (definition == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(definition) != (size_t)definition_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_PyArg_BadArgument("define_key", "argument 1", "str or None", args[0]);
|
||||
@@ -3870,15 +3866,10 @@ _curses_key_defined(PyObject *module, PyObject *arg)
|
||||
_PyArg_BadArgument("key_defined", "argument", "str", arg);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t definition_length;
|
||||
definition = PyUnicode_AsUTF8AndSize(arg, &definition_length);
|
||||
definition = _PyUnicode_AsUTF8NoNUL(arg);
|
||||
if (definition == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(definition) != (size_t)definition_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
return_value = _curses_key_defined_impl(module, definition);
|
||||
|
||||
exit:
|
||||
@@ -4273,15 +4264,10 @@ _curses_setupterm(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyO
|
||||
term = NULL;
|
||||
}
|
||||
else if (PyUnicode_Check(args[0])) {
|
||||
Py_ssize_t term_length;
|
||||
term = PyUnicode_AsUTF8AndSize(args[0], &term_length);
|
||||
term = _PyUnicode_AsUTF8NoNUL(args[0]);
|
||||
if (term == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(term) != (size_t)term_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_PyArg_BadArgument("setupterm", "argument 'term'", "str or None", args[0]);
|
||||
@@ -4343,15 +4329,10 @@ _curses_newterm(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
|
||||
type = NULL;
|
||||
}
|
||||
else if (PyUnicode_Check(args[0])) {
|
||||
Py_ssize_t type_length;
|
||||
type = PyUnicode_AsUTF8AndSize(args[0], &type_length);
|
||||
type = _PyUnicode_AsUTF8NoNUL(args[0]);
|
||||
if (type == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(type) != (size_t)type_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_PyArg_BadArgument("newterm", "argument 1", "str or None", args[0]);
|
||||
@@ -5735,15 +5716,10 @@ _curses_tigetflag(PyObject *module, PyObject *arg)
|
||||
_PyArg_BadArgument("tigetflag", "argument", "str", arg);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t capname_length;
|
||||
capname = PyUnicode_AsUTF8AndSize(arg, &capname_length);
|
||||
capname = _PyUnicode_AsUTF8NoNUL(arg);
|
||||
if (capname == NULL) {
|
||||
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);
|
||||
|
||||
exit:
|
||||
@@ -5778,15 +5754,10 @@ _curses_tigetnum(PyObject *module, PyObject *arg)
|
||||
_PyArg_BadArgument("tigetnum", "argument", "str", arg);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t capname_length;
|
||||
capname = PyUnicode_AsUTF8AndSize(arg, &capname_length);
|
||||
capname = _PyUnicode_AsUTF8NoNUL(arg);
|
||||
if (capname == NULL) {
|
||||
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);
|
||||
|
||||
exit:
|
||||
@@ -5821,15 +5792,10 @@ _curses_tigetstr(PyObject *module, PyObject *arg)
|
||||
_PyArg_BadArgument("tigetstr", "argument", "str", arg);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t capname_length;
|
||||
capname = PyUnicode_AsUTF8AndSize(arg, &capname_length);
|
||||
capname = _PyUnicode_AsUTF8NoNUL(arg);
|
||||
if (capname == NULL) {
|
||||
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);
|
||||
|
||||
exit:
|
||||
@@ -6749,4 +6715,4 @@ _curses_has_extended_color_support(PyObject *module, PyObject *Py_UNUSED(ignored
|
||||
#ifndef _CURSES_ASSUME_DEFAULT_COLORS_METHODDEF
|
||||
#define _CURSES_ASSUME_DEFAULT_COLORS_METHODDEF
|
||||
#endif /* !defined(_CURSES_ASSUME_DEFAULT_COLORS_METHODDEF) */
|
||||
/*[clinic end generated code: output=cc7b5de1c82ae56b input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=957470523e2b0eb1 input=a9049054013a1b77]*/
|
||||
Generated
+4
-13
@@ -7,6 +7,7 @@ preserve
|
||||
# include "pycore_runtime.h" // _Py_ID()
|
||||
#endif
|
||||
#include "pycore_modsupport.h" // _PyArg_UnpackKeywords()
|
||||
#include "pycore_unicodeobject.h" // _PyUnicode_AsUTF8NoNUL()
|
||||
|
||||
PyDoc_STRVAR(delta_new__doc__,
|
||||
"timedelta(days=0, seconds=0, microseconds=0, milliseconds=0, minutes=0,\n"
|
||||
@@ -957,15 +958,10 @@ datetime_time_isoformat(PyObject *self, PyObject *const *args, Py_ssize_t nargs,
|
||||
_PyArg_BadArgument("isoformat", "argument 'timespec'", "str", args[0]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t timespec_length;
|
||||
timespec = PyUnicode_AsUTF8AndSize(args[0], ×pec_length);
|
||||
timespec = _PyUnicode_AsUTF8NoNUL(args[0]);
|
||||
if (timespec == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(timespec) != (size_t)timespec_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
skip_optional_pos:
|
||||
return_value = datetime_time_isoformat_impl((PyDateTime_Time *)self, timespec);
|
||||
|
||||
@@ -1816,15 +1812,10 @@ datetime_datetime_isoformat(PyObject *self, PyObject *const *args, Py_ssize_t na
|
||||
_PyArg_BadArgument("isoformat", "argument 'timespec'", "str", args[1]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t timespec_length;
|
||||
timespec = PyUnicode_AsUTF8AndSize(args[1], ×pec_length);
|
||||
timespec = _PyUnicode_AsUTF8NoNUL(args[1]);
|
||||
if (timespec == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(timespec) != (size_t)timespec_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
skip_optional_pos:
|
||||
return_value = datetime_datetime_isoformat_impl((PyDateTime_DateTime *)self, sep, timespec);
|
||||
|
||||
@@ -2091,4 +2082,4 @@ datetime_datetime___reduce__(PyObject *self, PyObject *Py_UNUSED(ignored))
|
||||
{
|
||||
return datetime_datetime___reduce___impl((PyDateTime_DateTime *)self);
|
||||
}
|
||||
/*[clinic end generated code: output=8f63509398651723 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=7bdfdfbd568c63ed input=a9049054013a1b77]*/
|
||||
Generated
+3
-7
@@ -4,6 +4,7 @@ preserve
|
||||
|
||||
#include "pycore_critical_section.h"// Py_BEGIN_CRITICAL_SECTION()
|
||||
#include "pycore_modsupport.h" // _PyArg_CheckPositional()
|
||||
#include "pycore_unicodeobject.h" // _PyUnicode_AsUTF8NoNUL()
|
||||
|
||||
PyDoc_STRVAR(_dbm_dbm_close__doc__,
|
||||
"close($self, /)\n"
|
||||
@@ -231,15 +232,10 @@ dbmopen(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
|
||||
_PyArg_BadArgument("open", "argument 2", "str", args[1]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t flags_length;
|
||||
flags = PyUnicode_AsUTF8AndSize(args[1], &flags_length);
|
||||
flags = _PyUnicode_AsUTF8NoNUL(args[1]);
|
||||
if (flags == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(flags) != (size_t)flags_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
if (nargs < 3) {
|
||||
goto skip_optional;
|
||||
}
|
||||
@@ -253,4 +249,4 @@ skip_optional:
|
||||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=336b7a79dd19219c input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=1ad0e5f0f4c7e9dd input=a9049054013a1b77]*/
|
||||
Generated
+3
-7
@@ -8,6 +8,7 @@ preserve
|
||||
#endif
|
||||
#include "pycore_abstract.h" // _PyNumber_Index()
|
||||
#include "pycore_modsupport.h" // _PyArg_CheckPositional()
|
||||
#include "pycore_unicodeobject.h" // _PyUnicode_AsUTF8NoNUL()
|
||||
|
||||
PyDoc_STRVAR(_elementtree_SubElement__doc__,
|
||||
"SubElement($module, parent, tag, attrib={}, /, **extra)\n"
|
||||
@@ -1352,15 +1353,10 @@ _elementtree_XMLParser___init__(PyObject *self, PyObject *args, PyObject *kwargs
|
||||
encoding = NULL;
|
||||
}
|
||||
else if (PyUnicode_Check(fastargs[1])) {
|
||||
Py_ssize_t encoding_length;
|
||||
encoding = PyUnicode_AsUTF8AndSize(fastargs[1], &encoding_length);
|
||||
encoding = _PyUnicode_AsUTF8NoNUL(fastargs[1]);
|
||||
if (encoding == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(encoding) != (size_t)encoding_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_PyArg_BadArgument("XMLParser", "argument 'encoding'", "str or None", fastargs[1]);
|
||||
@@ -1486,4 +1482,4 @@ skip_optional:
|
||||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=9f9f792978663b16 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=01693c4bcc6c63b2 input=a9049054013a1b77]*/
|
||||
Generated
+3
-7
@@ -4,6 +4,7 @@ preserve
|
||||
|
||||
#include "pycore_critical_section.h"// Py_BEGIN_CRITICAL_SECTION()
|
||||
#include "pycore_modsupport.h" // _PyArg_CheckPositional()
|
||||
#include "pycore_unicodeobject.h" // _PyUnicode_AsUTF8NoNUL()
|
||||
|
||||
PyDoc_STRVAR(_gdbm_gdbm_get__doc__,
|
||||
"get($self, key, default=None, /)\n"
|
||||
@@ -383,15 +384,10 @@ dbmopen(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
|
||||
_PyArg_BadArgument("open", "argument 2", "str", args[1]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t flags_length;
|
||||
flags = PyUnicode_AsUTF8AndSize(args[1], &flags_length);
|
||||
flags = _PyUnicode_AsUTF8NoNUL(args[1]);
|
||||
if (flags == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(flags) != (size_t)flags_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
if (nargs < 3) {
|
||||
goto skip_optional;
|
||||
}
|
||||
@@ -405,4 +401,4 @@ skip_optional:
|
||||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=841b16bd11ef0066 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=a3249cf7b6c4fae9 input=a9049054013a1b77]*/
|
||||
Generated
+4
-13
@@ -9,6 +9,7 @@ preserve
|
||||
#include "pycore_abstract.h" // _PyNumber_Index()
|
||||
#include "pycore_long.h" // _PyLong_UnsignedLong_Converter()
|
||||
#include "pycore_modsupport.h" // _PyArg_UnpackKeywords()
|
||||
#include "pycore_unicodeobject.h" // _PyUnicode_AsUTF8NoNUL()
|
||||
|
||||
PyDoc_STRVAR(_hashlib_HASH_copy__doc__,
|
||||
"copy($self, /)\n"
|
||||
@@ -307,15 +308,10 @@ _hashlib_HASH_new(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyO
|
||||
_PyArg_BadArgument("new", "argument 'name'", "str", args[0]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t name_length;
|
||||
name = PyUnicode_AsUTF8AndSize(args[0], &name_length);
|
||||
name = _PyUnicode_AsUTF8NoNUL(args[0]);
|
||||
if (name == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(name) != (size_t)name_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
if (!noptargs) {
|
||||
goto skip_optional_pos;
|
||||
}
|
||||
@@ -1463,15 +1459,10 @@ pbkdf2_hmac(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
|
||||
_PyArg_BadArgument("pbkdf2_hmac", "argument 'hash_name'", "str", args[0]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t hash_name_length;
|
||||
hash_name = PyUnicode_AsUTF8AndSize(args[0], &hash_name_length);
|
||||
hash_name = _PyUnicode_AsUTF8NoNUL(args[0]);
|
||||
if (hash_name == NULL) {
|
||||
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) {
|
||||
goto exit;
|
||||
}
|
||||
@@ -1986,4 +1977,4 @@ exit:
|
||||
#ifndef _HASHLIB_OPENSSL_SHAKE_256_METHODDEF
|
||||
#define _HASHLIB_OPENSSL_SHAKE_256_METHODDEF
|
||||
#endif /* !defined(_HASHLIB_OPENSSL_SHAKE_256_METHODDEF) */
|
||||
/*[clinic end generated code: output=cf405e652a340bb2 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=608e8ac9483c9173 input=a9049054013a1b77]*/
|
||||
Generated
+3
-7
@@ -7,6 +7,7 @@ preserve
|
||||
# include "pycore_runtime.h" // _Py_ID()
|
||||
#endif
|
||||
#include "pycore_modsupport.h" // _PyArg_CheckPositional()
|
||||
#include "pycore_unicodeobject.h" // _PyUnicode_AsUTF8NoNUL()
|
||||
|
||||
PyDoc_STRVAR(_interpreters_new_config__doc__,
|
||||
"new_config($module, name=\'isolated\', /, **overrides)\n"
|
||||
@@ -44,15 +45,10 @@ _interpreters_new_config(PyObject *module, PyObject *args, PyObject *kwargs)
|
||||
_PyArg_BadArgument("new_config", "argument 1", "str", PyTuple_GET_ITEM(args, 0));
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t name_length;
|
||||
name = PyUnicode_AsUTF8AndSize(PyTuple_GET_ITEM(args, 0), &name_length);
|
||||
name = _PyUnicode_AsUTF8NoNUL(PyTuple_GET_ITEM(args, 0));
|
||||
if (name == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(name) != (size_t)name_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
skip_optional:
|
||||
if (kwargs == NULL) {
|
||||
overrides = PyDict_New();
|
||||
@@ -1264,4 +1260,4 @@ skip_optional_pos:
|
||||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=38892db3b955efbb input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=fa37872d6ee729ef input=a9049054013a1b77]*/
|
||||
Generated
+12
-61
@@ -3,6 +3,7 @@ preserve
|
||||
[clinic start generated code]*/
|
||||
|
||||
#include "pycore_modsupport.h" // _PyArg_CheckPositional()
|
||||
#include "pycore_unicodeobject.h" // _PyUnicode_AsUTF8NoNUL()
|
||||
|
||||
PyDoc_STRVAR(_locale_setlocale__doc__,
|
||||
"setlocale($module, category, locale=None, /)\n"
|
||||
@@ -37,15 +38,10 @@ _locale_setlocale(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
|
||||
locale = NULL;
|
||||
}
|
||||
else if (PyUnicode_Check(args[1])) {
|
||||
Py_ssize_t locale_length;
|
||||
locale = PyUnicode_AsUTF8AndSize(args[1], &locale_length);
|
||||
locale = _PyUnicode_AsUTF8NoNUL(args[1]);
|
||||
if (locale == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(locale) != (size_t)locale_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_PyArg_BadArgument("setlocale", "argument 2", "str or None", args[1]);
|
||||
@@ -230,15 +226,10 @@ _locale_gettext(PyObject *module, PyObject *arg)
|
||||
_PyArg_BadArgument("gettext", "argument", "str", arg);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t in_length;
|
||||
in = PyUnicode_AsUTF8AndSize(arg, &in_length);
|
||||
in = _PyUnicode_AsUTF8NoNUL(arg);
|
||||
if (in == NULL) {
|
||||
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);
|
||||
|
||||
exit:
|
||||
@@ -277,15 +268,10 @@ _locale_dgettext(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
|
||||
domain = NULL;
|
||||
}
|
||||
else if (PyUnicode_Check(args[0])) {
|
||||
Py_ssize_t domain_length;
|
||||
domain = PyUnicode_AsUTF8AndSize(args[0], &domain_length);
|
||||
domain = _PyUnicode_AsUTF8NoNUL(args[0]);
|
||||
if (domain == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(domain) != (size_t)domain_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_PyArg_BadArgument("dgettext", "argument 1", "str or None", args[0]);
|
||||
@@ -295,15 +281,10 @@ _locale_dgettext(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
|
||||
_PyArg_BadArgument("dgettext", "argument 2", "str", args[1]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t in_length;
|
||||
in = PyUnicode_AsUTF8AndSize(args[1], &in_length);
|
||||
in = _PyUnicode_AsUTF8NoNUL(args[1]);
|
||||
if (in == NULL) {
|
||||
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);
|
||||
|
||||
exit:
|
||||
@@ -342,15 +323,10 @@ _locale_dcgettext(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
|
||||
domain = NULL;
|
||||
}
|
||||
else if (PyUnicode_Check(args[0])) {
|
||||
Py_ssize_t domain_length;
|
||||
domain = PyUnicode_AsUTF8AndSize(args[0], &domain_length);
|
||||
domain = _PyUnicode_AsUTF8NoNUL(args[0]);
|
||||
if (domain == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(domain) != (size_t)domain_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_PyArg_BadArgument("dcgettext", "argument 1", "str or None", args[0]);
|
||||
@@ -360,15 +336,10 @@ _locale_dcgettext(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
|
||||
_PyArg_BadArgument("dcgettext", "argument 2", "str", args[1]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t msgid_length;
|
||||
msgid = PyUnicode_AsUTF8AndSize(args[1], &msgid_length);
|
||||
msgid = _PyUnicode_AsUTF8NoNUL(args[1]);
|
||||
if (msgid == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(msgid) != (size_t)msgid_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
category = PyLong_AsInt(args[2]);
|
||||
if (category == -1 && PyErr_Occurred()) {
|
||||
goto exit;
|
||||
@@ -405,15 +376,10 @@ _locale_textdomain(PyObject *module, PyObject *arg)
|
||||
domain = NULL;
|
||||
}
|
||||
else if (PyUnicode_Check(arg)) {
|
||||
Py_ssize_t domain_length;
|
||||
domain = PyUnicode_AsUTF8AndSize(arg, &domain_length);
|
||||
domain = _PyUnicode_AsUTF8NoNUL(arg);
|
||||
if (domain == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(domain) != (size_t)domain_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_PyArg_BadArgument("textdomain", "argument", "str or None", arg);
|
||||
@@ -456,15 +422,10 @@ _locale_bindtextdomain(PyObject *module, PyObject *const *args, Py_ssize_t nargs
|
||||
_PyArg_BadArgument("bindtextdomain", "argument 1", "str", args[0]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t domain_length;
|
||||
domain = PyUnicode_AsUTF8AndSize(args[0], &domain_length);
|
||||
domain = _PyUnicode_AsUTF8NoNUL(args[0]);
|
||||
if (domain == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(domain) != (size_t)domain_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
dirname_obj = args[1];
|
||||
return_value = _locale_bindtextdomain_impl(module, domain, dirname_obj);
|
||||
|
||||
@@ -503,28 +464,18 @@ _locale_bind_textdomain_codeset(PyObject *module, PyObject *const *args, Py_ssiz
|
||||
_PyArg_BadArgument("bind_textdomain_codeset", "argument 1", "str", args[0]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t domain_length;
|
||||
domain = PyUnicode_AsUTF8AndSize(args[0], &domain_length);
|
||||
domain = _PyUnicode_AsUTF8NoNUL(args[0]);
|
||||
if (domain == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(domain) != (size_t)domain_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
if (args[1] == Py_None) {
|
||||
codeset = NULL;
|
||||
}
|
||||
else if (PyUnicode_Check(args[1])) {
|
||||
Py_ssize_t codeset_length;
|
||||
codeset = PyUnicode_AsUTF8AndSize(args[1], &codeset_length);
|
||||
codeset = _PyUnicode_AsUTF8NoNUL(args[1]);
|
||||
if (codeset == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(codeset) != (size_t)codeset_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_PyArg_BadArgument("bind_textdomain_codeset", "argument 2", "str or None", args[1]);
|
||||
@@ -595,4 +546,4 @@ _locale_getencoding(PyObject *module, PyObject *Py_UNUSED(ignored))
|
||||
#ifndef _LOCALE_BIND_TEXTDOMAIN_CODESET_METHODDEF
|
||||
#define _LOCALE_BIND_TEXTDOMAIN_CODESET_METHODDEF
|
||||
#endif /* !defined(_LOCALE_BIND_TEXTDOMAIN_CODESET_METHODDEF) */
|
||||
/*[clinic end generated code: output=bb987603f9de8824 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=b995b35bd3085d5b input=a9049054013a1b77]*/
|
||||
Generated
+8
-37
@@ -7,6 +7,7 @@ preserve
|
||||
# include "pycore_runtime.h" // _Py_ID()
|
||||
#endif
|
||||
#include "pycore_modsupport.h" // _PyArg_CheckPositional()
|
||||
#include "pycore_unicodeobject.h" // _PyUnicode_AsUTF8NoNUL()
|
||||
|
||||
PyDoc_STRVAR(_pickle_Pickler_clear_memo__doc__,
|
||||
"clear_memo($self, /)\n"
|
||||
@@ -479,15 +480,10 @@ _pickle_Unpickler___init__(PyObject *self, PyObject *args, PyObject *kwargs)
|
||||
_PyArg_BadArgument("Unpickler", "argument 'encoding'", "str", fastargs[2]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t encoding_length;
|
||||
encoding = PyUnicode_AsUTF8AndSize(fastargs[2], &encoding_length);
|
||||
encoding = _PyUnicode_AsUTF8NoNUL(fastargs[2]);
|
||||
if (encoding == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(encoding) != (size_t)encoding_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
if (!--noptargs) {
|
||||
goto skip_optional_kwonly;
|
||||
}
|
||||
@@ -497,15 +493,10 @@ _pickle_Unpickler___init__(PyObject *self, PyObject *args, PyObject *kwargs)
|
||||
_PyArg_BadArgument("Unpickler", "argument 'errors'", "str", fastargs[3]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t errors_length;
|
||||
errors = PyUnicode_AsUTF8AndSize(fastargs[3], &errors_length);
|
||||
errors = _PyUnicode_AsUTF8NoNUL(fastargs[3]);
|
||||
if (errors == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(errors) != (size_t)errors_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
if (!--noptargs) {
|
||||
goto skip_optional_kwonly;
|
||||
}
|
||||
@@ -892,15 +883,10 @@ _pickle_load(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
|
||||
_PyArg_BadArgument("load", "argument 'encoding'", "str", args[2]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t encoding_length;
|
||||
encoding = PyUnicode_AsUTF8AndSize(args[2], &encoding_length);
|
||||
encoding = _PyUnicode_AsUTF8NoNUL(args[2]);
|
||||
if (encoding == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(encoding) != (size_t)encoding_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
if (!--noptargs) {
|
||||
goto skip_optional_kwonly;
|
||||
}
|
||||
@@ -910,15 +896,10 @@ _pickle_load(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
|
||||
_PyArg_BadArgument("load", "argument 'errors'", "str", args[3]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t errors_length;
|
||||
errors = PyUnicode_AsUTF8AndSize(args[3], &errors_length);
|
||||
errors = _PyUnicode_AsUTF8NoNUL(args[3]);
|
||||
if (errors == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(errors) != (size_t)errors_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
if (!--noptargs) {
|
||||
goto skip_optional_kwonly;
|
||||
}
|
||||
@@ -1021,15 +1002,10 @@ _pickle_loads(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObjec
|
||||
_PyArg_BadArgument("loads", "argument 'encoding'", "str", args[2]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t encoding_length;
|
||||
encoding = PyUnicode_AsUTF8AndSize(args[2], &encoding_length);
|
||||
encoding = _PyUnicode_AsUTF8NoNUL(args[2]);
|
||||
if (encoding == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(encoding) != (size_t)encoding_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
if (!--noptargs) {
|
||||
goto skip_optional_kwonly;
|
||||
}
|
||||
@@ -1039,15 +1015,10 @@ _pickle_loads(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObjec
|
||||
_PyArg_BadArgument("loads", "argument 'errors'", "str", args[3]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t errors_length;
|
||||
errors = PyUnicode_AsUTF8AndSize(args[3], &errors_length);
|
||||
errors = _PyUnicode_AsUTF8NoNUL(args[3]);
|
||||
if (errors == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(errors) != (size_t)errors_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
if (!--noptargs) {
|
||||
goto skip_optional_kwonly;
|
||||
}
|
||||
@@ -1059,4 +1030,4 @@ skip_optional_kwonly:
|
||||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=df25a5fe475b57b0 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=df810fb55415996f input=a9049054013a1b77]*/
|
||||
Generated
+12
-61
@@ -11,6 +11,7 @@ preserve
|
||||
#include "pycore_fileutils.h" // _Py_Off_t_Converter()
|
||||
#include "pycore_long.h" // _PyLong_Size_t_Converter()
|
||||
#include "pycore_modsupport.h" // _PyArg_CheckPositional()
|
||||
#include "pycore_unicodeobject.h" // _PyUnicode_AsUTF8NoNUL()
|
||||
|
||||
PyDoc_STRVAR(_ssl__SSLSocket_do_handshake__doc__,
|
||||
"do_handshake($self, /)\n"
|
||||
@@ -771,15 +772,10 @@ _ssl__SSLSocket_get_channel_binding(PyObject *self, PyObject *const *args, Py_ss
|
||||
_PyArg_BadArgument("get_channel_binding", "argument 'cb_type'", "str", args[0]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t cb_type_length;
|
||||
cb_type = PyUnicode_AsUTF8AndSize(args[0], &cb_type_length);
|
||||
cb_type = _PyUnicode_AsUTF8NoNUL(args[0]);
|
||||
if (cb_type == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(cb_type) != (size_t)cb_type_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
skip_optional_pos:
|
||||
Py_BEGIN_CRITICAL_SECTION(self);
|
||||
return_value = _ssl__SSLSocket_get_channel_binding_impl((PySSLSocket *)self, cb_type);
|
||||
@@ -922,15 +918,10 @@ _ssl__SSLContext_set_ciphers(PyObject *self, PyObject *arg)
|
||||
_PyArg_BadArgument("set_ciphers", "argument", "str", arg);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t cipherlist_length;
|
||||
cipherlist = PyUnicode_AsUTF8AndSize(arg, &cipherlist_length);
|
||||
cipherlist = _PyUnicode_AsUTF8NoNUL(arg);
|
||||
if (cipherlist == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(cipherlist) != (size_t)cipherlist_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
Py_BEGIN_CRITICAL_SECTION(self);
|
||||
return_value = _ssl__SSLContext_set_ciphers_impl((PySSLContext *)self, cipherlist);
|
||||
Py_END_CRITICAL_SECTION();
|
||||
@@ -961,15 +952,10 @@ _ssl__SSLContext_set_ciphersuites(PyObject *self, PyObject *arg)
|
||||
_PyArg_BadArgument("set_ciphersuites", "argument", "str", arg);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t ciphersuites_length;
|
||||
ciphersuites = PyUnicode_AsUTF8AndSize(arg, &ciphersuites_length);
|
||||
ciphersuites = _PyUnicode_AsUTF8NoNUL(arg);
|
||||
if (ciphersuites == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(ciphersuites) != (size_t)ciphersuites_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
Py_BEGIN_CRITICAL_SECTION(self);
|
||||
return_value = _ssl__SSLContext_set_ciphersuites_impl((PySSLContext *)self, ciphersuites);
|
||||
Py_END_CRITICAL_SECTION();
|
||||
@@ -1022,15 +1008,10 @@ _ssl__SSLContext_set_groups(PyObject *self, PyObject *arg)
|
||||
_PyArg_BadArgument("set_groups", "argument", "str", arg);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t grouplist_length;
|
||||
grouplist = PyUnicode_AsUTF8AndSize(arg, &grouplist_length);
|
||||
grouplist = _PyUnicode_AsUTF8NoNUL(arg);
|
||||
if (grouplist == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(grouplist) != (size_t)grouplist_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
Py_BEGIN_CRITICAL_SECTION(self);
|
||||
return_value = _ssl__SSLContext_set_groups_impl((PySSLContext *)self, grouplist);
|
||||
Py_END_CRITICAL_SECTION();
|
||||
@@ -1128,15 +1109,10 @@ _ssl__SSLContext_set_client_sigalgs(PyObject *self, PyObject *arg)
|
||||
_PyArg_BadArgument("set_client_sigalgs", "argument", "str", arg);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t sigalgslist_length;
|
||||
sigalgslist = PyUnicode_AsUTF8AndSize(arg, &sigalgslist_length);
|
||||
sigalgslist = _PyUnicode_AsUTF8NoNUL(arg);
|
||||
if (sigalgslist == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(sigalgslist) != (size_t)sigalgslist_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
Py_BEGIN_CRITICAL_SECTION(self);
|
||||
return_value = _ssl__SSLContext_set_client_sigalgs_impl((PySSLContext *)self, sigalgslist);
|
||||
Py_END_CRITICAL_SECTION();
|
||||
@@ -1167,15 +1143,10 @@ _ssl__SSLContext_set_server_sigalgs(PyObject *self, PyObject *arg)
|
||||
_PyArg_BadArgument("set_server_sigalgs", "argument", "str", arg);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t sigalgslist_length;
|
||||
sigalgslist = PyUnicode_AsUTF8AndSize(arg, &sigalgslist_length);
|
||||
sigalgslist = _PyUnicode_AsUTF8NoNUL(arg);
|
||||
if (sigalgslist == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(sigalgslist) != (size_t)sigalgslist_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
Py_BEGIN_CRITICAL_SECTION(self);
|
||||
return_value = _ssl__SSLContext_set_server_sigalgs_impl((PySSLContext *)self, sigalgslist);
|
||||
Py_END_CRITICAL_SECTION();
|
||||
@@ -2354,15 +2325,10 @@ _ssl__SSLContext_set_psk_server_callback(PyObject *self, PyObject *const *args,
|
||||
identity_hint = NULL;
|
||||
}
|
||||
else if (PyUnicode_Check(args[1])) {
|
||||
Py_ssize_t identity_hint_length;
|
||||
identity_hint = PyUnicode_AsUTF8AndSize(args[1], &identity_hint_length);
|
||||
identity_hint = _PyUnicode_AsUTF8NoNUL(args[1]);
|
||||
if (identity_hint == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(identity_hint) != (size_t)identity_hint_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_PyArg_BadArgument("set_psk_server_callback", "argument 'identity_hint'", "str or None", args[1]);
|
||||
@@ -2855,15 +2821,10 @@ _ssl_txt2obj(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
|
||||
_PyArg_BadArgument("txt2obj", "argument 'txt'", "str", args[0]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t txt_length;
|
||||
txt = PyUnicode_AsUTF8AndSize(args[0], &txt_length);
|
||||
txt = _PyUnicode_AsUTF8NoNUL(args[0]);
|
||||
if (txt == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(txt) != (size_t)txt_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
if (!noptargs) {
|
||||
goto skip_optional_pos;
|
||||
}
|
||||
@@ -2973,15 +2934,10 @@ _ssl_enum_certificates(PyObject *module, PyObject *const *args, Py_ssize_t nargs
|
||||
_PyArg_BadArgument("enum_certificates", "argument 'store_name'", "str", args[0]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t store_name_length;
|
||||
store_name = PyUnicode_AsUTF8AndSize(args[0], &store_name_length);
|
||||
store_name = _PyUnicode_AsUTF8NoNUL(args[0]);
|
||||
if (store_name == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(store_name) != (size_t)store_name_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
Py_BEGIN_CRITICAL_SECTION(module);
|
||||
return_value = _ssl_enum_certificates_impl(module, store_name);
|
||||
Py_END_CRITICAL_SECTION();
|
||||
@@ -3054,15 +3010,10 @@ _ssl_enum_crls(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObje
|
||||
_PyArg_BadArgument("enum_crls", "argument 'store_name'", "str", args[0]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t store_name_length;
|
||||
store_name = PyUnicode_AsUTF8AndSize(args[0], &store_name_length);
|
||||
store_name = _PyUnicode_AsUTF8NoNUL(args[0]);
|
||||
if (store_name == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(store_name) != (size_t)store_name_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
Py_BEGIN_CRITICAL_SECTION(module);
|
||||
return_value = _ssl_enum_crls_impl(module, store_name);
|
||||
Py_END_CRITICAL_SECTION();
|
||||
@@ -3132,4 +3083,4 @@ exit:
|
||||
|
||||
#define _SSL_SSLSESSION_HAS_TICKET_GETSETDEF {"has_ticket", (getter)_ssl_SSLSession_has_ticket_get, (setter)NULL, _ssl_SSLSession_has_ticket__doc__},
|
||||
|
||||
/*[clinic end generated code: output=42b28429643df3e3 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=14ced41bd24b60c3 input=a9049054013a1b77]*/
|
||||
Generated
+4
-13
@@ -11,6 +11,7 @@ preserve
|
||||
#include "pycore_modsupport.h" // _PyArg_CheckPositional()
|
||||
#include "pycore_runtime.h" // _Py_ID()
|
||||
#include "pycore_tuple.h" // _PyTuple_ITEMS()
|
||||
#include "pycore_unicodeobject.h" // _PyUnicode_AsUTF8NoNUL()
|
||||
|
||||
PyDoc_STRVAR(test_empty_function__doc__,
|
||||
"test_empty_function($module, /)\n"
|
||||
@@ -4043,15 +4044,10 @@ clone_f1(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kw
|
||||
_PyArg_BadArgument("clone_f1", "argument 'path'", "str", args[0]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t path_length;
|
||||
path = PyUnicode_AsUTF8AndSize(args[0], &path_length);
|
||||
path = _PyUnicode_AsUTF8NoNUL(args[0]);
|
||||
if (path == NULL) {
|
||||
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);
|
||||
|
||||
exit:
|
||||
@@ -4112,15 +4108,10 @@ clone_f2(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kw
|
||||
_PyArg_BadArgument("clone_f2", "argument 'path'", "str", args[0]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t path_length;
|
||||
path = PyUnicode_AsUTF8AndSize(args[0], &path_length);
|
||||
path = _PyUnicode_AsUTF8NoNUL(args[0]);
|
||||
if (path == NULL) {
|
||||
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);
|
||||
|
||||
exit:
|
||||
@@ -5318,4 +5309,4 @@ vc_kwonly_vectorcall(PyObject *type, PyObject *const *args,
|
||||
kwnames ? PyTuple_GET_SIZE(kwnames) : 0,
|
||||
NULL, kwnames);
|
||||
}
|
||||
/*[clinic end generated code: output=5131e55aeb855d6e input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=e1f97f59fec61b6b input=a9049054013a1b77]*/
|
||||
Generated
+2
-1
@@ -11,6 +11,7 @@ preserve
|
||||
#include "pycore_modsupport.h" // _PyArg_CheckPositional()
|
||||
#include "pycore_runtime.h" // _Py_ID()
|
||||
#include "pycore_tuple.h" // _PyTuple_ITEMS()
|
||||
#include "pycore_unicodeobject.h" // _PyUnicode_AsUTF8NoNUL()
|
||||
|
||||
PyDoc_STRVAR(depr_star_new__doc__,
|
||||
"DeprStarNew(a=None)\n"
|
||||
@@ -2681,4 +2682,4 @@ depr_multi(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *
|
||||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=858abe8a5a885725 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=abe0af8d8c637c36 input=a9049054013a1b77]*/
|
||||
Generated
+2
-1
@@ -11,6 +11,7 @@ preserve
|
||||
#include "pycore_modsupport.h" // _PyArg_CheckPositional()
|
||||
#include "pycore_runtime.h" // _Py_ID()
|
||||
#include "pycore_tuple.h" // _PyTuple_ITEMS()
|
||||
#include "pycore_unicodeobject.h" // _PyUnicode_AsUTF8NoNUL()
|
||||
|
||||
PyDoc_STRVAR(lone_kwds__doc__,
|
||||
"lone_kwds($module, /, **kwds)\n"
|
||||
@@ -229,4 +230,4 @@ exit:
|
||||
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=62804c41a11bbd73 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=27a7ba9440b9a884 input=a9049054013a1b77]*/
|
||||
Generated
+16
-85
@@ -3,6 +3,7 @@ preserve
|
||||
[clinic start generated code]*/
|
||||
|
||||
#include "pycore_modsupport.h" // _PyArg_BadArgument()
|
||||
#include "pycore_unicodeobject.h" // _PyUnicode_AsUTF8NoNUL()
|
||||
|
||||
PyDoc_STRVAR(_tkinter_tkapp_call__doc__,
|
||||
"call($self, /, *args)\n"
|
||||
@@ -55,15 +56,10 @@ _tkinter_tkapp_eval(PyObject *self, PyObject *arg)
|
||||
_PyArg_BadArgument("eval", "argument", "str", arg);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t script_length;
|
||||
script = PyUnicode_AsUTF8AndSize(arg, &script_length);
|
||||
script = _PyUnicode_AsUTF8NoNUL(arg);
|
||||
if (script == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(script) != (size_t)script_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
return_value = _tkinter_tkapp_eval_impl((TkappObject *)self, script);
|
||||
|
||||
exit:
|
||||
@@ -91,15 +87,10 @@ _tkinter_tkapp_evalfile(PyObject *self, PyObject *arg)
|
||||
_PyArg_BadArgument("evalfile", "argument", "str", arg);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t fileName_length;
|
||||
fileName = PyUnicode_AsUTF8AndSize(arg, &fileName_length);
|
||||
fileName = _PyUnicode_AsUTF8NoNUL(arg);
|
||||
if (fileName == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(fileName) != (size_t)fileName_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
return_value = _tkinter_tkapp_evalfile_impl((TkappObject *)self, fileName);
|
||||
|
||||
exit:
|
||||
@@ -127,15 +118,10 @@ _tkinter_tkapp_record(PyObject *self, PyObject *arg)
|
||||
_PyArg_BadArgument("record", "argument", "str", arg);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t script_length;
|
||||
script = PyUnicode_AsUTF8AndSize(arg, &script_length);
|
||||
script = _PyUnicode_AsUTF8NoNUL(arg);
|
||||
if (script == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(script) != (size_t)script_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
return_value = _tkinter_tkapp_record_impl((TkappObject *)self, script);
|
||||
|
||||
exit:
|
||||
@@ -163,15 +149,10 @@ _tkinter_tkapp_adderrorinfo(PyObject *self, PyObject *arg)
|
||||
_PyArg_BadArgument("adderrorinfo", "argument", "str", arg);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t msg_length;
|
||||
msg = PyUnicode_AsUTF8AndSize(arg, &msg_length);
|
||||
msg = _PyUnicode_AsUTF8NoNUL(arg);
|
||||
if (msg == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(msg) != (size_t)msg_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
return_value = _tkinter_tkapp_adderrorinfo_impl((TkappObject *)self, msg);
|
||||
|
||||
exit:
|
||||
@@ -262,15 +243,10 @@ _tkinter_tkapp_exprstring(PyObject *self, PyObject *arg)
|
||||
_PyArg_BadArgument("exprstring", "argument", "str", arg);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t s_length;
|
||||
s = PyUnicode_AsUTF8AndSize(arg, &s_length);
|
||||
s = _PyUnicode_AsUTF8NoNUL(arg);
|
||||
if (s == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(s) != (size_t)s_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
return_value = _tkinter_tkapp_exprstring_impl((TkappObject *)self, s);
|
||||
|
||||
exit:
|
||||
@@ -298,15 +274,10 @@ _tkinter_tkapp_exprlong(PyObject *self, PyObject *arg)
|
||||
_PyArg_BadArgument("exprlong", "argument", "str", arg);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t s_length;
|
||||
s = PyUnicode_AsUTF8AndSize(arg, &s_length);
|
||||
s = _PyUnicode_AsUTF8NoNUL(arg);
|
||||
if (s == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(s) != (size_t)s_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
return_value = _tkinter_tkapp_exprlong_impl((TkappObject *)self, s);
|
||||
|
||||
exit:
|
||||
@@ -334,15 +305,10 @@ _tkinter_tkapp_exprdouble(PyObject *self, PyObject *arg)
|
||||
_PyArg_BadArgument("exprdouble", "argument", "str", arg);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t s_length;
|
||||
s = PyUnicode_AsUTF8AndSize(arg, &s_length);
|
||||
s = _PyUnicode_AsUTF8NoNUL(arg);
|
||||
if (s == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(s) != (size_t)s_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
return_value = _tkinter_tkapp_exprdouble_impl((TkappObject *)self, s);
|
||||
|
||||
exit:
|
||||
@@ -370,15 +336,10 @@ _tkinter_tkapp_exprboolean(PyObject *self, PyObject *arg)
|
||||
_PyArg_BadArgument("exprboolean", "argument", "str", arg);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t s_length;
|
||||
s = PyUnicode_AsUTF8AndSize(arg, &s_length);
|
||||
s = _PyUnicode_AsUTF8NoNUL(arg);
|
||||
if (s == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(s) != (size_t)s_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
return_value = _tkinter_tkapp_exprboolean_impl((TkappObject *)self, s);
|
||||
|
||||
exit:
|
||||
@@ -432,15 +393,10 @@ _tkinter_tkapp_createcommand(PyObject *self, PyObject *const *args, Py_ssize_t n
|
||||
_PyArg_BadArgument("createcommand", "argument 1", "str", args[0]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t name_length;
|
||||
name = PyUnicode_AsUTF8AndSize(args[0], &name_length);
|
||||
name = _PyUnicode_AsUTF8NoNUL(args[0]);
|
||||
if (name == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(name) != (size_t)name_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
func = args[1];
|
||||
return_value = _tkinter_tkapp_createcommand_impl((TkappObject *)self, name, func);
|
||||
|
||||
@@ -469,15 +425,10 @@ _tkinter_tkapp_deletecommand(PyObject *self, PyObject *arg)
|
||||
_PyArg_BadArgument("deletecommand", "argument", "str", arg);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t name_length;
|
||||
name = PyUnicode_AsUTF8AndSize(arg, &name_length);
|
||||
name = _PyUnicode_AsUTF8NoNUL(arg);
|
||||
if (name == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(name) != (size_t)name_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
return_value = _tkinter_tkapp_deletecommand_impl((TkappObject *)self, name);
|
||||
|
||||
exit:
|
||||
@@ -864,15 +815,10 @@ _tkinter_create(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
|
||||
screenName = NULL;
|
||||
}
|
||||
else if (PyUnicode_Check(args[0])) {
|
||||
Py_ssize_t screenName_length;
|
||||
screenName = PyUnicode_AsUTF8AndSize(args[0], &screenName_length);
|
||||
screenName = _PyUnicode_AsUTF8NoNUL(args[0]);
|
||||
if (screenName == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(screenName) != (size_t)screenName_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_PyArg_BadArgument("create", "argument 1", "str or None", args[0]);
|
||||
@@ -885,15 +831,10 @@ _tkinter_create(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
|
||||
_PyArg_BadArgument("create", "argument 2", "str", args[1]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t baseName_length;
|
||||
baseName = PyUnicode_AsUTF8AndSize(args[1], &baseName_length);
|
||||
baseName = _PyUnicode_AsUTF8NoNUL(args[1]);
|
||||
if (baseName == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(baseName) != (size_t)baseName_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
if (nargs < 3) {
|
||||
goto skip_optional;
|
||||
}
|
||||
@@ -901,15 +842,10 @@ _tkinter_create(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
|
||||
_PyArg_BadArgument("create", "argument 3", "str", args[2]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t className_length;
|
||||
className = PyUnicode_AsUTF8AndSize(args[2], &className_length);
|
||||
className = _PyUnicode_AsUTF8NoNUL(args[2]);
|
||||
if (className == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(className) != (size_t)className_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
if (nargs < 4) {
|
||||
goto skip_optional;
|
||||
}
|
||||
@@ -945,15 +881,10 @@ _tkinter_create(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
|
||||
use = NULL;
|
||||
}
|
||||
else if (PyUnicode_Check(args[7])) {
|
||||
Py_ssize_t use_length;
|
||||
use = PyUnicode_AsUTF8AndSize(args[7], &use_length);
|
||||
use = _PyUnicode_AsUTF8NoNUL(args[7]);
|
||||
if (use == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(use) != (size_t)use_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_PyArg_BadArgument("create", "argument 8", "str or None", args[7]);
|
||||
@@ -1032,4 +963,4 @@ exit:
|
||||
#ifndef _TKINTER_TKAPP_DELETEFILEHANDLER_METHODDEF
|
||||
#define _TKINTER_TKAPP_DELETEFILEHANDLER_METHODDEF
|
||||
#endif /* !defined(_TKINTER_TKAPP_DELETEFILEHANDLER_METHODDEF) */
|
||||
/*[clinic end generated code: output=bb55a7d4c5a8a002 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=229ae8ed00ee4e40 input=a9049054013a1b77]*/
|
||||
Generated
+3
-7
@@ -4,6 +4,7 @@ preserve
|
||||
|
||||
#include "pycore_abstract.h" // _PyNumber_Index()
|
||||
#include "pycore_modsupport.h" // _PyArg_CheckPositional()
|
||||
#include "pycore_unicodeobject.h" // _PyUnicode_AsUTF8NoNUL()
|
||||
|
||||
PyDoc_STRVAR(array_array_clear__doc__,
|
||||
"clear($self, /)\n"
|
||||
@@ -631,15 +632,10 @@ array__array_reconstructor(PyObject *module, PyObject *const *args, Py_ssize_t n
|
||||
_PyArg_BadArgument("_array_reconstructor", "argument 2", "str", args[1]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t typecode_length;
|
||||
typecode = PyUnicode_AsUTF8AndSize(args[1], &typecode_length);
|
||||
typecode = _PyUnicode_AsUTF8NoNUL(args[1]);
|
||||
if (typecode == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(typecode) != (size_t)typecode_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
mformat_code = PyLong_AsInt(args[2]);
|
||||
if (mformat_code == -1 && PyErr_Occurred()) {
|
||||
goto exit;
|
||||
@@ -726,4 +722,4 @@ array_arrayiterator___setstate__(PyObject *self, PyObject *state)
|
||||
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=54ec10a63676f320 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=172a9af0316afc14 input=a9049054013a1b77]*/
|
||||
Generated
+3
-7
@@ -9,6 +9,7 @@ preserve
|
||||
#include "pycore_abstract.h" // _PyNumber_Index()
|
||||
#include "pycore_critical_section.h"// Py_BEGIN_CRITICAL_SECTION()
|
||||
#include "pycore_modsupport.h" // _PyArg_CheckPositional()
|
||||
#include "pycore_unicodeobject.h" // _PyUnicode_AsUTF8NoNUL()
|
||||
|
||||
PyDoc_STRVAR(mmap_mmap_close__doc__,
|
||||
"close($self, /)\n"
|
||||
@@ -547,15 +548,10 @@ mmap_mmap_set_name(PyObject *self, PyObject *arg)
|
||||
_PyArg_BadArgument("set_name", "argument", "str", arg);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t name_length;
|
||||
name = PyUnicode_AsUTF8AndSize(arg, &name_length);
|
||||
name = _PyUnicode_AsUTF8NoNUL(arg);
|
||||
if (name == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(name) != (size_t)name_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
Py_BEGIN_CRITICAL_SECTION(self);
|
||||
return_value = mmap_mmap_set_name_impl((mmap_object *)self, name);
|
||||
Py_END_CRITICAL_SECTION();
|
||||
@@ -881,4 +877,4 @@ exit:
|
||||
#ifndef MMAP_MMAP_MADVISE_METHODDEF
|
||||
#define MMAP_MMAP_MADVISE_METHODDEF
|
||||
#endif /* !defined(MMAP_MMAP_MADVISE_METHODDEF) */
|
||||
/*[clinic end generated code: output=1122b93314aebc5c input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=d2ae0d1d754f51cc input=a9049054013a1b77]*/
|
||||
Generated
+5
-19
@@ -10,6 +10,7 @@ preserve
|
||||
#include "pycore_fileutils.h" // _Py_Off_t_Converter()
|
||||
#include "pycore_long.h" // _PyLong_UnsignedInt_Converter()
|
||||
#include "pycore_modsupport.h" // _PyArg_UnpackKeywords()
|
||||
#include "pycore_unicodeobject.h" // _PyUnicode_AsUTF8NoNUL()
|
||||
|
||||
PyDoc_STRVAR(os_stat__doc__,
|
||||
"stat($module, /, path, *, dir_fd=None, follow_symlinks=True)\n"
|
||||
@@ -5321,15 +5322,10 @@ os_getgrouplist(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
|
||||
_PyArg_BadArgument("getgrouplist", "argument 1", "str", args[0]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t user_length;
|
||||
user = PyUnicode_AsUTF8AndSize(args[0], &user_length);
|
||||
user = _PyUnicode_AsUTF8NoNUL(args[0]);
|
||||
if (user == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(user) != (size_t)user_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
basegid = PyLong_AsInt(args[1]);
|
||||
if (basegid == -1 && PyErr_Occurred()) {
|
||||
goto exit;
|
||||
@@ -5375,15 +5371,10 @@ os_getgrouplist(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
|
||||
_PyArg_BadArgument("getgrouplist", "argument 1", "str", args[0]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t user_length;
|
||||
user = PyUnicode_AsUTF8AndSize(args[0], &user_length);
|
||||
user = _PyUnicode_AsUTF8NoNUL(args[0]);
|
||||
if (user == NULL) {
|
||||
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)) {
|
||||
goto exit;
|
||||
}
|
||||
@@ -13070,15 +13061,10 @@ os__emscripten_log(PyObject *module, PyObject *const *args, Py_ssize_t nargs, Py
|
||||
_PyArg_BadArgument("_emscripten_log", "argument 'arg'", "str", args[0]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t arg_length;
|
||||
arg = PyUnicode_AsUTF8AndSize(args[0], &arg_length);
|
||||
arg = _PyUnicode_AsUTF8NoNUL(args[0]);
|
||||
if (arg == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(arg) != (size_t)arg_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
return_value = os__emscripten_log_impl(module, arg);
|
||||
|
||||
exit:
|
||||
@@ -13774,4 +13760,4 @@ exit:
|
||||
#ifndef OS__EMSCRIPTEN_LOG_METHODDEF
|
||||
#define OS__EMSCRIPTEN_LOG_METHODDEF
|
||||
#endif /* !defined(OS__EMSCRIPTEN_LOG_METHODDEF) */
|
||||
/*[clinic end generated code: output=38edcd9b6f56b729 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=f1113bf7c270d271 input=a9049054013a1b77]*/
|
||||
Generated
+7
-31
@@ -8,6 +8,7 @@ preserve
|
||||
#endif
|
||||
#include "pycore_long.h" // _PyLong_UnsignedLongLong_Converter()
|
||||
#include "pycore_modsupport.h" // _PyArg_CheckPositional()
|
||||
#include "pycore_unicodeobject.h" // _PyUnicode_AsUTF8NoNUL()
|
||||
|
||||
PyDoc_STRVAR(pyexpat_xmlparser_SetReparseDeferralEnabled__doc__,
|
||||
"SetReparseDeferralEnabled($self, enabled, /)\n"
|
||||
@@ -157,15 +158,10 @@ pyexpat_xmlparser_SetBase(PyObject *self, PyObject *arg)
|
||||
_PyArg_BadArgument("SetBase", "argument", "str", arg);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t base_length;
|
||||
base = PyUnicode_AsUTF8AndSize(arg, &base_length);
|
||||
base = _PyUnicode_AsUTF8NoNUL(arg);
|
||||
if (base == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(base) != (size_t)base_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
return_value = pyexpat_xmlparser_SetBase_impl((xmlparseobject *)self, base);
|
||||
|
||||
exit:
|
||||
@@ -272,15 +268,10 @@ pyexpat_xmlparser_ExternalEntityParserCreate(PyObject *self, PyTypeObject *cls,
|
||||
context = NULL;
|
||||
}
|
||||
else if (PyUnicode_Check(args[0])) {
|
||||
Py_ssize_t context_length;
|
||||
context = PyUnicode_AsUTF8AndSize(args[0], &context_length);
|
||||
context = _PyUnicode_AsUTF8NoNUL(args[0]);
|
||||
if (context == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(context) != (size_t)context_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_PyArg_BadArgument("ExternalEntityParserCreate", "argument 1", "str or None", args[0]);
|
||||
@@ -293,15 +284,10 @@ pyexpat_xmlparser_ExternalEntityParserCreate(PyObject *self, PyTypeObject *cls,
|
||||
_PyArg_BadArgument("ExternalEntityParserCreate", "argument 2", "str", args[1]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t encoding_length;
|
||||
encoding = PyUnicode_AsUTF8AndSize(args[1], &encoding_length);
|
||||
encoding = _PyUnicode_AsUTF8NoNUL(args[1]);
|
||||
if (encoding == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(encoding) != (size_t)encoding_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
skip_optional:
|
||||
return_value = pyexpat_xmlparser_ExternalEntityParserCreate_impl((xmlparseobject *)self, cls, context, encoding);
|
||||
|
||||
@@ -670,15 +656,10 @@ pyexpat_ParserCreate(PyObject *module, PyObject *const *args, Py_ssize_t nargs,
|
||||
encoding = NULL;
|
||||
}
|
||||
else if (PyUnicode_Check(args[0])) {
|
||||
Py_ssize_t encoding_length;
|
||||
encoding = PyUnicode_AsUTF8AndSize(args[0], &encoding_length);
|
||||
encoding = _PyUnicode_AsUTF8NoNUL(args[0]);
|
||||
if (encoding == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(encoding) != (size_t)encoding_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_PyArg_BadArgument("ParserCreate", "argument 'encoding'", "str or None", args[0]);
|
||||
@@ -693,15 +674,10 @@ pyexpat_ParserCreate(PyObject *module, PyObject *const *args, Py_ssize_t nargs,
|
||||
namespace_separator = NULL;
|
||||
}
|
||||
else if (PyUnicode_Check(args[1])) {
|
||||
Py_ssize_t namespace_separator_length;
|
||||
namespace_separator = PyUnicode_AsUTF8AndSize(args[1], &namespace_separator_length);
|
||||
namespace_separator = _PyUnicode_AsUTF8NoNUL(args[1]);
|
||||
if (namespace_separator == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(namespace_separator) != (size_t)namespace_separator_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_PyArg_BadArgument("ParserCreate", "argument 'namespace_separator'", "str or None", args[1]);
|
||||
@@ -766,4 +742,4 @@ exit:
|
||||
#ifndef PYEXPAT_XMLPARSER_SETALLOCTRACKERMAXIMUMAMPLIFICATION_METHODDEF
|
||||
#define PYEXPAT_XMLPARSER_SETALLOCTRACKERMAXIMUMAMPLIFICATION_METHODDEF
|
||||
#endif /* !defined(PYEXPAT_XMLPARSER_SETALLOCTRACKERMAXIMUMAMPLIFICATION_METHODDEF) */
|
||||
/*[clinic end generated code: output=6a2d0b0e35fd07fa input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=f1652fd212bce55f input=a9049054013a1b77]*/
|
||||
Generated
+8
-37
@@ -9,6 +9,7 @@ preserve
|
||||
#include "pycore_abstract.h" // _PyNumber_Index()
|
||||
#include "pycore_long.h" // _PyLong_UInt16_Converter()
|
||||
#include "pycore_modsupport.h" // _PyArg_CheckPositional()
|
||||
#include "pycore_unicodeobject.h" // _PyUnicode_AsUTF8NoNUL()
|
||||
|
||||
#if (defined(HAVE_ACCEPT) || defined(HAVE_ACCEPT4))
|
||||
|
||||
@@ -1485,15 +1486,10 @@ _socket_getservbyname(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
|
||||
_PyArg_BadArgument("getservbyname", "argument 1", "str", args[0]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t name_length;
|
||||
name = PyUnicode_AsUTF8AndSize(args[0], &name_length);
|
||||
name = _PyUnicode_AsUTF8NoNUL(args[0]);
|
||||
if (name == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(name) != (size_t)name_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
if (nargs < 2) {
|
||||
goto skip_optional;
|
||||
}
|
||||
@@ -1501,15 +1497,10 @@ _socket_getservbyname(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
|
||||
_PyArg_BadArgument("getservbyname", "argument 2", "str", args[1]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t proto_length;
|
||||
proto = PyUnicode_AsUTF8AndSize(args[1], &proto_length);
|
||||
proto = _PyUnicode_AsUTF8NoNUL(args[1]);
|
||||
if (proto == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(proto) != (size_t)proto_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
skip_optional:
|
||||
return_value = _socket_getservbyname_impl(module, name, proto);
|
||||
|
||||
@@ -1557,15 +1548,10 @@ _socket_getservbyport(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
|
||||
_PyArg_BadArgument("getservbyport", "argument 2", "str", args[1]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t proto_length;
|
||||
proto = PyUnicode_AsUTF8AndSize(args[1], &proto_length);
|
||||
proto = _PyUnicode_AsUTF8NoNUL(args[1]);
|
||||
if (proto == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(proto) != (size_t)proto_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
skip_optional:
|
||||
return_value = _socket_getservbyport_impl(module, port, proto);
|
||||
|
||||
@@ -1599,15 +1585,10 @@ _socket_getprotobyname(PyObject *module, PyObject *arg)
|
||||
_PyArg_BadArgument("getprotobyname", "argument", "str", arg);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t name_length;
|
||||
name = PyUnicode_AsUTF8AndSize(arg, &name_length);
|
||||
name = _PyUnicode_AsUTF8NoNUL(arg);
|
||||
if (name == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(name) != (size_t)name_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
return_value = _socket_getprotobyname_impl(module, name);
|
||||
|
||||
exit:
|
||||
@@ -1835,15 +1816,10 @@ _socket_inet_aton(PyObject *module, PyObject *arg)
|
||||
_PyArg_BadArgument("inet_aton", "argument", "str", arg);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t ip_addr_length;
|
||||
ip_addr = PyUnicode_AsUTF8AndSize(arg, &ip_addr_length);
|
||||
ip_addr = _PyUnicode_AsUTF8NoNUL(arg);
|
||||
if (ip_addr == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(ip_addr) != (size_t)ip_addr_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
return_value = _socket_inet_aton_impl(module, ip_addr);
|
||||
|
||||
exit:
|
||||
@@ -1920,15 +1896,10 @@ _socket_inet_pton(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
|
||||
_PyArg_BadArgument("inet_pton", "argument 2", "str", args[1]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t ip_length;
|
||||
ip = PyUnicode_AsUTF8AndSize(args[1], &ip_length);
|
||||
ip = _PyUnicode_AsUTF8NoNUL(args[1]);
|
||||
if (ip == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(ip) != (size_t)ip_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
return_value = _socket_inet_pton_impl(module, af, ip);
|
||||
|
||||
exit:
|
||||
@@ -2478,4 +2449,4 @@ exit:
|
||||
#ifndef _SOCKET_CMSG_SPACE_METHODDEF
|
||||
#define _SOCKET_CMSG_SPACE_METHODDEF
|
||||
#endif /* !defined(_SOCKET_CMSG_SPACE_METHODDEF) */
|
||||
/*[clinic end generated code: output=dfe0ca7c716c1183 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=bca43f33969d67ad input=a9049054013a1b77]*/
|
||||
Generated
+3
-7
@@ -7,6 +7,7 @@ preserve
|
||||
# include "pycore_runtime.h" // _Py_ID()
|
||||
#endif
|
||||
#include "pycore_modsupport.h" // _PyArg_UnpackKeywords()
|
||||
#include "pycore_unicodeobject.h" // _PyUnicode_AsUTF8NoNUL()
|
||||
|
||||
PyDoc_STRVAR(_symtable_symtable__doc__,
|
||||
"symtable($module, source, filename, startstr, /, *, module=None)\n"
|
||||
@@ -75,15 +76,10 @@ _symtable_symtable(PyObject *module, PyObject *const *args, Py_ssize_t nargs, Py
|
||||
_PyArg_BadArgument("symtable", "argument 3", "str", args[2]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t startstr_length;
|
||||
startstr = PyUnicode_AsUTF8AndSize(args[2], &startstr_length);
|
||||
startstr = _PyUnicode_AsUTF8NoNUL(args[2]);
|
||||
if (startstr == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(startstr) != (size_t)startstr_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
if (!noptargs) {
|
||||
goto skip_optional_kwonly;
|
||||
}
|
||||
@@ -97,4 +93,4 @@ exit:
|
||||
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=23523cada784726e input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=910e4f6ce98ae0a1 input=a9049054013a1b77]*/
|
||||
Generated
+3
-7
@@ -8,6 +8,7 @@ preserve
|
||||
#endif
|
||||
#include "pycore_critical_section.h"// Py_BEGIN_CRITICAL_SECTION()
|
||||
#include "pycore_modsupport.h" // _PyArg_UnpackKeywords()
|
||||
#include "pycore_unicodeobject.h" // _PyUnicode_AsUTF8NoNUL()
|
||||
|
||||
PyDoc_STRVAR(syslog_openlog__doc__,
|
||||
"openlog($module, /, ident=<unrepresentable>, logoption=0,\n"
|
||||
@@ -134,15 +135,10 @@ syslog_syslog(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
|
||||
_PyArg_BadArgument("syslog", "argument", "str", args[nargs - 1]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t message_length;
|
||||
message = PyUnicode_AsUTF8AndSize(args[nargs - 1], &message_length);
|
||||
message = _PyUnicode_AsUTF8NoNUL(args[nargs - 1]);
|
||||
if (message == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(message) != (size_t)message_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
Py_BEGIN_CRITICAL_SECTION(module);
|
||||
return_value = syslog_syslog_impl(module, group_left_1, priority, message);
|
||||
Py_END_CRITICAL_SECTION();
|
||||
@@ -273,4 +269,4 @@ syslog_LOG_UPTO(PyObject *module, PyObject *arg)
|
||||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=ab818466dcdbbe59 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=0c9607f279107505 input=a9049054013a1b77]*/
|
||||
Generated
+3
-7
@@ -3,6 +3,7 @@ preserve
|
||||
[clinic start generated code]*/
|
||||
|
||||
#include "pycore_modsupport.h" // _PyArg_CheckPositional()
|
||||
#include "pycore_unicodeobject.h" // _PyUnicode_AsUTF8NoNUL()
|
||||
|
||||
PyDoc_STRVAR(time_time__doc__,
|
||||
"time($module, /)\n"
|
||||
@@ -697,15 +698,10 @@ time_get_clock_info(PyObject *module, PyObject *arg)
|
||||
_PyArg_BadArgument("get_clock_info", "argument", "str", arg);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t name_length;
|
||||
name = PyUnicode_AsUTF8AndSize(arg, &name_length);
|
||||
name = _PyUnicode_AsUTF8NoNUL(arg);
|
||||
if (name == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(name) != (size_t)name_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
return_value = time_get_clock_info_impl(module, name);
|
||||
|
||||
exit:
|
||||
@@ -751,4 +747,4 @@ exit:
|
||||
#ifndef TIME_THREAD_TIME_NS_METHODDEF
|
||||
#define TIME_THREAD_TIME_NS_METHODDEF
|
||||
#endif /* !defined(TIME_THREAD_TIME_NS_METHODDEF) */
|
||||
/*[clinic end generated code: output=540a094cac69e0d4 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=d89be8cc2b2a7b05 input=a9049054013a1b77]*/
|
||||
Generated
+6
-25
@@ -9,6 +9,7 @@ preserve
|
||||
#include "pycore_abstract.h" // _PyNumber_Index()
|
||||
#include "pycore_critical_section.h"// Py_BEGIN_CRITICAL_SECTION()
|
||||
#include "pycore_modsupport.h" // _PyArg_UnpackKeywords()
|
||||
#include "pycore_unicodeobject.h" // _PyUnicode_AsUTF8NoNUL()
|
||||
|
||||
static int
|
||||
bytearray___init___impl(PyByteArrayObject *self, PyObject *arg,
|
||||
@@ -72,15 +73,10 @@ bytearray___init__(PyObject *self, PyObject *args, PyObject *kwargs)
|
||||
_PyArg_BadArgument("bytearray", "argument 'encoding'", "str", fastargs[1]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t encoding_length;
|
||||
encoding = PyUnicode_AsUTF8AndSize(fastargs[1], &encoding_length);
|
||||
encoding = _PyUnicode_AsUTF8NoNUL(fastargs[1]);
|
||||
if (encoding == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(encoding) != (size_t)encoding_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
if (!--noptargs) {
|
||||
goto skip_optional_pos;
|
||||
}
|
||||
@@ -89,15 +85,10 @@ bytearray___init__(PyObject *self, PyObject *args, PyObject *kwargs)
|
||||
_PyArg_BadArgument("bytearray", "argument 'errors'", "str", fastargs[2]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t errors_length;
|
||||
errors = PyUnicode_AsUTF8AndSize(fastargs[2], &errors_length);
|
||||
errors = _PyUnicode_AsUTF8NoNUL(fastargs[2]);
|
||||
if (errors == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(errors) != (size_t)errors_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
skip_optional_pos:
|
||||
return_value = bytearray___init___impl((PyByteArrayObject *)self, arg, encoding, errors);
|
||||
|
||||
@@ -1542,15 +1533,10 @@ bytearray_decode(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObje
|
||||
_PyArg_BadArgument("decode", "argument 'encoding'", "str", args[0]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t encoding_length;
|
||||
encoding = PyUnicode_AsUTF8AndSize(args[0], &encoding_length);
|
||||
encoding = _PyUnicode_AsUTF8NoNUL(args[0]);
|
||||
if (encoding == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(encoding) != (size_t)encoding_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
if (!--noptargs) {
|
||||
goto skip_optional_pos;
|
||||
}
|
||||
@@ -1559,15 +1545,10 @@ bytearray_decode(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObje
|
||||
_PyArg_BadArgument("decode", "argument 'errors'", "str", args[1]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t errors_length;
|
||||
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
|
||||
errors = _PyUnicode_AsUTF8NoNUL(args[1]);
|
||||
if (errors == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(errors) != (size_t)errors_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
skip_optional_pos:
|
||||
Py_BEGIN_CRITICAL_SECTION(self);
|
||||
return_value = bytearray_decode_impl((PyByteArrayObject *)self, encoding, errors);
|
||||
@@ -1882,4 +1863,4 @@ bytearray_sizeof(PyObject *self, PyObject *Py_UNUSED(ignored))
|
||||
{
|
||||
return bytearray_sizeof_impl((PyByteArrayObject *)self);
|
||||
}
|
||||
/*[clinic end generated code: output=6dc315d35de3e670 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=16fb40de6aefa5f8 input=a9049054013a1b77]*/
|
||||
Generated
+6
-25
@@ -8,6 +8,7 @@ preserve
|
||||
#endif
|
||||
#include "pycore_abstract.h" // _PyNumber_Index()
|
||||
#include "pycore_modsupport.h" // _PyArg_UnpackKeywords()
|
||||
#include "pycore_unicodeobject.h" // _PyUnicode_AsUTF8NoNUL()
|
||||
|
||||
PyDoc_STRVAR(bytes___bytes____doc__,
|
||||
"__bytes__($self, /)\n"
|
||||
@@ -1136,15 +1137,10 @@ bytes_decode(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *
|
||||
_PyArg_BadArgument("decode", "argument 'encoding'", "str", args[0]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t encoding_length;
|
||||
encoding = PyUnicode_AsUTF8AndSize(args[0], &encoding_length);
|
||||
encoding = _PyUnicode_AsUTF8NoNUL(args[0]);
|
||||
if (encoding == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(encoding) != (size_t)encoding_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
if (!--noptargs) {
|
||||
goto skip_optional_pos;
|
||||
}
|
||||
@@ -1153,15 +1149,10 @@ bytes_decode(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *
|
||||
_PyArg_BadArgument("decode", "argument 'errors'", "str", args[1]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t errors_length;
|
||||
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
|
||||
errors = _PyUnicode_AsUTF8NoNUL(args[1]);
|
||||
if (errors == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(errors) != (size_t)errors_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
skip_optional_pos:
|
||||
return_value = bytes_decode_impl((PyBytesObject *)self, encoding, errors);
|
||||
|
||||
@@ -1423,15 +1414,10 @@ bytes_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
|
||||
_PyArg_BadArgument("bytes", "argument 'encoding'", "str", fastargs[1]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t encoding_length;
|
||||
encoding = PyUnicode_AsUTF8AndSize(fastargs[1], &encoding_length);
|
||||
encoding = _PyUnicode_AsUTF8NoNUL(fastargs[1]);
|
||||
if (encoding == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(encoding) != (size_t)encoding_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
if (!--noptargs) {
|
||||
goto skip_optional_pos;
|
||||
}
|
||||
@@ -1440,19 +1426,14 @@ bytes_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
|
||||
_PyArg_BadArgument("bytes", "argument 'errors'", "str", fastargs[2]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t errors_length;
|
||||
errors = PyUnicode_AsUTF8AndSize(fastargs[2], &errors_length);
|
||||
errors = _PyUnicode_AsUTF8NoNUL(fastargs[2]);
|
||||
if (errors == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(errors) != (size_t)errors_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
skip_optional_pos:
|
||||
return_value = bytes_new_impl(type, x, encoding, errors);
|
||||
|
||||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=c20458db7a2123db input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=2de57d656cc2f041 input=a9049054013a1b77]*/
|
||||
Generated
+3
-7
@@ -3,6 +3,7 @@ preserve
|
||||
[clinic start generated code]*/
|
||||
|
||||
#include "pycore_modsupport.h" // _PyArg_CheckPositional()
|
||||
#include "pycore_unicodeobject.h" // _PyUnicode_AsUTF8NoNUL()
|
||||
|
||||
PyDoc_STRVAR(float_is_integer__doc__,
|
||||
"is_integer($self, /)\n"
|
||||
@@ -310,15 +311,10 @@ float___getformat__(PyObject *type, PyObject *arg)
|
||||
_PyArg_BadArgument("__getformat__", "argument", "str", arg);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t typestr_length;
|
||||
typestr = PyUnicode_AsUTF8AndSize(arg, &typestr_length);
|
||||
typestr = _PyUnicode_AsUTF8NoNUL(arg);
|
||||
if (typestr == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(typestr) != (size_t)typestr_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
return_value = float___getformat___impl((PyTypeObject *)type, typestr);
|
||||
|
||||
exit:
|
||||
@@ -353,4 +349,4 @@ float___format__(PyObject *self, PyObject *arg)
|
||||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=5d7b0bf9e47ff997 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=e0ffc05aa7fc4b10 input=a9049054013a1b77]*/
|
||||
Generated
+3
-7
@@ -8,6 +8,7 @@ preserve
|
||||
#endif
|
||||
#include "pycore_abstract.h" // _PyNumber_Index()
|
||||
#include "pycore_modsupport.h" // _PyArg_UnpackKeywords()
|
||||
#include "pycore_unicodeobject.h" // _PyUnicode_AsUTF8NoNUL()
|
||||
|
||||
PyDoc_STRVAR(memoryview__doc__,
|
||||
"memoryview(object)\n"
|
||||
@@ -373,15 +374,10 @@ memoryview_tobytes(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyOb
|
||||
order = NULL;
|
||||
}
|
||||
else if (PyUnicode_Check(args[0])) {
|
||||
Py_ssize_t order_length;
|
||||
order = PyUnicode_AsUTF8AndSize(args[0], &order_length);
|
||||
order = _PyUnicode_AsUTF8NoNUL(args[0]);
|
||||
if (order == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(order) != (size_t)order_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_PyArg_BadArgument("tobytes", "argument 'order'", "str or None", args[0]);
|
||||
@@ -560,4 +556,4 @@ skip_optional:
|
||||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=a597307395a568ef input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=889b7cc1a94bfc9b input=a9049054013a1b77]*/
|
||||
Generated
+6
-25
@@ -8,6 +8,7 @@ preserve
|
||||
#endif
|
||||
#include "pycore_abstract.h" // _PyNumber_Index()
|
||||
#include "pycore_modsupport.h" // _PyArg_CheckPositional()
|
||||
#include "pycore_unicodeobject.h" // _PyUnicode_AsUTF8NoNUL()
|
||||
|
||||
PyDoc_STRVAR(EncodingMap_size__doc__,
|
||||
"size($self, /)\n"
|
||||
@@ -263,15 +264,10 @@ unicode_encode(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject
|
||||
_PyArg_BadArgument("encode", "argument 'encoding'", "str", args[0]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t encoding_length;
|
||||
encoding = PyUnicode_AsUTF8AndSize(args[0], &encoding_length);
|
||||
encoding = _PyUnicode_AsUTF8NoNUL(args[0]);
|
||||
if (encoding == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(encoding) != (size_t)encoding_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
if (!--noptargs) {
|
||||
goto skip_optional_pos;
|
||||
}
|
||||
@@ -280,15 +276,10 @@ unicode_encode(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject
|
||||
_PyArg_BadArgument("encode", "argument 'errors'", "str", args[1]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t errors_length;
|
||||
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
|
||||
errors = _PyUnicode_AsUTF8NoNUL(args[1]);
|
||||
if (errors == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(errors) != (size_t)errors_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
skip_optional_pos:
|
||||
return_value = unicode_encode_impl(self, encoding, errors);
|
||||
|
||||
@@ -1884,15 +1875,10 @@ unicode_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
|
||||
_PyArg_BadArgument("str", "argument 'encoding'", "str", fastargs[1]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t encoding_length;
|
||||
encoding = PyUnicode_AsUTF8AndSize(fastargs[1], &encoding_length);
|
||||
encoding = _PyUnicode_AsUTF8NoNUL(fastargs[1]);
|
||||
if (encoding == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(encoding) != (size_t)encoding_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
if (!--noptargs) {
|
||||
goto skip_optional_pos;
|
||||
}
|
||||
@@ -1901,19 +1887,14 @@ unicode_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
|
||||
_PyArg_BadArgument("str", "argument 'errors'", "str", fastargs[2]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t errors_length;
|
||||
errors = PyUnicode_AsUTF8AndSize(fastargs[2], &errors_length);
|
||||
errors = _PyUnicode_AsUTF8NoNUL(fastargs[2]);
|
||||
if (errors == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(errors) != (size_t)errors_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
skip_optional_pos:
|
||||
return_value = unicode_new_impl(type, x, encoding, errors);
|
||||
|
||||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=9d243c63e951e31d input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=80d039a395f835c3 input=a9049054013a1b77]*/
|
||||
Generated
+3
-7
@@ -7,6 +7,7 @@ preserve
|
||||
# include "pycore_runtime.h" // _Py_ID()
|
||||
#endif
|
||||
#include "pycore_modsupport.h" // _PyArg_UnpackKeywords()
|
||||
#include "pycore_unicodeobject.h" // _PyUnicode_AsUTF8NoNUL()
|
||||
|
||||
static PyObject *
|
||||
tokenizeriter_new_impl(PyTypeObject *type, PyObject *readline,
|
||||
@@ -68,19 +69,14 @@ tokenizeriter_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
|
||||
_PyArg_BadArgument("tokenizeriter", "argument 'encoding'", "str", fastargs[2]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t encoding_length;
|
||||
encoding = PyUnicode_AsUTF8AndSize(fastargs[2], &encoding_length);
|
||||
encoding = _PyUnicode_AsUTF8NoNUL(fastargs[2]);
|
||||
if (encoding == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(encoding) != (size_t)encoding_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
skip_optional_kwonly:
|
||||
return_value = tokenizeriter_new_impl(type, readline, extra_tokens, encoding);
|
||||
|
||||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=4c448f34d9c835c0 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=f9091945b96e09b7 input=a9049054013a1b77]*/
|
||||
Generated
+3
-7
@@ -7,6 +7,7 @@ preserve
|
||||
# include "pycore_runtime.h" // _Py_ID()
|
||||
#endif
|
||||
#include "pycore_modsupport.h" // _PyArg_UnpackKeywords()
|
||||
#include "pycore_unicodeobject.h" // _PyUnicode_AsUTF8NoNUL()
|
||||
|
||||
PyDoc_STRVAR(builtin___import____doc__,
|
||||
"__import__($module, /, name, globals=None, locals=None, fromlist=(),\n"
|
||||
@@ -415,15 +416,10 @@ builtin_compile(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
|
||||
_PyArg_BadArgument("compile", "argument 'mode'", "str", args[2]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t mode_length;
|
||||
mode = PyUnicode_AsUTF8AndSize(args[2], &mode_length);
|
||||
mode = _PyUnicode_AsUTF8NoNUL(args[2]);
|
||||
if (mode == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(mode) != (size_t)mode_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
if (!noptargs) {
|
||||
goto skip_optional_pos;
|
||||
}
|
||||
@@ -1579,4 +1575,4 @@ builtin_issubclass(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
|
||||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=2454c3867f2a73f3 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=ac4800dc25f87f6e input=a9049054013a1b77]*/
|
||||
Generated
+4
-13
@@ -7,6 +7,7 @@ preserve
|
||||
# include "pycore_runtime.h" // _Py_ID()
|
||||
#endif
|
||||
#include "pycore_modsupport.h" // _PyArg_UnpackKeywords()
|
||||
#include "pycore_unicodeobject.h" // _PyUnicode_AsUTF8NoNUL()
|
||||
|
||||
PyDoc_STRVAR(sys_addaudithook__doc__,
|
||||
"addaudithook($module, /, hook)\n"
|
||||
@@ -92,15 +93,10 @@ sys_audit(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
|
||||
_PyArg_BadArgument("audit", "argument 1", "str", args[0]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t event_length;
|
||||
event = PyUnicode_AsUTF8AndSize(args[0], &event_length);
|
||||
event = _PyUnicode_AsUTF8NoNUL(args[0]);
|
||||
if (event == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(event) != (size_t)event_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
__clinic_args = PyTuple_FromArray(args + 1, nargs - 1);
|
||||
if (__clinic_args == NULL) {
|
||||
goto exit;
|
||||
@@ -1575,15 +1571,10 @@ sys_activate_stack_trampoline(PyObject *module, PyObject *arg)
|
||||
_PyArg_BadArgument("activate_stack_trampoline", "argument", "str", arg);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t backend_length;
|
||||
backend = PyUnicode_AsUTF8AndSize(arg, &backend_length);
|
||||
backend = _PyUnicode_AsUTF8NoNUL(arg);
|
||||
if (backend == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
if (strlen(backend) != (size_t)backend_length) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}
|
||||
return_value = sys_activate_stack_trampoline_impl(module, backend);
|
||||
|
||||
exit:
|
||||
@@ -2226,4 +2217,4 @@ exit:
|
||||
#ifndef SYS_GETANDROIDAPILEVEL_METHODDEF
|
||||
#define SYS_GETANDROIDAPILEVEL_METHODDEF
|
||||
#endif /* !defined(SYS_GETANDROIDAPILEVEL_METHODDEF) */
|
||||
/*[clinic end generated code: output=0de5ea347ec24d8a input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=dbca81c5072bd0e8 input=a9049054013a1b77]*/
|
||||
@@ -4,6 +4,7 @@ import sys
|
||||
from types import NoneType
|
||||
from typing import Any
|
||||
|
||||
import libclinic
|
||||
from libclinic import fail, NullType, unspecified, NULL, c_bytes_repr, c_unichar_repr
|
||||
from libclinic.function import (
|
||||
Function, Parameter,
|
||||
@@ -835,12 +836,13 @@ class str_converter(CConverter):
|
||||
return ""
|
||||
|
||||
def parse_arg(self, argname: str, displayname: str, *, limited_capi: bool) -> str | None:
|
||||
if self.format_unit == 's':
|
||||
return self.format_code("""
|
||||
if (!PyUnicode_Check({argname})) {{{{
|
||||
{bad_argument}
|
||||
goto exit;
|
||||
}}}}
|
||||
if self.format_unit not in ('s', 'z'):
|
||||
return super().parse_arg(argname, displayname, limited_capi=limited_capi)
|
||||
|
||||
# Decode a value already known to be a str. Shared by 's' and 'z',
|
||||
# which differ only in whether None is also accepted.
|
||||
if limited_capi:
|
||||
decode = """
|
||||
Py_ssize_t {length_name};
|
||||
{paramname} = PyUnicode_AsUTF8AndSize({argname}, &{length_name});
|
||||
if ({paramname} == NULL) {{{{
|
||||
@@ -850,35 +852,52 @@ class str_converter(CConverter):
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}}}}
|
||||
""",
|
||||
argname=argname,
|
||||
bad_argument=self.bad_argument(displayname, 'str', limited_capi=limited_capi),
|
||||
length_name=self.length_name)
|
||||
"""
|
||||
else:
|
||||
# _PyUnicode_AsUTF8NoNUL() is the same code, but its Py_ssize_t
|
||||
# stays in the callee's frame. An address-taken local here would
|
||||
# give every generated parser a stack protector canary.
|
||||
self.add_include('pycore_unicodeobject.h',
|
||||
'_PyUnicode_AsUTF8NoNUL()')
|
||||
decode = """
|
||||
{paramname} = _PyUnicode_AsUTF8NoNUL({argname});
|
||||
if ({paramname} == NULL) {{{{
|
||||
goto exit;
|
||||
}}}}
|
||||
"""
|
||||
|
||||
if self.format_unit == 'z':
|
||||
return self.format_code("""
|
||||
expected = 'str or None'
|
||||
code = """
|
||||
if ({argname} == Py_None) {{{{
|
||||
{paramname} = NULL;
|
||||
}}}}
|
||||
else if (PyUnicode_Check({argname})) {{{{
|
||||
Py_ssize_t {length_name};
|
||||
{paramname} = PyUnicode_AsUTF8AndSize({argname}, &{length_name});
|
||||
if ({paramname} == NULL) {{{{
|
||||
goto exit;
|
||||
}}}}
|
||||
if (strlen({paramname}) != (size_t){length_name}) {{{{
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
goto exit;
|
||||
}}}}
|
||||
{decode}
|
||||
}}}}
|
||||
else {{{{
|
||||
{bad_argument}
|
||||
goto exit;
|
||||
}}}}
|
||||
""",
|
||||
argname=argname,
|
||||
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)
|
||||
"""
|
||||
else:
|
||||
expected = 'str'
|
||||
code = """
|
||||
if (!PyUnicode_Check({argname})) {{{{
|
||||
{bad_argument}
|
||||
goto exit;
|
||||
}}}}
|
||||
{decode}
|
||||
"""
|
||||
|
||||
return self.format_code(
|
||||
libclinic.linear_format(
|
||||
libclinic.normalize_snippet(code),
|
||||
decode=libclinic.normalize_snippet(decode)),
|
||||
argname=argname,
|
||||
bad_argument=self.bad_argument(displayname, expected,
|
||||
limited_capi=limited_capi),
|
||||
length_name=self.length_name)
|
||||
|
||||
#
|
||||
# This is the fourth or fifth rewrite of registering all the
|
||||
|
||||
Reference in new issue
Block a user