python/cpython
View on GitHub ↗ ★ 77,791 Python
The Python programming language
548 mentions on Hacker News by 400 people: 44 stories, 504 comments · first 2014-12-30 · latest 2026-10-27
20082026
-
…to skip calls to self.save_global() in pickle._Pickler.save() if condition(pickle_protocol) here https://github.com/python/cpython/blob/main/Lib/pickle.py#L5... and #L585 , and also in the save_type() dispatch table at #L1123 .
comment by westurner · 2024-03-15 · in Insecurity and Python Pickles -
…as well (it does seem to miss earliest advisories like PSF-2005-001 and PSF-2006-001 though). [1] https://github.com/python/cpython/issues/48739 [2] https://github.com/psf/advisory-database/
comment by lifthrasiir · 2024-03-13 · in C++ Safety, in Context -
…it be to create a pickle protocol that does not exec or eval code? python/cpython//Lib/pickle.py: https://github.com/python/cpython/blob/main/Lib/pickle.py python/cpython//Lib/pickletools.py: https://github.com/python/cpython/blob/main/Lib/…
comment by westurner · 2024-03-12 · in Insecurity and Python Pickles -
How do you mean? CPython uses karatsuba's for large numbers which should be asymptotically fast https://github.com/python/cpython/blob/d864b0094f9875c5613cb...
comment by csjh · 2024-03-08 · in Eloquent JavaScript 4th edition (2024) -
…their own compiler for a full software stack. [1] https://github.com/spack/spack/issues/38724 and https://github.com/python/cpython/issues/106424 [2] https://github.com/spack/spack/issues/37172#issuecomment-181...
comment by stabbles · 2024-03-07 · in FreeBSD has a(nother) new C compiler: Intel oneAPI DPC++/C++ -
…e.g to see the state of the cpython main branch on January 1 we can ask for `main@{2024-01-01}`: https://github.com/python/cpython/tree/main@{2024-01-01} This does not walk the commit history, but instead the server-side reflog, so it’s…
comment by semiquaver · 2024-02-23 · in Hidden GitHub commits and how to reveal them -
…Python [0]. C++ may not work, but most other languages (especially VM-based) can and many do. [0] https://github.com/python/cpython/blob/3.12/Lib/tkinter/__in...
comment by lolinder · 2024-02-14 · in PySimpleGUI 4 will be sunsetted in Q2 2024 -
…(which I'm sure would raise objections over the volume of code – https://github.com/python/cpython/blob/main/Lib/collections/... – but a lot of it is providing syntactic sugar).
comment by adw · 2024-02-13 · in K Isn't Lisp (2004) -
…It was quite annoying to find the source of this problem and to find workarounds for it. https://github.com/python/cpython/issues/113939 Another side node: Bloomberg has a couple of nice open source projects. E.g. I just realized, PyStack…
comment by albertzeyer · 2024-02-10 · in Memray – A Memory Profiler for Python -
for those who missed it, the PR description is a poem https://github.com/python/cpython/pull/113465
comment by sigma5 · 2024-01-11 · in Python 3.13 Gets a JIT -
The PR message with a riff off the Night Before Christmas is gold. https://github.com/python/cpython/pull/113465
comment by thetinymite · 2024-01-09 · in Python 3.13 Gets a JIT -
…they heard it exclaim, as it traced out of sight, "Happy JIT-mas to all, and to all a good night!" https://github.com/python/cpython/pull/113465
comment by divbzero · 2024-01-09 · in Python 3.13 Gets a JIT -
…optimization tiers, etc. It seems the JIT is how at least part of that effort will materialize: https://github.com/python/cpython/issues/113710 > We're getting a JIT. Now it's time to optimize the traces to pass them to the JIT.
comment by lumpa · 2024-01-09 · in Python 3.13 Gets a JIT -
…about implementing "AIA chaising" to handle server misconfigurations as described in this article: https://github.com/python/cpython/issues/62817 . The article mentions this approach in the last paragraph. There is at least one 3rd party…
comment by aflukasz · 2024-01-08 · in The browser's biggest TLS mistake -
…and that's been the case for years. The set implementation points out some of the differences, at https://github.com/python/cpython/blob/main/Objects/setobjec... : Unlike the dictionary implementation, the lookkey function can return NULL…
comment by eesmith · 2024-01-03 · in 50 Algorithms Every Programmer Should Know (Second Edition) -
…that object then it raises an exception that triggers a REPL to cleanly quit. The code is here: https://github.com/python/cpython/blob/3.12/Lib/_sitebuiltin...
comment by andrewaylett · 2023-12-28 · in You can't do that because I hate you -
If you read nothing else, the commit message adding JIT support is worth your time: https://github.com/python/cpython/pull/113465
comment by ath0 · 2023-12-27 · in What's up Python? Epic CPython commit, Django 5 and 2FA for PyPI -
…compact and have one more spare bit to prevent an overflow. That sounds way more restrictive. [1] https://github.com/python/cpython/blob/36adc79041f4d2764e1da... [2] https://github.com/python/cpython/blob/36adc79041f4d2764e1da... An…
comment by lifthrasiir · 2023-12-26 · in A copy-and-patch JIT compiler for CPython -
It's all explained, including a 50 minutes talk, in the linked issue: https://github.com/python/cpython/issues/113464
comment by tecleandor · 2023-12-26 · in A copy-and-patch JIT compiler for CPython -
…at the moment it still ignores cgroups, it's just a wrapper around sched_getaffinity(). https://github.com/python/cpython/blob/6a69b80d1b1f3987fcec3...
comment by itamarst · 2023-12-19 · in How many CPU cores can you use in parallel? -
…appears to have switched to SipHash 1-3 for strings, from 2-4, following the lead of Rust and Ruby. https://github.com/python/cpython/issues/73596 However, Python does not use it for integers; >>> hash(10) 10 >>> hash(100) 100 >>>…
comment by eesmith · 2023-12-11 · in How many lines of C it takes to execute a + b in Python -
…an unmodified Python 3.4 binary". Since then they switched from siphash24 to the faster siphash13. https://github.com/python/cpython/pull/28752
comment by eesmith · 2023-12-11 · in How many lines of C it takes to execute a + b in Python -
CPython is evaluating the options in this guide: https://github.com/python/cpython/issues/112301#issue-200494...
comment by SethMLarson · 2023-11-30 · in Compiler Options Hardening Guide for C and C++ -
You can look at the history of PyObject yourself: https://github.com/python/cpython/commits/main/Include/objec... . None of these changes were done because of weird CPU errata that meant that making the header bigger was a performance win.…
comment by saagarjha · 2023-11-30 · in Rust std fs slower than Python? No, it's hardware -
…Windows and macOS builds. [1] https://sources.debian.org/src/sqlite3/3.16.2-5%2Bdeb9u1/deb... [2] https://github.com/python/cpython/pull/31655
comment by lifthrasiir · 2023-11-28 · in Antirez' tiny JSON selector library -
…is the complexity? I've never seen this make debugging harder, it's just an additional type. [1] https://github.com/python/cpython/blob/d9fc15222e96942e30ea8...
comment by dazzlefruit · 2023-11-23 · in Writing and linting Python at scale -
…OCaml: https://v2.ocaml.org/manual/lex.html#sss:keywords Python: https://github.com/python/cpython/blob/3.12/Lib/keyword.py Java (I think these are the current ones): https://docs.oracle.com/javase/tutorial/java/nutsandbolt
comment by ReleaseCandidat · 2023-11-20 · in Roc – A fast, friendly, functional language -
…(quoted because we're all aware of the challenges these conversions pose each and every time). [0] https://github.com/python/cpython/issues/81669
comment by qwertox · 2023-11-19 · in datetime.utcnow() is now deprecated -
oops I misread it.. seems it was rejected because it was not standard enough... https://github.com/python/cpython/issues/83479#issuecomment-...
comment by theamk · 2023-11-13 · in Reasons to Prefer Blake3 over Sha256 -
…In practice, what that means is if there is a bug report, like https://github.com/python/cpython/issues/71964 from 2016, then the fix may languish for years as no one in the core team is able to resolve it. You can see se
comment by eesmith · 2023-11-01 · in My User Experience Porting Off Setup.py -
…details follow: That string is output by cpython to contain the contents of the __DATE__ C macro ( https://github.com/python/cpython/blob/fa35b9e89b2e207fc8bae... which calls to https://github.com/python/cpython/blob/fa35b9e89b2e207fc8bae..…
comment by Smaug123 · 2023-10-29 · in NixOS Reproducible Builds: minimal ISO successfully independently rebuilt -
…at least the last decade and a half, as long as I've been paying attention. It's even written in C: https://github.com/python/cpython/blob/d9246c7b734b8958da034... .
comment by nonameiguess · 2023-10-18 · in What's New in Python 3.12 -
…what signal was caught and executes the signal handler, before trying to do the remaining write: https://github.com/python/cpython/blob/5f7aba938cf5007b6f954... Here's even a test for it: https://github.com/python/cpython/blob/5f7aba938cf50…
comment by skitter · 2023-10-16 · in Should you be scared of Unix signals? (2016) -
…[0] just as well as in subinterpreters (and currently isn't implemented in either one). [0] https://github.com/python/cpython/issues/89467
comment by ptx · 2023-10-02 · in Python 3.12 -
…then no, it doesn't. None of the variables in the outer scope are captured in the class instance. https://github.com/python/cpython/blob/main/Lib/functools.py... Here's a simplified version of that code that demonstrates the pattern. class…
comment by Spivak · 2023-09-20 · in Fixing for loops in Go 1.22 -
…urllib library recently had a CVE for failing to strip whitespace from the scheme and domain. https://github.com/python/cpython/issues/102153
comment by richbell · 2023-09-07 · in When URL parsers disagree -
…off made for a slightly more efficient implementation. The initial commit of these two functions - https://github.com/python/cpython/commit/96229b191814556622b... - is exactly as Guido’s suggestion, but does include a test case for empty…
comment by rickboyce · 2023-08-25 · in Why does all() return True if the iterable is empty? -
…3 >>> (x % 1).limit_denominator(9999) Fraction(375, 1757) The mediant-based implementation is at https://github.com/python/cpython/blob/607f18c89456cdc9064e2...
comment by eesmith · 2023-08-15 · in Decimal to fraction -
…will also do something like that, specifically it snips out repeated lines in self-recursive calls: https://github.com/python/cpython/issues/71010 >>> a() Traceback (most recent call last): File "<stdin>", line 1, in <module> File…
comment by masklinn · 2023-08-08 · in Go 1.21 Released -
…global functions (I overlooked it at first). The library makes this on the fly with a nice trick: https://github.com/python/cpython/blob/f978a79130133de1cf264... they make a global function for each of methods of the turtle class by means…
comment by MichaelMoser123 · 2023-08-05 · in Ways to teach kids to code (2016) -
…on any Python 3.8 or greater running on MacOS, enforced via "platform == darwin" runtime check: https://github.com/python/cpython/pull/13626/files#diff-6836... You can check the default process-start method of your Python's multiprocessing…
comment by zbentley · 2023-07-31 · in What's up, Python? The GIL removed, a new compiler, optparse deprecated -
…issue below, this can occasionally cause issues, but in my experience it does so rarely if ever. 1. https://github.com/python/cpython/issues/77906 2. https://docs.python.org/3/library/multiprocessing.html#conte...
comment by zbentley · 2023-07-31 · in What's up, Python? The GIL removed, a new compiler, optparse deprecated -
…> Can we get an in-python fork() mechanic ... please? You probably want Multiple Subinterpreters: https://github.com/python/cpython/issues/84692
comment by pritambaral · 2023-07-29 · in Intent to approve PEP 703: making the GIL optional -
…trace from quite a way back when e.g. the first commit in which I can find the len() builtin ( https://github.com/python/cpython/commit/c636014c430620325f8... ) also has calls to file.read and list.append, and the first python-level…
comment by masklinn · 2023-07-25 · in Python: Overlooked core functionalities -
…s://github.com/dabeaz-course/practical-python/blob/maste... [3] https://peps.python.org/pep-0617/ [4] https://github.com/python/cpython/blob/3.8/Grammar/Grammar [5] https://github.com/python/cpython/blob/1663f8ba8405fefc82f74... [6]…
comment by jamesdutc · 2023-07-19 · in Advanced Python Mastery -
…the interpreter code: 1. PyList_SetItem calls Py_XSETREF(dst, src) where dst is the list position: https://github.com/python/cpython/blob/ee46cb6aa959d891b0a48... 2. Py_XSETREF calls Py_XDECREF on the old item:…
comment by js2 · 2023-07-09 · in If PEP 703 is accepted, Meta can commit three engineer-years to no-GIL CPython -
…for CPython and Postgre - which lines of code would you need to touch to achieve these purposes? https://github.com/python/cpython In json module: add parameter to load() and loads() that when True only allows spaces as whitespace…
comment by SonOfLilit · 2023-07-04 · in Leveling up in job interviews for software engineers (2022) -
Oh, and multi-line statements will be supported from Python 3.13 ( https://github.com/python/cpython/issues/103124 )
comment by johnnymellor · 2023-06-29 · in CLI tools hidden in the Python standard library -
…or probably a PEP to add new functionality to exec. I'll file a bug against Python soon. [1]: https://github.com/python/cpython/blob/25a64fd28aaaaf2d21fae... [2]: https://github.com/python/cpython/blob/25a64fd28aaaaf2d21fae...
comment by johnnymellor · 2023-06-29 · in CLI tools hidden in the Python standard library -
…because most operating systems have sqlite3 and python3, but are missing the SQLite CLI. [0]: https://github.com/python/cpython/blob/3fb7c608e5764559a718c... [1]: https://docs.python.org/3.12/library/sqlite3.html#command-li...
comment by polyrand · 2023-06-29 · in CLI tools hidden in the Python standard library