Are you happy with your logging solution? Would you help us out by taking a 30-second survey? Click here

cpython

The Python programming language

Subscribe to updates I use cpython


Statistics on cpython

Number of watchers on Github 16560
Number of open issues 606
Main language Python
Average time to merge a PR about 7 hours
Open pull requests 200+
Closed pull requests 75+
Last commit over 1 year ago
Repo Created over 2 years ago
Repo Last Updated over 1 year ago
Size 225 MB
Homepage https://www.pytho...
Organization / Authorpython
Contributors131
Page Updated
Do you use cpython? Leave a review!
View open issues (606)
View cpython activity
View on github
Fresh, new opensource launches πŸš€πŸš€πŸš€
Trendy new open source projects in your inbox! View examples

Subscribe to our mailing list

Evaluating cpython for your project? Score Explanation
Commits Score (?)
Issues & PR Score (?)

This is Python version 3.8.0 alpha 0

.. image:: https://travis-ci.org/python/cpython.svg?branch=master :alt: CPython build status on Travis CI :target: https://travis-ci.org/python/cpython

.. image:: https://ci.appveyor.com/api/projects/status/4mew1a93xdkbf5ua/branch/master?svg=true :alt: CPython build status on Appveyor :target: https://ci.appveyor.com/project/python/cpython/branch/master

.. image:: https://codecov.io/gh/python/cpython/branch/master/graph/badge.svg :alt: CPython code coverage on Codecov :target: https://codecov.io/gh/python/cpython

Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 Python Software Foundation. All rights reserved.

See the end of this file for further copyright and license information.

.. contents::

General Information

  • Website: https://www.python.org
  • Source code: https://github.com/python/cpython
  • Issue tracker: https://bugs.python.org
  • Documentation: https://docs.python.org
  • Developer's Guide: https://devguide.python.org/

Contributing to CPython

For more complete instructions on contributing to CPython development, see the Developer Guide_.

.. _Developer Guide: https://devguide.python.org/

Using Python

Installable Python kits, and information about using Python, are available at python.org_.

.. _python.org: https://www.python.org/

Build Instructions

On Unix, Linux, BSD, macOS, and Cygwin::

./configure
make
make test
sudo make install

This will install Python as python3.

You can pass many options to the configure script; run ./configure --help to find out more. On macOS and Cygwin, the executable is called python.exe; elsewhere it's just python.

On macOS, if you have configured Python with --enable-framework, you should use make frameworkinstall to do the installation. Note that this installs the Python executable in a place that is not normally on your PATH, you may want to set up a symlink in /usr/local/bin.

On Windows, see PCbuild/readme.txt <https://github.com/python/cpython/blob/master/PCbuild/readme.txt>_.

If you wish, you can create a subdirectory and invoke configure from there. For example::

mkdir debug
cd debug
../configure --with-pydebug
make
make test

(This will fail if you also built at the top-level directory. You should do a make clean at the toplevel first.)

To get an optimized build of Python, configure --enable-optimizations before you run make. This sets the default make targets up to enable Profile Guided Optimization (PGO) and may be used to auto-enable Link Time Optimization (LTO) on some platforms. For more details, see the sections below.

Profile Guided Optimization

PGO takes advantage of recent versions of the GCC or Clang compilers. If ran, make profile-opt will do several steps.

First, the entire Python directory is cleaned of temporary files that may have resulted in a previous compilation.

Then, an instrumented version of the interpreter is built, using suitable compiler flags for each flavour. Note that this is just an intermediary step and the binary resulted after this step is not good for real life workloads, as it has profiling instructions embedded inside.

After this instrumented version of the interpreter is built, the Makefile will automatically run a training workload. This is necessary in order to profile the interpreter execution. Note also that any output, both stdout and stderr, that may appear at this step is suppressed.

Finally, the last step is to rebuild the interpreter, using the information collected in the previous one. The end result will be a Python binary that is optimized and suitable for distribution or production installation.

