HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
python
cpython
Python2014–2026
python / cpython

cpython

The Python programming language

400Distinct people
547Mentions
3Explicit recommenders
78.2KGitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

The Python programming language

GitHub

Where it is used

  • AWS Lambda — AWS Lambda provides a managed runtime and container base image for Python 3.11 that runs on CPython’s interpreter improvements. It uses CPython’s specialization adaptive interpreter features to improve Lambda workloads’ performance. Source
  • abridging clinical conversations using python — “In addition to the above-mentioned instances, we also use Python widely in conjunction with several Google Cloud Platform (GCP) services and to set up other monitoring and debugging tools.” Source
  • 4 more documented examples

What people are saying

I love the description in the draft PR: 'Twas the night before Christmas, when all through the code Not a core dev was merging, not even Guido; The CI was spun on the PRs with…

divbzero used a recommendation phrase. 3 indexed comments match. This is a phrase match, not a verdict.

Favorable Commenters discuss Tim Peters' contributions to CPython, including int-to-str conversion and Timsort. The tone is respectful and appreciative of his technical achievements.

This week’s discussion is favorable. This is not a standing endorsement. Read the supporting reply

Also in these discussions

  • golang/go · linked in 2 of the same discussions
  • nodejs/node · linked in 2 of the same discussions
  • ruby/ruby · linked in 2 of the same discussions

Mentioned in the same Hacker News threads. That is not proof they are substitutes.

This week on Hacker News

Favorable

Commenters discuss Tim Peters' contributions to CPython, including int-to-str conversion and Timsort. The tone is respectful and appreciative of his technical achievements.

Supporting reply 1 · Supporting reply 2 · 2 discussions summarized

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 5:04:57 PM UTC.

Tim Peters has died direct repository linkDebated

The discussion centers on the death of Python contributor Tim Peters, with widespread tributes to his technical legacy like Timsort and the Zen of Python clashing with heated disagreements over his controversial suspension by the Python Software Foundation. While many users urge focusing solely on his contributions, others argue that ignoring the PSF's handling of his ban is a disservice to his memory and an endorsement of flawed community governance.

189 readable replies · Supporting reply 1 · Supporting reply 2 · Supporting reply 3 · Supporting reply 4
Timsort direct repository link

Read the discussion on HN. A full-thread summary is not available yet.

Adapting CPython for Yk project name in title

Read the discussion on HN. A full-thread summary is not available yet.

Showing the three threads with the most distinct people linking this repo, from 5 threads this week.

Mentions over time

HN mentions by year547 dated mentions

Observed mentions: 2014-12-30 12:04:55 UTC to 2026-10-27 17:34:51 UTC.

0204060802014-01-01 00:00:00 UTC to 2015-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments20142015-01-01 00:00:00 UTC to 2016-01-01 00:00:00 UTC (exclusive): 4 mentions; 0 submissions, 4 comments2016-01-01 00:00:00 UTC to 2017-01-01 00:00:00 UTC (exclusive): 20 mentions; 2 submissions, 18 comments2017-01-01 00:00:00 UTC to 2018-01-01 00:00:00 UTC (exclusive): 36 mentions; 4 submissions, 32 comments2018-01-01 00:00:00 UTC to 2019-01-01 00:00:00 UTC (exclusive): 28 mentions; 2 submissions, 26 comments2019-01-01 00:00:00 UTC to 2020-01-01 00:00:00 UTC (exclusive): 33 mentions; 4 submissions, 29 comments2020-01-01 00:00:00 UTC to 2021-01-01 00:00:00 UTC (exclusive): 54 mentions; 2 submissions, 52 comments20202021-01-01 00:00:00 UTC to 2022-01-01 00:00:00 UTC (exclusive): 62 mentions; 3 submissions, 59 comments2022-01-01 00:00:00 UTC to 2023-01-01 00:00:00 UTC (exclusive): 63 mentions; 6 submissions, 57 comments2023-01-01 00:00:00 UTC to 2024-01-01 00:00:00 UTC (exclusive): 64 mentions; 4 submissions, 60 comments2024-01-01 00:00:00 UTC to 2025-01-01 00:00:00 UTC (exclusive): 70 mentions; 6 submissions, 64 comments2025-01-01 00:00:00 UTC to 2026-01-01 00:00:00 UTC (exclusive): 72 mentions; 6 submissions, 66 comments2026-01-01 00:00:00 UTC to 2027-01-01 00:00:00 UTC (exclusive): 40 mentions; 5 submissions, 35 comments. Incomplete calendar period.2026*

