|
13 | 13 | #include "pycore_long.h" // _PyLong_GetOne() |
14 | 14 | #include "pycore_object.h" // _PyObject_Init() |
15 | 15 | #include "pycore_time.h" // _PyTime_ObjectToTime_t() |
| 16 | +#include "pycore_tuple.h" // _PyTuple_FromPair |
16 | 17 | #include "pycore_unicodeobject.h" // _PyUnicode_Copy() |
17 | 18 | #include "pycore_initconfig.h" // _PyStatus_OK() |
18 | 19 | #include "pycore_pyatomic_ft_wrappers.h" |
@@ -2692,7 +2693,7 @@ delta_divmod(PyObject *left, PyObject *right) |
2692 | 2693 | Py_DECREF(divmod); |
2693 | 2694 | return NULL; |
2694 | 2695 | } |
2695 | | - result = PyTuple_Pack(2, PyTuple_GET_ITEM(divmod, 0), delta); |
| 2696 | + result = _PyTuple_FromPair(PyTuple_GET_ITEM(divmod, 0), delta); |
2696 | 2697 | Py_DECREF(delta); |
2697 | 2698 | Py_DECREF(divmod); |
2698 | 2699 | return result; |
@@ -4496,7 +4497,7 @@ timezone_getinitargs(PyObject *op, PyObject *Py_UNUSED(dummy)) |
4496 | 4497 | PyDateTime_TimeZone *self = PyTimeZone_CAST(op); |
4497 | 4498 | if (self->name == NULL) |
4498 | 4499 | return PyTuple_Pack(1, self->offset); |
4499 | | - return PyTuple_Pack(2, self->offset, self->name); |
| 4500 | + return _PyTuple_FromPair(self->offset, self->name); |
4500 | 4501 | } |
4501 | 4502 |
|
4502 | 4503 | static PyMethodDef timezone_methods[] = { |
@@ -5247,7 +5248,7 @@ time_getstate(PyDateTime_Time *self, int proto) |
5247 | 5248 | if (! HASTZINFO(self) || self->tzinfo == Py_None) |
5248 | 5249 | result = PyTuple_Pack(1, basestate); |
5249 | 5250 | else |
5250 | | - result = PyTuple_Pack(2, basestate, self->tzinfo); |
| 5251 | + result = _PyTuple_FromPair(basestate, self->tzinfo); |
5251 | 5252 | Py_DECREF(basestate); |
5252 | 5253 | } |
5253 | 5254 | return result; |
@@ -7169,7 +7170,7 @@ datetime_getstate(PyDateTime_DateTime *self, int proto) |
7169 | 7170 | if (! HASTZINFO(self) || self->tzinfo == Py_None) |
7170 | 7171 | result = PyTuple_Pack(1, basestate); |
7171 | 7172 | else |
7172 | | - result = PyTuple_Pack(2, basestate, self->tzinfo); |
| 7173 | + result = _PyTuple_FromPair(basestate, self->tzinfo); |
7173 | 7174 | Py_DECREF(basestate); |
7174 | 7175 | } |
7175 | 7176 | return result; |
|
0 commit comments