Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
208 changes: 124 additions & 84 deletions Lib/test/clinic.test.c
Original file line number Diff line number Diff line change
Expand Up @@ -5381,141 +5381,172 @@ Test_meth_coexist_impl(TestObj *self)
/*[clinic end generated code: output=7edf4e95b29f06fa input=2a1d75b5e6fec6dd]*/

/*[clinic input]
@getter
Test.property
@setter
@deleter
Test.settable
[clinic start generated code]*/

#if !defined(Test_property_DOCSTR)
# define Test_property_DOCSTR NULL
#endif
#if defined(TEST_PROPERTY_GETSETDEF)
# undef TEST_PROPERTY_GETSETDEF
# define TEST_PROPERTY_GETSETDEF {"property", (getter)Test_property_get, (setter)Test_property_set, Test_property_DOCSTR},
#else
# define TEST_PROPERTY_GETSETDEF {"property", (getter)Test_property_get, NULL, Test_property_DOCSTR},
#endif
static int
Test_settable_set_impl(TestObj *self, PyObject *value);

static PyObject *
Test_property_get_impl(TestObj *self);
static int
Test_settable_set(PyObject *self, PyObject *arg, void *Py_UNUSED(context))
{
int return_value = -1;
PyObject *value = NULL;

if (arg != NULL) {
value = arg;
}
return_value = Test_settable_set_impl((TestObj *)self, value);

return return_value;
}

static int
Test_settable_set_impl(TestObj *self, PyObject *value)
/*[clinic end generated code: output=46832806d93e5391 input=c5e1780ba116abdc]*/

/*[clinic input]
@getter
Test.int_property -> int
[clinic start generated code]*/

static int
Test_int_property_get_impl(TestObj *self);

static PyObject *
Test_property_get(PyObject *self, void *Py_UNUSED(context))
Test_int_property_get(PyObject *self, void *Py_UNUSED(context))
{
return Test_property_get_impl((TestObj *)self);
PyObject *return_value = NULL;
int _return_value;

_return_value = Test_int_property_get_impl((TestObj *)self);
if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
}
return_value = PyLong_FromLong((long)_return_value);

exit:
return return_value;
}

static PyObject *
Test_property_get_impl(TestObj *self)
/*[clinic end generated code: output=b38d68abd3466a6e input=2d92b3449fbc7d2b]*/
static int
Test_int_property_get_impl(TestObj *self)
/*[clinic end generated code: output=0d0b1028eefad645 input=d9617980a2010b06]*/

/*[clinic input]
@setter
Test.property
Test.int_property
value: int
[clinic start generated code]*/

#if !defined(Test_property_DOCSTR)
# define Test_property_DOCSTR NULL
#endif
#if defined(TEST_PROPERTY_GETSETDEF)
# undef TEST_PROPERTY_GETSETDEF
# define TEST_PROPERTY_GETSETDEF {"property", (getter)Test_property_get, (setter)Test_property_set, Test_property_DOCSTR},
#else
# define TEST_PROPERTY_GETSETDEF {"property", NULL, (setter)Test_property_set, NULL},
#endif

static int
Test_property_set_impl(TestObj *self, PyObject *value);
Test_int_property_set_impl(TestObj *self, int value);