* An incomplete calendar period is marked with an outlined bar. Its count is not directly comparable with a full period.

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20142014-01-01 00:00:00 UTC2015-01-01 00:00:00 UTC101
20152015-01-01 00:00:00 UTC2016-01-01 00:00:00 UTC404
20162016-01-01 00:00:00 UTC2017-01-01 00:00:00 UTC20218
20172017-01-01 00:00:00 UTC2018-01-01 00:00:00 UTC36432
20182018-01-01 00:00:00 UTC2019-01-01 00:00:00 UTC28226
20192019-01-01 00:00:00 UTC2020-01-01 00:00:00 UTC33429
20202020-01-01 00:00:00 UTC2021-01-01 00:00:00 UTC54252
20212021-01-01 00:00:00 UTC2022-01-01 00:00:00 UTC62359
20222022-01-01 00:00:00 UTC2023-01-01 00:00:00 UTC63657
20232023-01-01 00:00:00 UTC2024-01-01 00:00:00 UTC64460
20242024-01-01 00:00:00 UTC2025-01-01 00:00:00 UTC70664
20252025-01-01 00:00:00 UTC2026-01-01 00:00:00 UTC72666
2026 (partial)2026-01-01 00:00:00 UTC2027-01-01 00:00:00 UTC40535

What Hacker News says

