summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2023-08-24 23:01:30 (GMT)
committerGitHub <noreply@github.com>2023-08-24 23:01:30 (GMT)
commitb32d4cad15f537f25063bcd56377e16df59d98db (patch)
tree0a71372347d58e79575f9dfae35407c694fcb611 /Modules
parent4e5a7284eef4308dce252ca1115d4a5a5b7e6ae8 (diff)
downloadcpython-b32d4cad15f537f25063bcd56377e16df59d98db.zip
cpython-b32d4cad15f537f25063bcd56377e16df59d98db.tar.gz
cpython-b32d4cad15f537f25063bcd56377e16df59d98db.tar.bz2
gh-108444: Replace _PyLong_AsInt() with PyLong_AsInt() (#108459)
Change generated by the command: sed -i -e 's!_PyLong_AsInt!PyLong_AsInt!g' \ $(find -name "*.c" -o -name "*.h")
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_csv.c2
-rw-r--r--Modules/_ctypes/stgdict.c2
-rw-r--r--Modules/_datetimemodule.c6
-rw-r--r--Modules/_io/fileio.c4
-rw-r--r--Modules/_io/winconsoleio.c2
-rw-r--r--Modules/_sqlite/connection.c2
-rw-r--r--Modules/faulthandler.c2
-rw-r--r--Modules/posixmodule.c6
-rw-r--r--Modules/readline.c2
-rw-r--r--Modules/socketmodule.c8
10 files changed, 18 insertions, 18 deletions
diff --git a/Modules/_csv.c b/Modules/_csv.c
index 24a57e3..9568334 100644
--- a/Modules/_csv.c
+++ b/Modules/_csv.c
@@ -233,7 +233,7 @@ _set_int(const char *name, int *target, PyObject *src, int dflt)
"\"%s\" must be an integer", name);
return -1;
}
- value = _PyLong_AsInt(src);
+ value = PyLong_AsInt(src);
if (value == -1 && PyErr_Occurred()) {
return -1;
}
diff --git a/Modules/_ctypes/stgdict.c b/Modules/_ctypes/stgdict.c
index 54291a7..9b0ca73 100644
--- a/Modules/_ctypes/stgdict.c
+++ b/Modules/_ctypes/stgdict.c
@@ -401,7 +401,7 @@ PyCStructUnionType_update_stgdict(PyObject *type, PyObject *fields, int isStruct
return -1;
}
if (tmp) {
- pack = _PyLong_AsInt(tmp);
+ pack = PyLong_AsInt(tmp);
Py_DECREF(tmp);
if (pack < 0) {
if (!PyErr_Occurred() ||
diff --git a/Modules/_datetimemodule.c b/Modules/_datetimemodule.c
index 9002a1d..454be6e 100644
--- a/Modules/_datetimemodule.c
+++ b/Modules/_datetimemodule.c
@@ -1923,7 +1923,7 @@ microseconds_to_delta_ex(PyObject *pyus, PyTypeObject *type)
}
num = PyTuple_GET_ITEM(tuple, 1); /* us */
- us = _PyLong_AsInt(num);
+ us = PyLong_AsInt(num);
num = NULL;
if (us == -1 && PyErr_Occurred()) {
goto Done;
@@ -1941,7 +1941,7 @@ microseconds_to_delta_ex(PyObject *pyus, PyTypeObject *type)
Py_DECREF(num);
num = PyTuple_GET_ITEM(tuple, 1); /* seconds */
- s = _PyLong_AsInt(num);
+ s = PyLong_AsInt(num);
num = NULL;
if (s == -1 && PyErr_Occurred()) {
goto Done;
@@ -1951,7 +1951,7 @@ microseconds_to_delta_ex(PyObject *pyus, PyTypeObject *type)
}
num = Py_NewRef(PyTuple_GET_ITEM(tuple, 0)); /* leftover days */
- d = _PyLong_AsInt(num);
+ d = PyLong_AsInt(num);
if (d == -1 && PyErr_Occurred()) {
goto Done;
}
diff --git a/Modules/_io/fileio.c b/Modules/_io/fileio.c
index 7fe37ee..d52bcd5 100644
--- a/Modules/_io/fileio.c
+++ b/Modules/_io/fileio.c
@@ -264,7 +264,7 @@ _io_FileIO___init___impl(fileio *self, PyObject *nameobj, const char *mode,
self->fd = -1;
}
- fd = _PyLong_AsInt(nameobj);
+ fd = PyLong_AsInt(nameobj);
if (fd < 0) {
if (!PyErr_Occurred()) {
PyErr_SetString(PyExc_ValueError,
@@ -412,7 +412,7 @@ _io_FileIO___init___impl(fileio *self, PyObject *nameobj, const char *mode,
goto error;
}
- self->fd = _PyLong_AsInt(fdobj);
+ self->fd = PyLong_AsInt(fdobj);
Py_DECREF(fdobj);
if (self->fd < 0) {
if (!PyErr_Occurred()) {
diff --git a/Modules/_io/winconsoleio.c b/Modules/_io/winconsoleio.c
index a1ed7eb..875c90c 100644
--- a/Modules/_io/winconsoleio.c
+++ b/Modules/_io/winconsoleio.c
@@ -280,7 +280,7 @@ _io__WindowsConsoleIO___init___impl(winconsoleio *self, PyObject *nameobj,
self->fd = -1;
}
- fd = _PyLong_AsInt(nameobj);
+ fd = PyLong_AsInt(nameobj);
if (fd < 0) {
if (!PyErr_Occurred()) {
PyErr_SetString(PyExc_ValueError,
diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c
index e133977..a7780de 100644
--- a/Modules/_sqlite/connection.c
+++ b/Modules/_sqlite/connection.c
@@ -1396,7 +1396,7 @@ authorizer_callback(void *ctx, int action, const char *arg1,
}
else {
if (PyLong_Check(ret)) {
- rc = _PyLong_AsInt(ret);
+ rc = PyLong_AsInt(ret);
if (rc == -1 && PyErr_Occurred()) {
print_or_clear_traceback(ctx);
rc = SQLITE_DENY;
diff --git a/Modules/faulthandler.c b/Modules/faulthandler.c
index 5ec34d4..aecb64d 100644
--- a/Modules/faulthandler.c
+++ b/Modules/faulthandler.c
@@ -116,7 +116,7 @@ faulthandler_get_fileno(PyObject **file_ptr)
}
}
else if (PyLong_Check(file)) {
- fd = _PyLong_AsInt(file);
+ fd = PyLong_AsInt(file);
if (fd == -1 && PyErr_Occurred())
return -1;
if (fd < 0) {
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 8026080..cffa401 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -6821,7 +6821,7 @@ parse_posix_spawn_flags(PyObject *module, const char *func_name, PyObject *setpg
goto fail;
}
if (py_schedpolicy != Py_None) {
- int schedpolicy = _PyLong_AsInt(py_schedpolicy);
+ int schedpolicy = PyLong_AsInt(py_schedpolicy);
if (schedpolicy == -1 && PyErr_Occurred()) {
goto fail;
@@ -12484,7 +12484,7 @@ conv_confname(PyObject *arg, int *valuep, struct constdef *table,
size_t tablesize)
{
if (PyLong_Check(arg)) {
- int value = _PyLong_AsInt(arg);
+ int value = PyLong_AsInt(arg);
if (value == -1 && PyErr_Occurred())
return 0;
*valuep = value;
@@ -15668,7 +15668,7 @@ os_waitstatus_to_exitcode_impl(PyObject *module, PyObject *status_obj)
/*[clinic end generated code: output=db50b1b0ba3c7153 input=7fe2d7fdaea3db42]*/
{
#ifndef MS_WINDOWS
- int status = _PyLong_AsInt(status_obj);
+ int status = PyLong_AsInt(status_obj);
if (status == -1 && PyErr_Occurred()) {
return NULL;
}
diff --git a/Modules/readline.c b/Modules/readline.c
index 6729a09..2531b23 100644
--- a/Modules/readline.c
+++ b/Modules/readline.c
@@ -1001,7 +1001,7 @@ on_hook(PyObject *func)
if (r == Py_None)
result = 0;
else {
- result = _PyLong_AsInt(r);
+ result = PyLong_AsInt(r);
if (result == -1 && PyErr_Occurred())
goto error;
}
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index d1ac1ff..b4094b8 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -4879,17 +4879,17 @@ sock_sendmsg_afalg(PySocketSockObject *self, PyObject *args, PyObject *kwds)
/* op is a required, keyword-only argument >= 0 */
if (opobj != NULL) {
- op = _PyLong_AsInt(opobj);
+ op = PyLong_AsInt(opobj);
}
if (op < 0) {
- /* override exception from _PyLong_AsInt() */
+ /* override exception from PyLong_AsInt() */
PyErr_SetString(PyExc_TypeError,
"Invalid or missing argument 'op'");
goto finally;
}
/* assoclen is optional but must be >= 0 */
if (assoclenobj != NULL) {
- assoclen = _PyLong_AsInt(assoclenobj);
+ assoclen = PyLong_AsInt(assoclenobj);
if (assoclen == -1 && PyErr_Occurred()) {
goto finally;
}
@@ -5007,7 +5007,7 @@ sock_shutdown(PySocketSockObject *s, PyObject *arg)
int how;
int res;
- how = _PyLong_AsInt(arg);
+ how = PyLong_AsInt(arg);
if (how == -1 && PyErr_Occurred())
return NULL;
Py_BEGIN_ALLOW_THREADS