Test_class_method_impl(PyTypeObject *type);
static PyObject *
-Test_class_method(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
+Test_class_method(PyObject *type, PyObject *Py_UNUSED(ignored))
{
- return Test_class_method_impl(type);
+ return Test_class_method_impl((PyTypeObject *)type);
}
static PyObject *
Test_class_method_impl(PyTypeObject *type)
-/*[clinic end generated code: output=47fb7ecca1abcaaa input=43bc4a0494547b80]*/
+/*[clinic end generated code: output=64f93e6252bde409 input=43bc4a0494547b80]*/
/*[clinic input]
[clinic start generated code]*/
static PyObject *
-datetime_date_fromtimestamp(PyTypeObject *type, PyObject *timestamp)
-/*[clinic end generated code: output=fd045fda58168869 input=eabb3fe7f40491fe]*/
+datetime_date_fromtimestamp_impl(PyTypeObject *type, PyObject *timestamp)
+/*[clinic end generated code: output=59def4e32c028fb6 input=eabb3fe7f40491fe]*/
{
return date_fromtimestamp((PyObject *) type, timestamp);
}
const char *name);
static PyObject *
-_multiprocessing_SemLock__rebuild(PyTypeObject *type, PyObject *const *args, Py_ssize_t nargs)
+_multiprocessing_SemLock__rebuild(PyObject *type, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
SEM_HANDLE handle;
&handle, &kind, &maxvalue, &name)) {
goto exit;
}
- return_value = _multiprocessing_SemLock__rebuild_impl(type, handle, kind, maxvalue, name);
+ return_value = _multiprocessing_SemLock__rebuild_impl((PyTypeObject *)type, handle, kind, maxvalue, name);
exit:
return return_value;
#ifndef _MULTIPROCESSING_SEMLOCK___EXIT___METHODDEF
#define _MULTIPROCESSING_SEMLOCK___EXIT___METHODDEF
#endif /* !defined(_MULTIPROCESSING_SEMLOCK___EXIT___METHODDEF) */
-/*[clinic end generated code: output=e28d0fdbfefd1235 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=dddd8e989525f565 input=a9049054013a1b77]*/
#define DATETIME_DATE_FROMTIMESTAMP_METHODDEF \
{"fromtimestamp", (PyCFunction)datetime_date_fromtimestamp, METH_O|METH_CLASS, datetime_date_fromtimestamp__doc__},
+static PyObject *
+datetime_date_fromtimestamp_impl(PyTypeObject *type, PyObject *timestamp);
+
+static PyObject *
+datetime_date_fromtimestamp(PyObject *type, PyObject *timestamp)
+{
+ PyObject *return_value = NULL;
+
+ return_value = datetime_date_fromtimestamp_impl((PyTypeObject *)type, timestamp);
+
+ return return_value;
+}
+
static PyObject *
iso_calendar_date_new_impl(PyTypeObject *type, int year, int week,
int weekday);
datetime_datetime_now_impl(PyTypeObject *type, PyObject *tz);
static PyObject *
-datetime_datetime_now(PyTypeObject *type, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
+datetime_datetime_now(PyObject *type, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
}
tz = args[0];
skip_optional_pos:
- return_value = datetime_datetime_now_impl(type, tz);
+ return_value = datetime_datetime_now_impl((PyTypeObject *)type, tz);
exit:
return return_value;
exit:
return return_value;
}
-/*[clinic end generated code: output=8acf62fbc7328f79 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=7b55f2d9a4596b58 input=a9049054013a1b77]*/
PyObject *file_obj, PyObject *key);
static PyObject *
-zoneinfo_ZoneInfo_from_file(PyTypeObject *type, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
+zoneinfo_ZoneInfo_from_file(PyObject *type, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
}
key = args[1];
skip_optional_pos:
- return_value = zoneinfo_ZoneInfo_from_file_impl(type, cls, file_obj, key);
+ return_value = zoneinfo_ZoneInfo_from_file_impl((PyTypeObject *)type, cls, file_obj, key);
exit:
return return_value;
PyObject *key);
static PyObject *
-zoneinfo_ZoneInfo_no_cache(PyTypeObject *type, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
+zoneinfo_ZoneInfo_no_cache(PyObject *type, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
goto exit;
}
key = args[0];
- return_value = zoneinfo_ZoneInfo_no_cache_impl(type, cls, key);
+ return_value = zoneinfo_ZoneInfo_no_cache_impl((PyTypeObject *)type, cls, key);
exit:
return return_value;
PyObject *only_keys);
static PyObject *
-zoneinfo_ZoneInfo_clear_cache(PyTypeObject *type, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
+zoneinfo_ZoneInfo_clear_cache(PyObject *type, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
only_keys = args[0];
skip_optional_kwonly:
Py_BEGIN_CRITICAL_SECTION(type);
- return_value = zoneinfo_ZoneInfo_clear_cache_impl(type, cls, only_keys);
+ return_value = zoneinfo_ZoneInfo_clear_cache_impl((PyTypeObject *)type, cls, only_keys);
Py_END_CRITICAL_SECTION();
exit:
PyObject *key, unsigned char from_cache);
static PyObject *
-zoneinfo_ZoneInfo__unpickle(PyTypeObject *type, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
+zoneinfo_ZoneInfo__unpickle(PyObject *type, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
from_cache = (unsigned char) ival;
}
}
- return_value = zoneinfo_ZoneInfo__unpickle_impl(type, cls, key, from_cache);
+ return_value = zoneinfo_ZoneInfo__unpickle_impl((PyTypeObject *)type, cls, key, from_cache);
exit:
return return_value;
}
-/*[clinic end generated code: output=f8a4fb4ff634d6c9 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=786e8579e58c2f1c input=a9049054013a1b77]*/
#define ITERTOOLS_CHAIN_FROM_ITERABLE_METHODDEF \
{"from_iterable", (PyCFunction)itertools_chain_from_iterable, METH_O|METH_CLASS, itertools_chain_from_iterable__doc__},
+static PyObject *
+itertools_chain_from_iterable_impl(PyTypeObject *type, PyObject *arg);
+
+static PyObject *
+itertools_chain_from_iterable(PyObject *type, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+
+ return_value = itertools_chain_from_iterable_impl((PyTypeObject *)type, arg);
+
+ return return_value;
+}
+
PyDoc_STRVAR(itertools_combinations__doc__,
"combinations(iterable, r)\n"
"--\n"
exit:
return return_value;
}
-/*[clinic end generated code: output=199eeac2d17e8f23 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=688855b1dc77bf5a input=a9049054013a1b77]*/
select_epoll_fromfd_impl(PyTypeObject *type, int fd);
static PyObject *
-select_epoll_fromfd(PyTypeObject *type, PyObject *arg)
+select_epoll_fromfd(PyObject *type, PyObject *arg)
{
PyObject *return_value = NULL;
int fd;
if (fd == -1 && PyErr_Occurred()) {
goto exit;
}
- return_value = select_epoll_fromfd_impl(type, fd);
+ return_value = select_epoll_fromfd_impl((PyTypeObject *)type, fd);
exit:
return return_value;
select_kqueue_fromfd_impl(PyTypeObject *type, int fd);
static PyObject *
-select_kqueue_fromfd(PyTypeObject *type, PyObject *arg)
+select_kqueue_fromfd(PyObject *type, PyObject *arg)
{
PyObject *return_value = NULL;
int fd;
if (fd == -1 && PyErr_Occurred()) {
goto exit;
}
- return_value = select_kqueue_fromfd_impl(type, fd);
+ return_value = select_kqueue_fromfd_impl((PyTypeObject *)type, fd);
exit:
return return_value;
#ifndef SELECT_KQUEUE_CONTROL_METHODDEF
#define SELECT_KQUEUE_CONTROL_METHODDEF
#endif /* !defined(SELECT_KQUEUE_CONTROL_METHODDEF) */
-/*[clinic end generated code: output=c18fd93efc5f4dce input=a9049054013a1b77]*/
+/*[clinic end generated code: output=60c3edb2745c9f33 input=a9049054013a1b77]*/
[clinic start generated code]*/
static PyObject *
-itertools_chain_from_iterable(PyTypeObject *type, PyObject *arg)
-/*[clinic end generated code: output=667ae7a7f7b68654 input=72c39e3a2ca3be85]*/
+itertools_chain_from_iterable_impl(PyTypeObject *type, PyObject *arg)
+/*[clinic end generated code: output=3d7ea7d46b9e43f5 input=72c39e3a2ca3be85]*/
{
PyObject *source;
[clinic start generated code]*/
static PyObject *
-bytearray_fromhex(PyTypeObject *type, PyObject *string)
-/*[clinic end generated code: output=da84dc708e9c4b36 input=7e314e5b2d7ab484]*/
+bytearray_fromhex_impl(PyTypeObject *type, PyObject *string)
+/*[clinic end generated code: output=8f0f0b6d30fb3ba0 input=7e314e5b2d7ab484]*/
{
PyObject *result = _PyBytes_FromHex(string, type == &PyByteArray_Type);
if (type != &PyByteArray_Type && result != NULL) {
[clinic start generated code]*/
static PyObject *
-bytes_fromhex(PyTypeObject *type, PyObject *string)
-/*[clinic end generated code: output=d458ec88195da6b3 input=f37d98ed51088a21]*/
+bytes_fromhex_impl(PyTypeObject *type, PyObject *string)
+/*[clinic end generated code: output=0973acc63661bb2e input=f37d98ed51088a21]*/
{
PyObject *result = _PyBytes_FromHex(string, 0);
if (type != &PyBytes_Type && result != NULL) {
#define BYTEARRAY_FROMHEX_METHODDEF \
{"fromhex", (PyCFunction)bytearray_fromhex, METH_O|METH_CLASS, bytearray_fromhex__doc__},
+static PyObject *
+bytearray_fromhex_impl(PyTypeObject *type, PyObject *string);
+
+static PyObject *
+bytearray_fromhex(PyObject *type, PyObject *string)
+{
+ PyObject *return_value = NULL;
+
+ return_value = bytearray_fromhex_impl((PyTypeObject *)type, string);
+
+ return return_value;
+}
+
PyDoc_STRVAR(bytearray_hex__doc__,
"hex($self, /, sep=<unrepresentable>, bytes_per_sep=1)\n"
"--\n"
{
return bytearray_sizeof_impl((PyByteArrayObject *)self);
}
-/*[clinic end generated code: output=13a4231325b7d3c1 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=b1dce6c12ad1a9e2 input=a9049054013a1b77]*/
#define BYTES_FROMHEX_METHODDEF \
{"fromhex", (PyCFunction)bytes_fromhex, METH_O|METH_CLASS, bytes_fromhex__doc__},
+static PyObject *
+bytes_fromhex_impl(PyTypeObject *type, PyObject *string);
+
+static PyObject *
+bytes_fromhex(PyObject *type, PyObject *string)
+{
+ PyObject *return_value = NULL;
+
+ return_value = bytes_fromhex_impl((PyTypeObject *)type, string);
+
+ return return_value;
+}
+
PyDoc_STRVAR(bytes_hex__doc__,
"hex($self, /, sep=<unrepresentable>, bytes_per_sep=1)\n"
"--\n"
exit:
return return_value;
}
-/*[clinic end generated code: output=967aae4b46423586 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=60d6a9f1333b76f0 input=a9049054013a1b77]*/
#define COMPLEX_FROM_NUMBER_METHODDEF \
{"from_number", (PyCFunction)complex_from_number, METH_O|METH_CLASS, complex_from_number__doc__},
-/*[clinic end generated code: output=252cddef7f9169a0 input=a9049054013a1b77]*/
+
+static PyObject *
+complex_from_number_impl(PyTypeObject *type, PyObject *number);
+
+static PyObject *
+complex_from_number(PyObject *type, PyObject *number)
+{
+ PyObject *return_value = NULL;
+
+ return_value = complex_from_number_impl((PyTypeObject *)type, number);
+
+ return return_value;
+}
+/*[clinic end generated code: output=307531cd6d6e7544 input=a9049054013a1b77]*/
dict_fromkeys_impl(PyTypeObject *type, PyObject *iterable, PyObject *value);
static PyObject *
-dict_fromkeys(PyTypeObject *type, PyObject *const *args, Py_ssize_t nargs)
+dict_fromkeys(PyObject *type, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
PyObject *iterable;
}
value = args[1];
skip_optional:
- return_value = dict_fromkeys_impl(type, iterable, value);
+ return_value = dict_fromkeys_impl((PyTypeObject *)type, iterable, value);
exit:
return return_value;
{
return dict_values_impl((PyDictObject *)self);
}
-/*[clinic end generated code: output=8a104741e4676c76 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=9007b74432217017 input=a9049054013a1b77]*/
#define FLOAT_FROMHEX_METHODDEF \
{"fromhex", (PyCFunction)float_fromhex, METH_O|METH_CLASS, float_fromhex__doc__},
+static PyObject *
+float_fromhex_impl(PyTypeObject *type, PyObject *string);
+
+static PyObject *
+float_fromhex(PyObject *type, PyObject *string)
+{
+ PyObject *return_value = NULL;
+
+ return_value = float_fromhex_impl((PyTypeObject *)type, string);
+
+ return return_value;
+}
+
PyDoc_STRVAR(float_as_integer_ratio__doc__,
"as_integer_ratio($self, /)\n"
"--\n"
#define FLOAT_FROM_NUMBER_METHODDEF \
{"from_number", (PyCFunction)float_from_number, METH_O|METH_CLASS, float_from_number__doc__},
+static PyObject *
+float_from_number_impl(PyTypeObject *type, PyObject *number);
+
+static PyObject *
+float_from_number(PyObject *type, PyObject *number)
+{
+ PyObject *return_value = NULL;
+
+ return_value = float_from_number_impl((PyTypeObject *)type, number);
+
+ return return_value;
+}
+
PyDoc_STRVAR(float___getnewargs____doc__,
"__getnewargs__($self, /)\n"
"--\n"
float___getformat___impl(PyTypeObject *type, const char *typestr);
static PyObject *
-float___getformat__(PyTypeObject *type, PyObject *arg)
+float___getformat__(PyObject *type, PyObject *arg)
{
PyObject *return_value = NULL;
const char *typestr;
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
- return_value = float___getformat___impl(type, typestr);
+ return_value = float___getformat___impl((PyTypeObject *)type, typestr);
exit:
return return_value;
exit:
return return_value;
}
-/*[clinic end generated code: output=366cea9463cc5bf6 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=927035897ea3573f input=a9049054013a1b77]*/
PyObject *byteorder, int is_signed);
static PyObject *
-int_from_bytes(PyTypeObject *type, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
+int_from_bytes(PyObject *type, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
goto exit;
}
skip_optional_kwonly:
- return_value = int_from_bytes_impl(type, bytes_obj, byteorder, is_signed);
+ return_value = int_from_bytes_impl((PyTypeObject *)type, bytes_obj, byteorder, is_signed);
exit:
return return_value;
{
return int_is_integer_impl(self);
}
-/*[clinic end generated code: output=fb96bd642a643f75 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=591cffa2b80b5184 input=a9049054013a1b77]*/
memoryview__from_flags_impl(PyTypeObject *type, PyObject *object, int flags);
static PyObject *
-memoryview__from_flags(PyTypeObject *type, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
+memoryview__from_flags(PyObject *type, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
if (flags == -1 && PyErr_Occurred()) {
goto exit;
}
- return_value = memoryview__from_flags_impl(type, object, flags);
+ return_value = memoryview__from_flags_impl((PyTypeObject *)type, object, flags);
exit:
return return_value;
exit:
return return_value;
}
-/*[clinic end generated code: output=c0371164b68a6839 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=ae3414e9311c02fb input=a9049054013a1b77]*/
OrderedDict_fromkeys_impl(PyTypeObject *type, PyObject *seq, PyObject *value);
static PyObject *
-OrderedDict_fromkeys(PyTypeObject *type, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
+OrderedDict_fromkeys(PyObject *type, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
}
value = args[1];
skip_optional_pos:
- return_value = OrderedDict_fromkeys_impl(type, seq, value);
+ return_value = OrderedDict_fromkeys_impl((PyTypeObject *)type, seq, value);
exit:
return return_value;
exit:
return return_value;
}
-/*[clinic end generated code: output=55bd390bb516e997 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=6f84d0649fcd0c1f input=a9049054013a1b77]*/
[clinic start generated code]*/
static PyObject *
-complex_from_number(PyTypeObject *type, PyObject *number)
-/*[clinic end generated code: output=658a7a5fb0de074d input=3f8bdd3a2bc3facd]*/
+complex_from_number_impl(PyTypeObject *type, PyObject *number)
+/*[clinic end generated code: output=7248bb593e1871e1 input=3f8bdd3a2bc3facd]*/
{
if (PyComplex_CheckExact(number) && type == &PyComplex_Type) {
Py_INCREF(number);
[clinic start generated code]*/
static PyObject *
-float_fromhex(PyTypeObject *type, PyObject *string)
-/*[clinic end generated code: output=46c0274d22b78e82 input=0407bebd354bca89]*/
+float_fromhex_impl(PyTypeObject *type, PyObject *string)
+/*[clinic end generated code: output=c54b4923552e5af5 input=0407bebd354bca89]*/
{
PyObject *result;
double x;
[clinic start generated code]*/
static PyObject *
-float_from_number(PyTypeObject *type, PyObject *number)
-/*[clinic end generated code: output=bbcf05529fe907a3 input=1f8424d9bc11866a]*/
+float_from_number_impl(PyTypeObject *type, PyObject *number)
+/*[clinic end generated code: output=dda7e4466ab7068d input=1f8424d9bc11866a]*/
{
if (PyFloat_CheckExact(number) && type == &PyFloat_Type) {
Py_INCREF(number);
def correct_name_for_self(
- f: Function
+ f: Function,
+ parser: bool = False
) -> tuple[str, str]:
if f.kind in {CALLABLE, METHOD_INIT, GETTER, SETTER}:
if f.cls:
return "PyObject *", "module"
if f.kind is STATIC_METHOD:
return "void *", "null"
- if f.kind in (CLASS_METHOD, METHOD_NEW):
+ if f.kind == CLASS_METHOD:
+ if parser:
+ return "PyObject *", "type"
+ else:
+ return "PyTypeObject *", "type"
+ if f.kind == METHOD_NEW:
return "PyTypeObject *", "type"
raise AssertionError(f"Unhandled type of function f: {f.kind!r}")
@property
def parser_type(self) -> str:
assert self.type is not None
- tp, _ = correct_name_for_self(self.function)
+ tp, _ = correct_name_for_self(self.function, parser=True)
return tp
def render(self, parameter: Parameter, data: CRenderData) -> None:
type_ptr = f'PyTypeObject *base_tp = {type_object};'
template_dict['base_type_ptr'] = type_ptr
+ def use_pyobject_self(self, func: Function) -> bool:
+ conv_type = self.type
+ if conv_type is None:
+ conv_type, _ = correct_name_for_self(func)
+ return (conv_type in ('PyObject *', None)
+ and self.specified_type in ('PyObject *', None))
+
# Converters for var-positional parameter.
and not self.func.critical_section)
def use_pyobject_self(self) -> bool:
- pyobject_types = ('PyObject *', None)
- return (self.self_parameter_converter.type in pyobject_types
- and self.self_parameter_converter.specified_type in pyobject_types)
+ return self.self_parameter_converter.use_pyobject_self(self.func)
def select_prototypes(self) -> None:
self.docstring_prototype = ''