72 sources
Thanks :), that was indeed my intention. I think the previous 3.14 mistake was actually a good one on hindsight, because if I didn't publicize our work early, I wouldn't have caught the attention of Nelson. Nelson also probably wouldn't have spent one month digging into the Clang 19 bug. This also meant the bug wouldn't have been caught in the betas, and might've been out with the actual release, which would have been way worse. So this was all a happy accident on hindsight that I'm grateful for as it means overall CPython still benefited! Also this time, I'm pretty confident because there are two perf improvements here: the dispatch logic, and the inlining. MSVC can actually convert switch-case interpreters to threaded code automatically if some conditions are met [1]. However, it does not seem to do that for the current CPython interpre
Read the rest
ter. In this case, I suspect the CPython interpreter loop is just too complicated to meet those conditions. The key point also that we would be relying on MSVC again to do its magic, but this tail calling approach gives more control to the writers of the C code. The inlining is pretty much impossible to convince MSVC to do except with `__forceinline` or changing things to use macros [2]. However, we don't just mark every function as forceinline in CPython as it might negatively affect other compilers. [1]: https://github.com/faster-cpython/ideas/issues/183 [2]: https://github.com/python/cpython/issues/121263
In Python 3.15’s interpreter for Windows x86-64 should hopefully be 15% faster
The money shot (wish this were included in the blog post): # if defined(_MSC_VER) && !defined(__clang__) # define Py_MUSTTAIL [[msvc::musttail]] # define Py_PRESERVE_NONE_CC __preserve_none # else # define Py_MUSTTAIL __attribute__((musttail)) # define Py_PRESERVE_NONE_CC __attribute__((preserve_none)) # endif https://github.com/python/cpython/pull/143068/files#diff-45b... Apparently(?) this also needs to be attached to the function declarator and does not work as a function specifier: `static void *__preserve_none slowpath();` and not `__preserve_none static void *slowpath();` (unlike GCC attribute syntax, which tends to be fairly gung-ho about this sort of thing, sometimes with confusing results). Yay to getting undocumented MSVC features disclosed if Microsoft thinks you’re important enough :/
In Python 3.15’s interpreter for Windows x86-64 should hopefully be 15% faster
If there is an audience for release notes I haven't seen anything better than just committing entries to a pre-release folder as you change things and have release automation compile the folder into the actual release notes. Python and many other large projects handle it like this: https://github.com/python/cpython/tree/main/Misc/NEWS.d/next (The release notes for major releases are crafted manually) On the other hand, for many projects you can probably skip release notes: nobody will read them. Even fewer people would read automatically generated changelogs: don't bother setting it up. Releasing instead of deploying from master also implies you took more care than usual, did you? Commit messages make sense for cohesive changes, are they? Didn't think so.
In Ask HN: How do you handle release notes for multiple audiences?
That's a bit reductive. We're talking about something only relevant to retrocomputing (MacOS 9 is unsupported as of early 2002 per Wikipedia) where they could scarcely find evidence of anyone using it at all. And taking these things out of the standard library means that core devs can wash their hands of it. (It also means that a large majority of users can avoid downloading and storing things that will always be useless to them; but nobody seems to care about that sort of thing any more, much to my chagrin.) https://github.com/python/cpython/issues/83534
In System 7 natively boots on the Mac mini G4
Sure, all software is terrible if looking at bug frequency history... https://github.com/python/cpython/issues Griefers ranting about years old _closed_ tickets on v1.0.5 versions on a blog as some sort of proof of lameness... is a poorly structured argument. Julia includes regression testing features built into even its plotting library output, and thus issues usually stay resolved due to pedantic reproducibility. Also, running sanity-checks in any llvm language code is usually wise. Best of luck =3
In Python is not a great language for data science
> what sort of "everything" do you have in mind? I’ll answer in two parts. First, in my original claim: > not everything is necessarily backed by the same kind of heap-allocated memory object. the emphasized part is important. Not all PyObjects are equivalent. Most things in Python are indeed PyObjects of some stripe, but they act very, very differently in some common and performance-sensitive situations. The optimizations discussed in the article are one example: allocations can be re-used, and some more complex data structures are interned/cached (like the short-tuple/short-list optimization, which is similar but not the same to how floats/numbers are reused via allocator pools: https://rushter.com/blog/python-lists-and-tuples/). As you point out, immortal objects and fully preallocated objects are also often special cases vis-a-vis the
Read the rest
performance of creating/discarding objects. Second, you’re wrong. PyObjects do not come into play in a wide variety of cases: - In some (non-default even today, I believe) interpreter configurations, tagged pointers are used for some numbers, removing pointer chasing entirely: https://rushter.com/blog/python-lists-and-tuples/ - Bound method objects can be cached or bypassed, meaning that, while there’s a PyObject for the object being method-called on and the method, there’s sometimes one less PyObject for the binding: https://github.com/python/cpython/issues/70298, with additional/somewhat related info in PEP-580 and PEP-590. PyPy improves on this further: https://doc.pypy.org/en/latest/interpreter-optimizations.htm... - None, False, and other “existential” types are, as you say, PyObjects. But they’re often not accessed as PyObjects and have much lower overhead when used in some cases. Even beyond the performance savings of “is” comparing by address (technically by id(), but that maps to address in CPython), special bytecode instructions like POP_JUMP_IF_NOT_NONE are used to not even introspect the "None" PyObject at all during comparison on some paths. Compare the “dis” output for an “x is None” check versus “x is object()” check to see the tip of the iceberg here. - New/rolling out features like JIT compilation and tail-call optimization further invalidate the historical wisdom to consider everything an object: calling a function may not create PyObjects for argument stacks; accessing known-unchanged object fields may cache accessor results, and so on. But that’s all very new/not released yet; this isn’t meant as a “gotcha” to disprove your claim alone. - While-True/While-1 loops don’t load or interact with the always-truthy constant value’s PyObject at all while they run, in many cases: https://github.com/python/cpython/blob/main/Lib/test/test_pe... - Constant folding (which happens at a higher level than interning and allocation caching) deduplicates pyobjects, allowing identity/equality caches to be used more frequently, and invalidating some of the historical advice to consider nonscalar data structure comparison arbitrarily expensive. - Things like LOAD_ATTR (field/method accessors) retain their own caches, invalidating the wisdom that “obj.thing” always pays a pointer-chasing cost or a binding-creating cost. In many (I’d go as far as guessing it’s “most”, though I don’t have data) looping cases, attribute access on builtins/slotted classes is always returning attributes from the cache without addressing any PyObject fields deeper than a single pointer. That's very different from the overhead of deep diving through the MRO to make a lookup. Is it still a PyObject and still on the heap? Sure! But are you paying the same performance cost as accessing uncached/seven-pointers-away heap data? That answer is much less cut and dried. - Many many more examples I did not think of off the cuff. The usual caveats apply: the above applies largely to CPython, and optimization behavior can and will change between interpreter versions. > Can you give examples of the people involved, or explain why their use cases are not satisfied by native libraries? I mean, the most significant fact in support of the claim is that the above optimizations exist. They were made in response to identified need. Even if you take a highly uncharitable view of CPython maintainers’ priorities, the volume of optimization work speaks to real value delivered by making pure python fast. Beyond that, anecdotally, everywhere I’ve worked on Python--big SaaS platforms, million+ RPS distributed job/queueing systems, scientific research projects--over the last 15 years (hello fellow veteran!) has routinely had engineers who needed to optimize pure-python ops as part of ordinary, mundane, day-job tasks. Even once you remove optimizations they performed that would have been necessary in any language (stop copying large data objects, aggregate I/O, and so on), I’ve worked with … hell, probably hundreds of engineers at this point that occasionally needed to do work like “okay, I’m creating tons of tuples in a loop and it’s slow, how can I make sure to recycle/resize things such that the interning cache handles more of my code?”. Silly tricks like "make some of the tuples longer than they need to be so that length-based interning has cache hits for individual items" are sometimes useful and necessary! Yes, that's seriously funky code and should not be the first resort for anyone (and merits a significant comment/tests re: validating behavior on future interpreters), but sometimes those things produce point fixes which yield multiple percentage points of improvement on memory/GC pressure without introducing new libraries or more pervasive refactors. That's not nothing! Sure, many of those cases would have been faster if numpy or another native-code library were in play. But lots of that code didn’t have or need numpy/extensions for anything else, including it would (depending on how long ago we’re talking) have required arduous installation/compatibility acrobatics, sometimes third-party modules are difficult to get approved, and, well, optimization needs were routinely met by applying a little knowledge of CPython’s optimizations anyway, so I’d say optimizing pure Python is both a valid approach and a common need.
In How often does Python allocate?
A caveat applies to the entire analysis that CPython may be the reference implementation, but it's still just one implementation. This sort of thing may work totally differently in PyPy, and especially in implementations that make use of another garbage-collecting runtime, such as Jython. > Let’s take out the print statement and see if it’s just the addition: Just FWIW: the assignment is not required to prevent optimizing out the useless addition. It isn't doing any static analysis, so it doesn't know that `range` is the builtin, and thus doesn't know that `i` is an integer, and thus doesn't know that `+` will be side-effect-free. > Nope, it seems there is a pre-allocated list of objects for integers in the range of -5 -> 1025. This would account for 1025 iterations of our loop but not for the rest. 1024 iterations, because the check is f
Read the rest
or numbers strictly less than `_PY_NSMALLPOSINTS` and the value computed is `i + 1` (so, `1` on the first iteration). Interesting. I knew of them only ranging up to 256 (https://stackoverflow.com/questions/306313). It turns out (https://github.com/python/cpython/commit/7ce25edb8f41e527ed4...) that the change is barely a month old in the repository; so it's not in 3.14 (https://github.com/python/cpython/blob/3.14/Include/internal...) and won't show up until 3.15. > Our script appears to actually be reusing most of the PyLongObject objects! The interesting part is that it can somehow do this even though the values are increasing throughout the loop (i.e., to values not seen on previous iterations), and it also doesn't need to allocate for the value of `i` retrieved from the `range`. > But realistically the majority of integers in a program are going to be less than 2^30 so why not introduce a fast path which skips this complicated code entirely? This is the sort of thing where PRs to CPython are always welcome, to my understanding. It probably isn't a priority, or something that other devs have thought of, because that allocation presumably isn't a big deal compared to the time taken for the actual conversion, which in turn is normally happening because of some kind of I/O request. (Also, real programs probably do simple arithmetic on small numbers much more often than they string-format them.)
In How often does Python allocate?
C code needs to be updated to be safe in a GIL free execution environment. It is a lot of work! The pervasive problem is that mutable data structures (lists, dict etc) could change at any arbitrary point while the C code is working with them, and the reference count for others could drop to zero if *anyone* is using a borrowed reference (common for performance in CPython APIs). Previously the GIL protected where those changes could happen. In simple cases it is adding a critical section, but often there multiple data structures in play. As an example these are the changes that had to be done to the standard library json module: https://github.com/python/cpython/pull/119438/files#diff-efe... This is how much of the standard library has been audited: https://github.com/python/cpython/issues/116738 The json changes above are in Python 3
Read the rest
.15, not the just released 3.14. The consequences of the C changes not being made are crashes and corruption if unexpected mutation or object freeing happens. Web services are exposed to adversity so be *very* careful. It would be a big help if CPython released a tool that could at least scan a C code base to detect free threaded issues, and ideally verify it is correct.
In The future of Python web services looks GIL-free

Showing the 15 most recent of 72 sources. Enable JavaScript to search and browse every indexed mention.

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.