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
2 changes: 2 additions & 0 deletions Include/internal/pycore_abstract.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ PyAPI_FUNC(int) _Py_convert_optional_to_non_negative_ssize_t(PyObject *, void *)
// Export for 'math' shared extension.
PyAPI_FUNC(PyObject*) _PyNumber_Index(PyObject *o);

PyAPI_FUNC(Py_ssize_t) _PyNumber_IndexAsSsize_t(PyObject *o);

typedef struct {
PyObject *object;
PySendResult kind;
Expand Down
68 changes: 18 additions & 50 deletions Lib/test/clinic.test.c
Original file line number Diff line number Diff line change
Expand Up @@ -1652,32 +1652,16 @@ test_Py_ssize_t_converter(PyObject *module, PyObject *const *args, Py_ssize_t na
if (nargs < 1) {
goto skip_optional;
}
{
Py_ssize_t ival = -1;
PyObject *iobj = _PyNumber_Index(args[0]);
if (iobj != NULL) {
ival = PyLong_AsSsize_t(iobj);
Py_DECREF(iobj);
}
if (ival == -1 && PyErr_Occurred()) {
goto exit;
}
a = ival;
a = _PyNumber_IndexAsSsize_t(args[0]);
if (a == -1 && PyErr_Occurred()) {
goto exit;
}
if (nargs < 2) {
goto skip_optional;
}
{
Py_ssize_t ival = -1;
PyObject *iobj = _PyNumber_Index(args[1]);
if (iobj != NULL) {
ival = PyLong_AsSsize_t(iobj);
Py_DECREF(iobj);
}
if (ival == -1 && PyErr_Occurred()) {
goto exit;
}
b = ival;
b = _PyNumber_IndexAsSsize_t(args[1]);
if (b == -1 && PyErr_Occurred()) {
goto exit;
}
if (nargs < 3) {
goto skip_optional;
Expand All @@ -1688,22 +1672,14 @@ test_Py_ssize_t_converter(PyObject *module, PyObject *const *args, Py_ssize_t na
if (nargs < 4) {
goto skip_optional;
}
{
Py_ssize_t ival = -1;
PyObject *iobj = _PyNumber_Index(args[3]);
if (iobj != NULL) {
ival = PyLong_AsSsize_t(iobj);
Py_DECREF(iobj);
}
if (ival == -1 && PyErr_Occurred()) {
goto exit;
}
d = ival;
if (d < 0) {
PyErr_SetString(PyExc_ValueError,
"d cannot be negative");
goto exit;
}
d = _PyNumber_IndexAsSsize_t(args[3]);
if (d == -1 && PyErr_Occurred()) {
goto exit;
}
if (d < 0) {
PyErr_SetString(PyExc_ValueError,
"d cannot be negative");
goto exit;
}
if (nargs < 5) {
goto skip_optional;
Expand All @@ -1714,17 +1690,9 @@ test_Py_ssize_t_converter(PyObject *module, PyObject *const *args, Py_ssize_t na
if (nargs < 6) {
goto skip_optional;
}
{
Py_ssize_t ival = -1;
PyObject *iobj = _PyNumber_Index(args[5]);
if (iobj != NULL) {
ival = PyLong_AsSsize_t(iobj);
Py_DECREF(iobj);
}
if (ival == -1 && PyErr_Occurred()) {
goto exit;
}
f = ival;
f = _PyNumber_IndexAsSsize_t(args[5]);
if (f == -1 && PyErr_Occurred()) {
goto exit;
}
if (nargs < 7) {
goto skip_optional;
Expand All @@ -1743,7 +1711,7 @@ static PyObject *
test_Py_ssize_t_converter_impl(PyObject *module, Py_ssize_t a, Py_ssize_t b,
Py_ssize_t c, Py_ssize_t d, Py_ssize_t e,
Py_ssize_t f, Py_ssize_t g)
/*[clinic end generated code: output=4ae0a56a1447fba9 input=a25bac8ecf2890aa]*/
/*[clinic end generated code: output=e4286b4ef87a92ab input=a25bac8ecf2890aa]*/


/*[clinic input]
Expand Down
52 changes: 18 additions & 34 deletions Modules/_ctypes/clinic/_ctypes.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 8 additions & 24 deletions Modules/_ctypes/clinic/callproc.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 11 additions & 35 deletions Modules/_ctypes/clinic/cfield.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading