Ankur Agarwal
Ankur Agarwal

Reputation: 24758

Where can I get the source code of module __builtin__ in python?

where can I get the source code for module builtin in python ? I am interested in version 2.6.x.

Upvotes: 3

Views: 3279

Answers (3)

ncoghlan
ncoghlan

Reputation: 41486

The easiest place to find the CPython source code is the web view of the Mercurial repository: http://hg.python.org/cpython/file/2.6/Python/bltinmodule.c

(Updated link to refer to the copy in Mercurial, although 2.6 security releases happened from the SVN repo)

Upvotes: 4

belacqua
belacqua

Reputation: 563

For an Ubuntu-specific solution (though this should work on Debian, Mint, and other related distros), download the source and you'll find bltinmodule.c there.

On my Ubuntu system, it is located under my python source directory, i.e., .../python2.6-2.6.6/Python/bltinmodule.c

apt-get source xxx will download the source for the specified package into a sub-directory of your current directory.

This should do the trick:

 apt-get source python2.6  
 view ./python2.6-2.6.6/Python/bltinmodule.c

If you don't want to use find, rebuild your locate database with sudo updatedb and then you can do a locate bltintmodule.c to find your file.

Upvotes: 1

dotalchemy
dotalchemy

Reputation: 2467

Go to the folder you installed the Python libraries in, check under the version\Python folder - you should find the bltinmodule.c file.

Something along the lines of C:\python\2.X\Python

On CentOS it's...

root@xenos ~> locate bltinmodule.c
/usr/src/debug/Python-2.5.1/Python/bltinmodule.c
/usr/src/debug/Python-2.6.4/Python/bltinmodule.c

Perhaps you need http://packages.ubuntu.com/dapper/python-dev

Upvotes: 4

Related Questions