mirror of
https://github.com/python/cpython.git
synced 2025-07-15 23:35:23 +00:00
Remove PyInt_CheckExact. Add PyLong_AsLongAndOverflow.
This commit is contained in:
parent
0fbab7ff8d
commit
d1a1d1ed80
15 changed files with 134 additions and 54 deletions
|
@ -3595,8 +3595,11 @@ socket_getaddrinfo(PyObject *self, PyObject *args)
|
|||
"getaddrinfo() argument 1 must be string or None");
|
||||
return NULL;
|
||||
}
|
||||
if (PyInt_CheckExact(pobj)) {
|
||||
PyOS_snprintf(pbuf, sizeof(pbuf), "%ld", PyLong_AsLong(pobj));
|
||||
if (PyLong_CheckExact(pobj)) {
|
||||
long value = PyLong_AsLong(pobj);
|
||||
if (value == -1 && PyErr_Occurred())
|
||||
goto err;
|
||||
PyOS_snprintf(pbuf, sizeof(pbuf), "%ld", value);
|
||||
pptr = pbuf;
|
||||
} else if (PyUnicode_Check(pobj)) {
|
||||
pptr = PyUnicode_AsString(pobj);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue