mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
GH-78724: Initialize struct.Struct in __new__ (GH-94532)
Closes https://github.com/python/cpython/issues/75960 Closes https://github.com/python/cpython/issues/78724
This commit is contained in:
parent
f5f047aa62
commit
c8c0afc713
4 changed files with 49 additions and 41 deletions
16
Modules/clinic/_struct.c.h
generated
16
Modules/clinic/_struct.c.h
generated
|
|
@ -8,7 +8,7 @@ preserve
|
|||
#endif
|
||||
|
||||
|
||||
PyDoc_STRVAR(Struct___init____doc__,
|
||||
PyDoc_STRVAR(Struct__doc__,
|
||||
"Struct(format)\n"
|
||||
"--\n"
|
||||
"\n"
|
||||
|
|
@ -19,13 +19,13 @@ PyDoc_STRVAR(Struct___init____doc__,
|
|||
"\n"
|
||||
"See help(struct) for more on format strings.");
|
||||
|
||||
static int
|
||||
Struct___init___impl(PyStructObject *self, PyObject *format);
|
||||
static PyObject *
|
||||
Struct_impl(PyTypeObject *type, PyObject *format);
|
||||
|
||||
static int
|
||||
Struct___init__(PyObject *self, PyObject *args, PyObject *kwargs)
|
||||
static PyObject *
|
||||
Struct(PyTypeObject *type, PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
int return_value = -1;
|
||||
PyObject *return_value = NULL;
|
||||
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
|
||||
|
||||
#define NUM_KEYWORDS 1
|
||||
|
|
@ -61,7 +61,7 @@ Struct___init__(PyObject *self, PyObject *args, PyObject *kwargs)
|
|||
goto exit;
|
||||
}
|
||||
format = fastargs[0];
|
||||
return_value = Struct___init___impl((PyStructObject *)self, format);
|
||||
return_value = Struct_impl(type, format);
|
||||
|
||||
exit:
|
||||
return return_value;
|
||||
|
|
@ -451,4 +451,4 @@ exit:
|
|||
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=eca7df0e75f8919d input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=f3d6e06f80368998 input=a9049054013a1b77]*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue