CPython

See also Compile CPython on Windows.

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.

=> implementated in Python 3.7 as: “python3 -X dev” or PYTHONDEVMODE=1 !

CPython infra

Services used by unit tests

  • pythontest.net services:

  • snakebite.net:

    # Testing connect timeout is tricky: we need to have IP connectivity
    # to a host that silently drops our packets.  We can't simulate this
    # from Python because it's a function of the underlying TCP/IP stack.
    # So, the following Snakebite host has been defined:
    blackhole = resolve_address('blackhole.snakebite.net', 56666)
    
    # Blackhole has been configured to silently drop any incoming packets.
    # No RSTs (for TCP) or ICMP UNREACH (for UDP/ICMP) will be sent back
    # to hosts that attempt to connect to this address: which is exactly
    # what we need to confidently test connect timeout.
    
    # However, we want to prevent false positives.  It's not unreasonable
    # to expect certain hosts may not be able to reach the blackhole, due
    # to firewalling or general network configuration.  In order to improve
    # our confidence in testing the blackhole, a corresponding 'whitehole'
    # has also been set up using one port higher:
    whitehole = resolve_address('whitehole.snakebite.net', 56667)
    
  • news.trigofacile.com:

  • ipv6.google.com:

    • test_ssl uses it to test IPv6: HTTP (tcp/80) and HTTPS (tcp/443)
  • sha256.tbs-internet.com:

    • test_ssl uses it to test x509 certificate signed by SHA256: HTTPS (tcp/443)

Package Index (PyPI)

cpython GitHub project

Misc

Documentation

Embedded libraries

Update dependencies: https://github.com/python/cpython-source-deps/blob/master/README.rst

See my external_versions.py script: external version of embedded libraries from CPython source code (locally).

On security branches, some dependencies are outdated because no more macOS nor Windows installer is built. It was decided to not upgrade outdated zlib 1.2.5 in Python 3.3.7, since it’s specific to Windows, and no Windows user is expected to build his/her own Python 3.3 anymore.

See also cpython-bin-deps and cpython-source-deps.

Supported platforms

PEP 11 lists removed platforms:

Windows:

  • Windows XP supported in Python 2.7, not supported in Python 3.6
  • Windows 2000 support dropped in Python 3.4

Well supported platforms on Python 3.6 and 2.7:

  • Linux
  • Windows: XXX min version?
  • macOS: XXX min version?
  • FreeBSD

Tested by Travis CI and buildbots.

Supported platform with best effort support:

  • Android API 24
  • OpenBSD
  • NetBSD
  • Solaris, OpenIndiana
  • AIX

Platforms not supported officially:

  • Cygwin
  • MinGW
  • HP-UX

Unofficial projects:

  • Python for OpenVMS
  • PythonD: PythonD is a 32-bit, multi-threaded, networking- and OpenGL-enabled Python interpreter for DOS and Windows.