static int
Test_property_set(PyObject *self, PyObject *value, void *Py_UNUSED(context))
Test_int_property_set(PyObject *self, PyObject *arg, void *Py_UNUSED(context))
{
int return_value;
int return_value = -1;
int value;

if (value == NULL) {
if (arg == NULL) {
PyErr_Format(PyExc_AttributeError,
"attribute 'property' of '%.100s' objects cannot be deleted",
"attribute 'int_property' of '%.100s' objects cannot be deleted",
Py_TYPE(self)->tp_name);
return -1;
}
return_value = Test_property_set_impl((TestObj *)self, value);
value = PyLong_AsInt(arg);
if (value == -1 && PyErr_Occurred()) {
goto exit;
}
return_value = Test_int_property_set_impl((TestObj *)self, value);

exit:
return return_value;
}

static int
Test_property_set_impl(TestObj *self, PyObject *value)
/*[clinic end generated code: output=ec103a151cf51d25 input=3bc3f46a23c83a88]*/
Test_int_property_set_impl(TestObj *self, int value)
/*[clinic end generated code: output=75d998b3c5aabb83 input=3830ff9462d00c65]*/

/*[clinic input]
@setter
@deleter
Test.settable_and_deletable
@getter
Test.property
[clinic start generated code]*/

#if !defined(Test_settable_and_deletable_DOCSTR)
# define Test_settable_and_deletable_DOCSTR NULL
#endif
#if defined(TEST_SETTABLE_AND_DELETABLE_GETSETDEF)
# undef TEST_SETTABLE_AND_DELETABLE_GETSETDEF
# define TEST_SETTABLE_AND_DELETABLE_GETSETDEF {"settable_and_deletable", (getter)Test_settable_and_deletable_get, (setter)Test_settable_and_deletable_set, Test_settable_and_deletable_DOCSTR},
#else
# define TEST_SETTABLE_AND_DELETABLE_GETSETDEF {"settable_and_deletable", NULL, (setter)Test_settable_and_deletable_set, NULL},
#endif
static PyObject *
Test_property_get_impl(TestObj *self);

static PyObject *
Test_property_get(PyObject *self, void *Py_UNUSED(context))
{
return Test_property_get_impl((TestObj *)self);
}

static PyObject *
Test_property_get_impl(TestObj *self)
/*[clinic end generated code: output=2b6f95ae685a9efc input=2d92b3449fbc7d2b]*/

/*[clinic input]
@setter
Test.property
[clinic start generated code]*/

static int
Test_settable_and_deletable_set_impl(TestObj *self, PyObject *value);
Test_property_set_impl(TestObj *self, PyObject *value);

static int
Test_settable_and_deletable_set(PyObject *self, PyObject *value, void *Py_UNUSED(context))
Test_property_set(PyObject *self, PyObject *arg, void *Py_UNUSED(context))
{
int return_value;
int return_value = -1;
PyObject *value;

return_value = Test_settable_and_deletable_set_impl((TestObj *)self, value);
if (arg == NULL) {
PyErr_Format(PyExc_AttributeError,
"attribute 'property' of '%.100s' objects cannot be deleted",
Py_TYPE(self)->tp_name);
return -1;
}
value = arg;
return_value = Test_property_set_impl((TestObj *)self, value);

return return_value;
}

static int
Test_settable_and_deletable_set_impl(TestObj *self, PyObject *value)
/*[clinic end generated code: output=479986d499b2f56d input=f5647f3511b9daea]*/
Test_property_set_impl(TestObj *self, PyObject *value)
/*[clinic end generated code: output=b54a80ff88efca4c input=3bc3f46a23c83a88]*/

/*[clinic input]
@setter
Test.setter_first_with_docstr
[clinic start generated code]*/

#if !defined(Test_setter_first_with_docstr_DOCSTR)
# define Test_setter_first_with_docstr_DOCSTR NULL
#endif
#if defined(TEST_SETTER_FIRST_WITH_DOCSTR_GETSETDEF)
# undef TEST_SETTER_FIRST_WITH_DOCSTR_GETSETDEF
# define TEST_SETTER_FIRST_WITH_DOCSTR_GETSETDEF {"setter_first_with_docstr", (getter)Test_setter_first_with_docstr_get, (setter)Test_setter_first_with_docstr_set, Test_setter_first_with_docstr_DOCSTR},
#else
# define TEST_SETTER_FIRST_WITH_DOCSTR_GETSETDEF {"setter_first_with_docstr", NULL, (setter)Test_setter_first_with_docstr_set, NULL},
#endif

static int
Test_setter_first_with_docstr_set_impl(TestObj *self, PyObject *value);

static int
Test_setter_first_with_docstr_set(PyObject *self, PyObject *value, void *Py_UNUSED(context))
Test_setter_first_with_docstr_set(PyObject *self, PyObject *arg, void *Py_UNUSED(context))
{
int return_value;
int return_value = -1;
PyObject *value;

if (value == NULL) {
if (arg == NULL) {
PyErr_Format(PyExc_AttributeError,
"attribute 'setter_first_with_docstr' of '%.100s' objects cannot be deleted",
Py_TYPE(self)->tp_name);
return -1;
}
value = arg;
return_value = Test_setter_first_with_docstr_set_impl((TestObj *)self, value);

return return_value;
}

static int
Test_setter_first_with_docstr_set_impl(TestObj *self, PyObject *value)
/*[clinic end generated code: output=eac8bafcaa50aa51 input=31a045ce11bbe961]*/
/*[clinic end generated code: output=fdd579cfe3b261e4 input=31a045ce11bbe961]*/

/*[clinic input]
@getter
Expand All @@ -5526,20 +5557,6 @@ my silly docstring

PyDoc_STRVAR(Test_setter_first_with_docstr__doc__,
"my silly docstring");
#if defined(Test_setter_first_with_docstr_DOCSTR)
# undef Test_setter_first_with_docstr_DOCSTR
#endif
#define Test_setter_first_with_docstr_DOCSTR Test_setter_first_with_docstr__doc__

#if !defined(Test_setter_first_with_docstr_DOCSTR)
# define Test_setter_first_with_docstr_DOCSTR NULL
#endif
#if defined(TEST_SETTER_FIRST_WITH_DOCSTR_GETSETDEF)
# undef TEST_SETTER_FIRST_WITH_DOCSTR_GETSETDEF
# define TEST_SETTER_FIRST_WITH_DOCSTR_GETSETDEF {"setter_first_with_docstr", (getter)Test_setter_first_with_docstr_get, (setter)Test_setter_first_with_docstr_set, Test_setter_first_with_docstr_DOCSTR},
#else
# define TEST_SETTER_FIRST_WITH_DOCSTR_GETSETDEF {"setter_first_with_docstr", (getter)Test_setter_first_with_docstr_get, NULL, Test_setter_first_with_docstr_DOCSTR},
#endif

static PyObject *
Test_setter_first_with_docstr_get_impl(TestObj *self);
Expand All @@ -5552,7 +5569,20 @@ Test_setter_first_with_docstr_get(PyObject *self, void *Py_UNUSED(context))

static PyObject *
Test_setter_first_with_docstr_get_impl(TestObj *self)
/*[clinic end generated code: output=fe6e3aa844a24920 input=10af4e43b3cb34dc]*/
/*[clinic end generated code: output=e93e3e68b0473d74 input=10af4e43b3cb34dc]*/

/*[clinic input]
dump buffer
[clinic start generated code]*/
#define TEST_SETTABLE_GETSETDEF {"settable", (getter)NULL, (setter)Test_settable_set, NULL},

#define TEST_INT_PROPERTY_GETSETDEF {"int_property", (getter)Test_int_property_get, (setter)Test_int_property_set, NULL},

#define TEST_PROPERTY_GETSETDEF {"property", (getter)Test_property_get, (setter)Test_property_set, NULL},

#define TEST_SETTER_FIRST_WITH_DOCSTR_GETSETDEF {"setter_first_with_docstr", (getter)Test_setter_first_with_docstr_get, (setter)Test_setter_first_with_docstr_set, Test_setter_first_with_docstr__doc__},

/*[clinic end generated code: output=011497a4f5a2e835 input=524ce2e021e4eba6]*/

/*[clinic input]
output push
Expand Down Expand Up @@ -6395,3 +6425,13 @@ static PyObject *
test_critical_section_object2_impl(PyObject *module, PyObject *a,
PyObject *b)
/*[clinic end generated code: output=d73a1657c18df17a input=638824e41419a466]*/

/*[clinic input]
dump buffer
[clinic start generated code]*/
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=524ce2e021e4eba6]*/

/*[clinic input]
dump buffer
[clinic start generated code]*/
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=524ce2e021e4eba6]*/
Loading
Loading