0

Does PyIntObject still in python3.x source code,or has it been replaced by PyLongObject? I can't find the code as follows:

typedef struct {
    PyObject_HEAD
    long ob_ival;
} PyIntObject;
刘孟德
  • 171
  • 1
  • 8

1 Answers1

0

From https://docs.python.org/3.2/howto/cporting.html (long/int Unification):

Python 3 has only one integer type, int(). But it actually corresponds to Python 2’s long() type–the int() type used in Python 2 was removed. In the C-API, PyInt_* functions are replaced by their PyLong_* equivalents.

The best course of action here is using the PyInt_* functions aliased to PyLong_* found in intobject.h. The abstract PyNumber_* APIs can also be used in some cases.

Please check also the following discussion: How does Python manage int and long?

MartinaW
  • 335
  • 3
  • 11