Link Time Optimization

Enabled via configure's --with-lto flag. LTO takes advantage of the ability of recent compiler toolchains to optimize across the otherwise arbitrary .o file boundary when building final executables or shared libraries for additional performance gains.

What's New

We have a comprehensive overview of the changes in the What's New in Python 3.8 <https://docs.python.org/3.8/whatsnew/3.8.html>_ document. For a more detailed change log, read Misc/NEWS <https://github.com/python/cpython/blob/master/Misc/NEWS.d>, but a full accounting of changes can only be gleaned from the commit history <https://github.com/python/cpython/commits/master>.

If you want to install multiple versions of Python see the section below entitled Installing multiple versions.

Documentation

Documentation for Python 3.8 <https://docs.python.org/3.8/>_ is online, updated daily.

It can also be downloaded in many formats for faster access. The documentation is downloadable in HTML, PDF, and reStructuredText formats; the latter version is primarily for documentation authors, translators, and people with special formatting requirements.

For information about building Python's documentation, refer to Doc/README.rst <https://github.com/python/cpython/blob/master/Doc/README.rst>_.

Converting From Python 2.x to 3.x

Significant backward incompatible changes were made for the release of Python 3.0, which may cause programs written for Python 2 to fail when run with Python

  1. For more information about porting your code from Python 2 to Python 3, see the Porting HOWTO <https://docs.python.org/3/howto/pyporting.html>_.

Testing

To test the interpreter, type make test in the top-level directory. The test set produces some output. You can generally ignore the messages about skipped tests due to optional features which can't be imported. If a message is printed about a failed test or a traceback or core dump is produced, something is wrong.

By default, tests are prevented from overusing resources like disk space and memory. To enable these tests, run make testall.

If any tests fail, you can re-run the failing test(s) in verbose mode::

make test TESTOPTS="-v test_that_failed"

If the failure persists and appears to be a problem with Python rather than your environment, you can file a bug report <https://bugs.python.org>_ and include relevant output from that command to show the issue.

Installing multiple versions

On Unix and Mac systems if you intend to install multiple versions of Python using the same installation prefix (--prefix argument to the configure script) you must take care that your primary python executable is not overwritten by the installation of a different version. All files and directories installed using make altinstall contain the major and minor version and can thus live side-by-side. make install also creates ${prefix}/bin/python3 which refers to ${prefix}/bin/pythonX.Y. If you intend to install multiple versions using the same prefix you must decide which version (if any) is your primary version. Install that version using make install. Install all other versions using make altinstall.

For example, if you want to install Python 2.7, 3.6, and 3.8 with 3.8 being the primary version, you would execute make install in your 3.8 build directory and make altinstall in the others.

Issue Tracker and Mailing List

Bug reports are welcome! You can use the issue tracker <https://bugs.python.org>_ to report bugs, and/or submit pull requests on GitHub <https://github.com/python/cpython>_.

You can also follow development discussion on the python-dev mailing list <https://mail.python.org/mailman/listinfo/python-dev/>_.

Proposals for enhancement

If you have a proposal to change Python, you may want to send an email to the comp.lang.python or python-ideas_ mailing lists for initial feedback. A Python Enhancement Proposal (PEP) may be submitted if your idea gains ground. All current PEPs, as well as guidelines for submitting a new PEP, are listed at python.org/dev/peps/ <https://www.python.org/dev/peps/>_.

.. _python-ideas: https://mail.python.org/mailman/listinfo/python-ideas/

Release Schedule

See :pep:569 for Python 3.8 release details.

Copyright and License Information

Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 Python Software Foundation. All rights reserved.

Copyright (c) 2000 BeOpen.com. All rights reserved.

Copyright (c) 1995-2001 Corporation for National Research Initiatives. All rights reserved.

Copyright (c) 1991-1995 Stichting Mathematisch Centrum. All rights reserved.

