3

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

3 Answers 3

4

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

Sign up to request clarification or add additional context in comments.

3 Comments

I am on Ubuntu , not windows. Under my /usr/lib/python2.6 I don't see any such file: find . -name '*.c'
Well, if it's definitely not there... I've not got an Ubuntu system here - updating main answer...
I did this search with no results: sudo find / -name 'bltinmodule.c'. Anyone else has an answer for Ubuntu ?
4

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)

2 Comments

For later versions, development has moved to Mercurial. See hg.python.org/cpython
Specifically, this would be the source for the builtin module under Mercurual.
1

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.