External libraries and Generated files

Add a new C file

To add a C file (.c) or an header file (.h), you have to:

  • Create Python/config.c
  • Add it to Makefile.pre.in: in PYTHON_OBJS for example
  • Add it to PCbuild/pythoncore.vcxproj
  • Add it to PCbuild/pythoncore.vcxproj.filters

When creating a new directory, see also:

  • For header files, see also Tools/msi/dev/dev.wixproj (read Steve Dower’s comment).
  • “make tags” and “make TAGS” in Makefile.pre.in
  • The Windows installer copies Lib/test/ and subdirectories: see <InstallFiles Include="$(PySourcePath)Lib\test\**\*" ...> in Tools/msi/test/test.wixproj.

Add a new C extension

  • Update setup.py
  • Update Modules/Setup

Generated files

  • make regen-all
  • autoconf: Regenerate configure from configure.ac
  • install-sh: rm install-sh; automake --add-missing --copy, https://bugs.python.org/issue34765
  • Lib/distutils/command/wininst-*.exe files are binaries of the PC/bdist_wininst/ program (in Python source code).
  • The frozen __phello module comes from M___hello__ constant in Python/frozen.c. The bytecode is generated by Tools/freeze/freeze.py Tools/freeze/flag.py.
  • Python/dtoa.c is based on http://www.netlib.org/fp/dtoa.c
  • Unicode: Update the Unicode version in the Tools/unicode/makeunicodedata.py script, run it, and fix what fails (msg318935).
  • Lib/keyword.py: https://bugs.python.org/issue36143

Vendored external 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.