CPython

Compile CPython on Windows

See also Windows.

Compile CPython 3 on Windows

To build the Python ssl extension:

Need:

  • Visual Studio 2015 (for Python 3.6)
  • CPython source code: get it using Mercurial (TortoiseHG on Windows)
  • svn.exe in PATH: install TortoiseSVN, but check the [x] command line tools in the installer
  • ActivePerl: Community Edition, 64-bit

Commands:

PCbuild\build -p x64 -d -e

See also: PCbuild/readme.txt.

Compile CPython 2.7 on Windows

  • Install Visual Studio 2008: XXX how to get it?
  • Open a Visual Studio 2008 Prompt
  • In this prompt, run VS\9.0\build.bat -e -d -p x64 to build Python 2.7 in debug mode for 64-bit, and install dependencies like OpenSSL sources if needed

Developer mode

https://mail.python.org/pipermail/python-ideas/2016-March/039314.html

Enable all runtime debug checks in strict mode:

PYTHONMALLOC=debug python3.6 -Wd -bb -X faulthandler script.py

CPython infra

Package Index (PyPI)

cpython GitHub project

Misc

Documentation

Python developer mode

https://mail.python.org/pipermail/python-ideas/2016-March/039314.html

Strict developer mode:

PYTHONMALLOC=debug python3.6 -Werror -bb -X faulthandler script.py

Developer mode:

PYTHONMALLOC=debug python3.6 -Wd -b -X faulthandler script.py
  • Show DeprecationWarning and ResourceWarning warnings: python -Wd
  • Show BytesWarning warning: python -b
  • Enable faulthandler to get a Python traceback on segfault and fatal errors: python -X faulthandler
  • Debug hooks on Python memory allocators: PYTHONMALLOC=debug
  • Enable Python assertions (assert) and set __debug__ to True: remove (or just ignore) -O or -OO command line arguments

See also PYTHONASYNCIODEBUG=1 for asyncio.