The PyIntObject is used to store the integer types. The definition for this object is in the file Include/intobject.h.

typedef struct {
PyObject_HEAD
long ob_ival;
} PyIntObject;

The important thing to consider is that it is just a wrapping around a plain long type of the C programming language. To understand it let us debug an example. Open the file Objects/intobject.c and place a debug point on line number 89. Start debugging the application. Open the python shell in the debugger and type the expression

a = 10l

The debugger is activated. Debug step by step to understand how the int object is created. The other methods in the file are fairly straight forward. I would urge you to go through some of them for better understanding.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s