See the file LICENSE for information on the history of this software, terms & conditions for usage, and a DISCLAIMER OF ALL WARRANTIES.

This Python distribution contains no GNU General Public License (GPL) code, so it may be used in proprietary projects. There are interfaces to some GNU code but these are entirely optional.

All trademarks referenced herein are property of their respective holders.

cpython open pull requests (View All Pulls)
  • Prevent ftplib from hanging on wrong PASV response
  • Use OPENSSL_NO_EGD from OpenSSL headers
  • Add support for EVFILT_USER kqueue filter.
  • Issue24773 - PEP 495 implementation
  • fix http libraries
  • removed empty definition of REQN preprocessor macro because it causes…
  • added initial .travis.yml
  • setup.py via run_setup shall think it is __main__
  • Add has_flag method to CCompiler.
  • Add set_verify_callback to ssl.SSLContext
  • Typos
  • Update contextlib.py
  • attempt to fix issue23395
  • typo
  • Fix to detect more JPEG images
  • Intmax
  • Add tp_fastcall to PyTypeObject
  • typing.Union raises RecursionError when comparing Union to other type
  • Pep540
  • multiprocessing.Queue.get handling of timeout<=0 to match queue.Queue.get.
  • bpo-30281: fix the default value for stop in PySlice_Unpack()
  • bpo-30258: regrtest: Fix run_tests_multiprocess()
  • bpo-29243: Fix Makefile with respect to --enable-optimizations
  • bpo-30271: Make sqlite3 statement cache optional
  • bpo-30270: Remove sqlite3.Cache display method
  • [2.7] bpo-8450: BadStatusLine('') better message
  • bpo-30266: support "= None" pattern in AbstractContextManager
  • bpo-30262: Don't expose sqlite Cache and Statement
  • bpo-30095: Customizing HTMLCalendar
  • fix dangling mention of key=str.lower in heapq doc
  • bpo-18669: Corrected documentation for window.chgat in curses module
  • bpo-28087: Detect broken poll() on macOS Sierra
  • bpo-30248: Convert boolean arguments only once in _json.
  • bpo-30247: Add os.PathLike handle for finder and loader
  • bpo-30246: fix several error messages which only mention bytes in struct
  • bpo-30231: Remove skipped test_imaplib tests
  • bpo-30242: resolve some undefined behaviours in struct
  • bpo-30110: fix resource leak in test_asyncio.test_events
  • bpo-30241: implement contextlib.AbstractAsyncContextManager
  • bpo-28326: Fixes multiprocessing.Process depends on sys.stdout being open
  • bpo-30229: BufferedRandom.flush() avoids lseek
  • bpo-30228: TextIOWrapper uses abs_pos, not tell()
  • bpo-19903: Change to inspect.signature for calltips
  • bpo-30224: remove outdated checks in struct
  • bpo-15987: Add ast.AST class richcompare methods
  • bpo-30218: support PathLike in shutil.unpack_archive
  • bpo-26143: Ensure IDLE's stdlib imports are from the stdlib
  • bpo-29136: Add TLS 1.3 cipher suites and OP_NO_TLSv1_3
  • [WIP PEP draft] bpo-25658: Implement Thread Specific Storage (TSS) API
  • bpo-30183: Fixes HP-UX cc compilation error in pytime.c
  • bp030290: IDLE test_help_about: edit and add test.
  • bpo-30493: Increase base64 coverage
  • bpo-29626: spacing issue when using help in argparse
  • bpo-16500: Use constants for os.register_at_fork()
  • bpo-11874 argparse assertion failure
  • bpo-30490: Allow to the Event.set method pass an exception
  • bpo-30485: support a default prefix mapping in ElementPath
  • bpo-30463 ABC has empty __slots__, with unittest
  • bpo-14111: IDLE: Add interrupt handle when open debugger
  • bpo-13349: repr object in tuple.index ValueError message
  • bpo-30475: Mark PyDict_GetItemWithError() as returning a borrowed reference.
  • [3.6] Change six instances of "an" to "a"
  • bpo-15786: IDLE: Fix behavior when mouse click at autocompletetion window
  • bpo-30438 - skipped test demonstrating bug
  • bpo-30451: parse windows path error in webbrowser.get() and lead to webbrowser.Error: could not locate runnable browser
  • bpo-30449: Improve __slots__ documentation
  • bpo-30368: Update build_ssl.py to restore Perl-less building
  • bpo-30466: Add brief explanation of classes to tutorial
  • bpo-30439: Add some helpful low-level functions for subinterpreters.
  • bpo-30465: Fix lineno and col_offset in fstring AST nodes
  • Protect C-implemented context managers, like lock, from ctrl-C. Fixes bpo-29988.
  • bpo-30464: Fix comment in gammavariate
  • bpo-30462: urllib: NO_PROXY env. variable can contain domain with asterisk
  • bpo-30461: glob: sort the resulting list
  • bpo-30457: Add new pending method for asyncio lock primitives
  • bpo-25430: improve performance of IPNetwork.__contains__
  • bpo-30450: Pull Windows dependencies from GitHub rather than svn
  • [trivial] Update Python Folder.icns icon file to match new macOS look
  • [3.5] bpo-29334: Fix ssl.getpeercert for auto-handshake (GH-1769)
  • [3.6] bpo-29334: Fix ssl.getpeercert for auto-handshake (GH-1769)
  • bpo-32678: inspect: Import ast lazily
  • bpo-30622: Change NPN detection
  • [DO NOT MERGE] bpo-32677: Add str.isascii()
  • [2.7] bpo-30622: Change NPN detection: (GH-2079)
  • Fix wrong assert in unicodeobject
  • bpo-32674: minor documentation fix for '__import__'
  • bpo-32591: fix abort in _PyErr_WarnUnawaitedCoroutine during shutdown
  • bpo-29237: Add missing NEWS entry
  • bpo-32672: Add then execution for chaining python futures issue
  • bpo-32657 Removing mutable entry from send_message
  • [2.7] bpo-32640: Clarify the behavior of str.join and unicode object
  • [2.7] bpo-32304: Fix distutils upload for tar files ending with b'\r' (GH-5264)
  • [3.6] bpo-32304: Fix distutils upload for tar files ending with b'\r' (GH-5264)
  • bpo-27931: Fix email address header parsing error
  • bpo-32660: Solaris should support constants like termios' FIONREAD
  • bpo-32670: Enforce PEP 479.
  • bpo-32583: Fix possible crashing in decode error handler
  • bpo-27505: Retrofit module __class__ documentation from 3.7
  • bpo-27505: Add version_added to docs for module attributes
  • bpo-10381: Test that new_timezone can return the UTC singleton
  • bpo-32663 Make SMTPUTF8SimTests run
  • bpo-29708: support SOURCE_DATE_EPOCH for build info
  • bpo-31972: Improve docstrings for pathlib classes
  • bpo-12706: timeout sentinel in ftplib and poplib documentation
  • bpo-32628: support DirectoryIndex for http server
  • bpo-32659: Solaris "stat" should support "st_fstype"
  • [WIP] bpo-32654: Fixes for Android API 19
  • bpo-32623: Resize dict after del/pop
  • bpo-32637: Set sys.platform to "android" on Android
  • bpo-30491: Add unawaited coroutine tracking mode
  • bpo-32370: Use the correct encoding for ipconfig output in the uuid module
  • Fix installation instructions for *nix
  • bpo-32792: Preserve mapping order in ChainMap()
  • bpo-32394: (for 3.6) Remove some TCP options on older version Windows.
  • bpo-32773: added --option to allow changing the preserve_mode for copy_file()
  • bpo-31937: Add the term "dunder" to the glossary
  • WIP: fix the build of travis
  • bpo-1100942: Add datetime.time.strptime and datetime.date.strptime
  • bpo-29248: Fix readlink bug os
  • bpo-32782: PEP3118 itemsize of an empty ctypes array should not be 0
  • [2.7] Fix typo in Include/objimpl.h, the word "has" was missing (GH-5568)
  • [3.6] Fix typo in Include/objimpl.h, the word "has" was missing (GH-5568)
  • [3.7] Fix typo in Include/objimpl.h, the word "has" was missing (GH-5568)
  • bpo-32622: Native sendfile on windows
  • bpo-32780: Fix the PEP3118 format string for ctypes.Structure
  • remove mercurial dot files
  • 2.7 bpo-27643 - Test_C test case needs "signed short" bitfields, but the IBM XLC compiler (on AIX) does not support this (GH-5164)
  • bpo-32613: Update window FAQ
  • bpo-32647: Link ctypes extension with libdl.
  • bpo-9216: [WIP] Support OpenSSL FIPS mode.
  • [3.6] bpo-32720: Fixed the replacement field grammar documentation. (GH-5544)
  • bpo-5594: IDLE startup configuration
  • bpo-32728: Add compresslevel support for zipfile and LZMA
  • bpo-32394: Remove some TCP options on old version Windows.
  • Add short-circuit for doc changes to AppVeyor
  • fix error message when hashlib.scrypt function returns 0
  • bpo-32604: Make _xxsubinterpreters build on Windows
  • bpo-32756: fix(Lib: argparse): don't raise exception when encountering uknown explicit arg
  • zlib: export Z_RLE
  • bpo-16024: Doc cleanup regarding path_fd, dir_fd, follow_symlinks
  • bpo-32949: Simplify "with"-related opcodes.
  • bpo-25059: Clarify print separator usage in tutorial
  • bpo-32946: Speed up "from ... import ..." from non-packages.
  • Delete a broken threading.local example
  • bpo-32943: Fix confusing error message for rot13 codec
  • Condense readme.rst
  • Remove support for instantiation of SSLSocket
  • bpo-32940: IDLE: Simplify StringTranslatePseudoMapping in pyparse
  • bpo-31355: Travis-CI: re-enable macOS job
  • Add two missing error checks in hamt.c
  • bpo-32146: Add documentation about frozen executables on Unix
  • bpo-32912: Upgrade warning for invalid escape sequences from silent to non-silent
  • bpo-32932: More revealing error message when non-str objects in __all__
  • bpo-32917: make ConfigParser blank line writing controllable
  • bpo-32925: Optimized iterating and containing test for literal lists
  • Copy NULL char in strncpy
  • bpo-32922: dbm.open() now encodes filename with the filesystem encoding.
  • bpo-32759: Free unused arenas in multiprocessing.heap
  • bpo-32489: Allow 'continue' in 'finally' clause.
  • bpo-32913: Added re.Match.groupdict example to regex HOWTO
  • bpo-10381, bpo-32403: What's new entries for changes to datetime
  • bpo-32907: pathlib: Fix test_resolve_common failure on Windows
  • bpo-32904: Fix a potential crash in os.chdir() and os.getcwd() on Windows
  • bpo-32903: Fix a memory leak in os.chdir() on Windows
  • Replaced some instances of ClassName.method with super().method.
  • bpo-32893: ast.literal_eval() no longer accepts booleans as numbers in AST.
  • bpo-32008: Prefer client or TLSv1_2 in examples
  • [master] Gitignore gmon.out
  • bpo-32890: os: Use errno instead of GetLastError() where appropriate
  • [2.7] bpo-32500: Correct the documentation for PySequence_Size() and PySequence_Length() (GH-5767)
  • bpo-18802: ipaddress documentation changes
  • bpo-33051: IDLE: Separate editor options from the general tab in config
  • bpo-33034: Added explicit exception message when cast fails
  • bpo-27428: Fix WindowsRegistryFinder documentation
  • bpo-32972: Unittest: Add a _runTestMethod to TestCase (don't merge)
  • bpo-28626: rearrange discussion of output formatting to encourage f-strings
  • bpo-33012: Fix invalid function cast warnings with gcc 8 for METH_NOARGS
  • Fix error message in sqlite connection thread check
  • bpo-33027: Fix cgi.FieldStorage to handle Content-Disposition filename* with encoding according to RFC5987
  • [2.7] bpo-33021: Release the GIL during fstat() calls (GH-6019)
  • bpo-27683: Fix a regression for ipaddress networks that hosts() result
  • bpo-33006 - Correct filter doc string to clarify 2nd argument can be iterable
  • bpo-8840: Improve docstrings for truncate()
  • bpo-33015: Add a wrapper for thread function in PyThread_start_new_thread
  • bpo-31226: Distinguish win junction links against volume mount points
  • [3.4] bpo-33001: Prevent buffer overrun in os.symlink (GH-5989)
  • [3.5] bpo-33001: Prevent buffer overrun in os.symlink (GH-5989)
  • bpo-22102: Fixes zip files with disks set to 0
  • bpo-28955 : Clarified comparisons between Nan and number in reference…
  • bpo-32933: Implement dunder iter method on mock_open
  • bpo-32989: IDLE - fix pyparse.find_good_parse_start and bad editor call
  • bpo-28124: clarify the two wrap_socket() are different
  • bpo-25427: Remove pyvenv
  • bpo-32986: multiprocessing: change default pool size to look for NCPUS envvar be…
  • bpo-32968: Fraction modulo infinity should behave consistently with other numbers
  • bpo-32978: Fix reading huge floats in AIFC files.
  • bpo-32056: Improve exceptions in aifc, wave and sunau.
  • bpo-32818: Fix a subprocess crash in Windows compatiblity mode
  • bpo-33018: Improve issubclass() error checking and message.
  • bpo-32972: Add coroutine support to unittest
cpython questions on Stackoverflow (View All Questions)
  • Strange import error in Emscripten cross-compiled CPython
  • Trace Python bytecodes through CPython execution
  • Why is Jython much slower than CPython, despite the JVM's advances?
  • CPython - get String from PyList in C function
  • CPython - Convert (PyIntObject*) to 'int' type in C
  • CPython - Read Python Dictionary (keys/values) inside a C Function Passed as argument
  • ValueError: failed to parse CPython sys.version: '3.5.1 |Anaconda 2.4.1 (64-bit)
  • Does the Cpython VM execute a C code for every opcode?
  • ValueError: failed to parse CPython sys.version after using conda command
  • Benchmarks for CPython
  • Why CPython need Bytecode like LOAD_X?
  • Using NumPy and Cpython with Jython
  • "Incorrect number of bindings supplied" cPython 3.5 SQLite3 VS15
  • Does cPython use multiple cores for built-in functions such as sort, any, all?
  • Cython: Access to private C members of CPython object
  • CPython interactive readline β€” better backwards deletion of words
  • "unsupported operand type(s) for /: 'list' and 'list'" in cpython
  • In hash collision, how does CPython know which value is stored at index HASHVALUE and which value is stored at RESOLUTIONINDEX
  • How to use native Cpython extensions in Jython
  • How to change python's "full name" (something like `cpython-34m-x86_64-linux-gnu`)?
  • Forcing modules to run in PyPy from a CPython script (run PyPy on part of the code)?
  • How does CPython match variables to values?
  • CPython - Making the date show up using the date on your computer
  • Is there an RPython interpreter that runs under CPython?
  • Memory leaking in cpython 2.7
  • Why is my shared library given the suffix ".cpython-33m.so"?
  • PyCharm ValueError: failed to parse CPython sys.version
  • Installing modules with pip, "failed to parse CPython sys.version"
  • WCF with netTcpBinding + cPython
  • How exactly is Python Bytecode Run in CPython?
Other projects in Python