2020-05-07 10:39:59 -03:00
|
|
|
/*[clinic input]
|
|
|
|
preserve
|
|
|
|
[clinic start generated code]*/
|
|
|
|
|
|
|
|
PyDoc_STRVAR(_testmultiphase_StateAccessType_get_defining_module__doc__,
|
|
|
|
"get_defining_module($self, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n"
|
2020-11-03 17:27:12 -04:00
|
|
|
"Return the module of the defining class.\n"
|
|
|
|
"\n"
|
2022-02-11 12:22:11 -04:00
|
|
|
"Also tests that result of PyType_GetModuleByDef matches defining_class\'s\n"
|
2020-11-03 17:27:12 -04:00
|
|
|
"module.");
|
2020-05-07 10:39:59 -03:00
|
|
|
|
|
|
|
#define _TESTMULTIPHASE_STATEACCESSTYPE_GET_DEFINING_MODULE_METHODDEF \
|
2022-05-03 15:25:41 -03:00
|
|
|
{"get_defining_module", _PyCFunction_CAST(_testmultiphase_StateAccessType_get_defining_module), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _testmultiphase_StateAccessType_get_defining_module__doc__},
|
2020-05-07 10:39:59 -03:00
|
|
|
|
|
|
|
static PyObject *
|
|
|
|
_testmultiphase_StateAccessType_get_defining_module_impl(StateAccessTypeObject *self,
|
|
|
|
PyTypeObject *cls);
|
|
|
|
|
|
|
|
static PyObject *
|
|
|
|
_testmultiphase_StateAccessType_get_defining_module(StateAccessTypeObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
|
|
|
|
{
|
2022-04-30 07:15:02 -03:00
|
|
|
if (nargs) {
|
|
|
|
PyErr_SetString(PyExc_TypeError, "get_defining_module() takes no arguments");
|
|
|
|
return NULL;
|
2020-05-07 10:39:59 -03:00
|
|
|
}
|
2022-04-30 07:15:02 -03:00
|
|
|
return _testmultiphase_StateAccessType_get_defining_module_impl(self, cls);
|
2020-05-07 10:39:59 -03:00
|
|
|
}
|
|
|
|
|
2022-02-02 11:57:51 -04:00
|
|
|
PyDoc_STRVAR(_testmultiphase_StateAccessType_getmodulebydef_bad_def__doc__,
|
|
|
|
"getmodulebydef_bad_def($self, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n"
|
2022-02-11 12:22:11 -04:00
|
|
|
"Test that result of PyType_GetModuleByDef with a bad def is NULL.");
|
2022-02-02 11:57:51 -04:00
|
|
|
|
|
|
|
#define _TESTMULTIPHASE_STATEACCESSTYPE_GETMODULEBYDEF_BAD_DEF_METHODDEF \
|
2022-05-03 15:25:41 -03:00
|
|
|
{"getmodulebydef_bad_def", _PyCFunction_CAST(_testmultiphase_StateAccessType_getmodulebydef_bad_def), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _testmultiphase_StateAccessType_getmodulebydef_bad_def__doc__},
|
2022-02-02 11:57:51 -04:00
|
|
|
|
|
|
|
static PyObject *
|
|
|
|
_testmultiphase_StateAccessType_getmodulebydef_bad_def_impl(StateAccessTypeObject *self,
|
|
|
|
PyTypeObject *cls);
|
|
|
|
|
|
|
|
static PyObject *
|
|
|
|
_testmultiphase_StateAccessType_getmodulebydef_bad_def(StateAccessTypeObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
|
|
|
|
{
|
2022-04-30 07:15:02 -03:00
|
|
|
if (nargs) {
|
|
|
|
PyErr_SetString(PyExc_TypeError, "getmodulebydef_bad_def() takes no arguments");
|
|
|
|
return NULL;
|
2022-02-02 11:57:51 -04:00
|
|
|
}
|
2022-04-30 07:15:02 -03:00
|
|
|
return _testmultiphase_StateAccessType_getmodulebydef_bad_def_impl(self, cls);
|
2022-02-02 11:57:51 -04:00
|
|
|
}
|
|
|
|
|
2020-05-07 10:39:59 -03:00
|
|
|
PyDoc_STRVAR(_testmultiphase_StateAccessType_increment_count_clinic__doc__,
|
|
|
|
"increment_count_clinic($self, /, n=1, *, twice=False)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n"
|
|
|
|
"Add \'n\' from the module-state counter.\n"
|
|
|
|
"\n"
|
|
|
|
"Pass \'twice\' to double that amount.\n"
|
|
|
|
"\n"
|
|
|
|
"This tests Argument Clinic support for defining_class.");
|
|
|
|
|
|
|
|
#define _TESTMULTIPHASE_STATEACCESSTYPE_INCREMENT_COUNT_CLINIC_METHODDEF \
|
2022-05-03 15:25:41 -03:00
|
|
|
{"increment_count_clinic", _PyCFunction_CAST(_testmultiphase_StateAccessType_increment_count_clinic), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _testmultiphase_StateAccessType_increment_count_clinic__doc__},
|
2020-05-07 10:39:59 -03:00
|
|
|
|
|
|
|
static PyObject *
|
|
|
|
_testmultiphase_StateAccessType_increment_count_clinic_impl(StateAccessTypeObject *self,
|
|
|
|
PyTypeObject *cls,
|
|
|
|
int n, int twice);
|
|
|
|
|
|
|
|
static PyObject *
|
|
|
|
_testmultiphase_StateAccessType_increment_count_clinic(StateAccessTypeObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
|
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
|
|
|
static const char * const _keywords[] = {"n", "twice", NULL};
|
2022-04-30 07:15:02 -03:00
|
|
|
static _PyArg_Parser _parser = {NULL, _keywords, "increment_count_clinic", 0};
|
|
|
|
PyObject *argsbuf[2];
|
|
|
|
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
|
2020-05-07 10:39:59 -03:00
|
|
|
int n = 1;
|
|
|
|
int twice = 0;
|
|
|
|
|
2022-04-30 07:15:02 -03:00
|
|
|
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
|
|
|
|
if (!args) {
|
2020-05-07 10:39:59 -03:00
|
|
|
goto exit;
|
|
|
|
}
|
2022-04-30 07:15:02 -03:00
|
|
|
if (!noptargs) {
|
|
|
|
goto skip_optional_pos;
|
|
|
|
}
|
|
|
|
if (args[0]) {
|
|
|
|
n = _PyLong_AsInt(args[0]);
|
|
|
|
if (n == -1 && PyErr_Occurred()) {
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
if (!--noptargs) {
|
|
|
|
goto skip_optional_pos;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
skip_optional_pos:
|
|
|
|
if (!noptargs) {
|
|
|
|
goto skip_optional_kwonly;
|
|
|
|
}
|
|
|
|
twice = PyObject_IsTrue(args[1]);
|
|
|
|
if (twice < 0) {
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
skip_optional_kwonly:
|
2020-05-07 10:39:59 -03:00
|
|
|
return_value = _testmultiphase_StateAccessType_increment_count_clinic_impl(self, cls, n, twice);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
PyDoc_STRVAR(_testmultiphase_StateAccessType_get_count__doc__,
|
|
|
|
"get_count($self, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n"
|
|
|
|
"Return the value of the module-state counter.");
|
|
|
|
|
|
|
|
#define _TESTMULTIPHASE_STATEACCESSTYPE_GET_COUNT_METHODDEF \
|
2022-05-03 15:25:41 -03:00
|
|
|
{"get_count", _PyCFunction_CAST(_testmultiphase_StateAccessType_get_count), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _testmultiphase_StateAccessType_get_count__doc__},
|
2020-05-07 10:39:59 -03:00
|
|
|
|
|
|
|
static PyObject *
|
|
|
|
_testmultiphase_StateAccessType_get_count_impl(StateAccessTypeObject *self,
|
|
|
|
PyTypeObject *cls);
|
|
|
|
|
|
|
|
static PyObject *
|
|
|
|
_testmultiphase_StateAccessType_get_count(StateAccessTypeObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
|
|
|
|
{
|
2022-04-30 07:15:02 -03:00
|
|
|
if (nargs) {
|
|
|
|
PyErr_SetString(PyExc_TypeError, "get_count() takes no arguments");
|
|
|
|
return NULL;
|
2020-05-07 10:39:59 -03:00
|
|
|
}
|
2022-04-30 07:15:02 -03:00
|
|
|
return _testmultiphase_StateAccessType_get_count_impl(self, cls);
|
2020-05-07 10:39:59 -03:00
|
|
|
}
|
2022-05-03 15:25:41 -03:00
|
|
|
/*[clinic end generated code: output=48739d81c3834078 input=a9049054013a1b77]*/
|