summaryrefslogtreecommitdiffstats
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
* [3.9] gh-105184: document that marshal functions can fail and need to be ↵Miss Islington (bot)2023-06-051-0/+4
| | | | | | | checked with PyErr_Occurred (GH-105185) (#105221) (cherry picked from commit ee26ca13a129da8cf549409d0a1b2e892ff2b4ec) Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
* [3.9] GH-102126: fix deadlock at shutdown when clearing thread states ↵Kumar Aditya2023-03-281-2/+10
| | | | | (GH-102222) (#102236) (cherry picked from commit 5f11478ce7fda826d399530af4c5ca96c592f144)
* [3.9] Correct CVE-2020-10735 documentation (GH-100306). (#100697)Gregory P. Smith2023-01-202-4/+4
| | | | | | | (cherry picked from commit 1cf3d78c92eb07dc09d15cc2e773b0b1b9436825) (cherry picked from commit 88fe8d701af3316c8869ea18ea1c7acec6f68c04) Co-authored-by: Jeremy Paige <ucodery@gmail.com> Co-authored-by: Gregory P. Smith <greg@krypto.org>
* [3.9] Update copyright years to 2023. (gh-100851)Benjamin Peterson2023-01-081-1/+1
| | | | | | | | | | * [3.9] Update copyright years to 2023. (gh-100848). (cherry picked from commit 11f99323c2ae0ec428c370a335695e3d8d4afc1d) Co-authored-by: Benjamin Peterson <benjamin@python.org> * Update additional copyright years to 2023. Co-authored-by: Ned Deily <nad@python.org>
* [3.9] gh-87604: Avoid publishing list of active per-interpreter audit hooks ↵Steve Dower2022-11-211-0/+2
| | | | via the gc module (GH-99373) (GH-99493)
* [3.9] gh-96848: Fix -X int_max_str_digits option parsing (GH-96988) (GH-97574)Miss Islington (bot)2022-10-041-1/+2
| | | | | | | | | | gh-96848: Fix -X int_max_str_digits option parsing (GH-96988) Fix command line parsing: reject "-X int_max_str_digits" option with no value (invalid) when the PYTHONINTMAXSTRDIGITS environment variable is set to a valid limit. (cherry picked from commit 41351662bcd21672d8ccfa62fe44d72027e6bcf8) Co-authored-by: Victor Stinner <vstinner@python.org>
* [3.9] gh-95778: CVE-2020-10735: Prevent DoS by very large int() (#96502)Gregory P. Smith2022-09-053-2/+164
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Correctly pre-check for int-to-str conversion (#96537) Converting a large enough `int` to a decimal string raises `ValueError` as expected. However, the raise comes _after_ the quadratic-time base-conversion algorithm has run to completion. For effective DOS prevention, we need some kind of check before entering the quadratic-time loop. Oops! =) The quick fix: essentially we catch _most_ values that exceed the threshold up front. Those that slip through will still be on the small side (read: sufficiently fast), and will get caught by the existing check so that the limit remains exact. The justification for the current check. The C code check is: ```c max_str_digits / (3 * PyLong_SHIFT) <= (size_a - 11) / 10 ``` In GitHub markdown math-speak, writing $M$ for `max_str_digits`, $L$ for `PyLong_SHIFT` and $s$ for `size_a`, that check is: $$\left\lfloor\frac{M}{3L}\right\rfloor \le \left\lfloor\frac{s - 11}{10}\right\rfloor$$ From this it follows that $$\frac{M}{3L} < \frac{s-1}{10}$$ hence that $$\frac{L(s-1)}{M} > \frac{10}{3} > \log_2(10).$$ So $$2^{L(s-1)} > 10^M.$$ But our input integer $a$ satisfies $|a| \ge 2^{L(s-1)}$, so $|a|$ is larger than $10^M$. This shows that we don't accidentally capture anything _below_ the intended limit in the check. <!-- gh-issue-number: gh-95778 --> * Issue: gh-95778 <!-- /gh-issue-number --> Co-authored-by: Gregory P. Smith [Google LLC] <greg@krypto.org> Co-authored-by: Christian Heimes <christian@python.org> Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
* gh-93065: Fix HAMT to iterate correctly over 7-level deep trees (GH-93066) ↵Miss Islington (bot)2022-05-241-3/+11
| | | | | | | | | | | | (#93147) Also while there, clarify a few things about why we reduce the hash to 32 bits. Co-authored-by: Eli Libman <eli@hyro.ai> Co-authored-by: Yury Selivanov <yury@edgedb.com> Co-authored-by: Łukasz Langa <lukasz@langa.pl> (cherry picked from commit c1f5c903a7e4ed27190488f4e33b00d3c3d952e5)
* bpo-46831: Update __build_class__ comment (GH-31522)Miss Islington (bot)2022-03-031-3/+2
| | | | | | Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> (cherry picked from commit 81d968b7c30d5b41f3f28b297b7ee5345d569509) Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
* [3.9] bpo-45703: Invalidate _NamespacePath cache on ↵Petr Viktorin2022-02-021-932/+939
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | importlib.invalidate_cache (GH-29384) (GH-30922) (GH-31076) Consider the following directory structure: . └── PATH1 └── namespace └── sub1 └── __init__.py And both PATH1 and PATH2 in sys path: $ PYTHONPATH=PATH1:PATH2 python3.11 >>> import namespace >>> import namespace.sub1 >>> namespace.__path__ _NamespacePath(['.../PATH1/namespace']) >>> ... While this interpreter still runs, PATH2/namespace/sub2 is created: . ├── PATH1 │ └── namespace │ └── sub1 │ └── __init__.py └── PATH2 └── namespace └── sub2 └── __init__.py The newly created module cannot be imported: >>> ... >>> namespace.__path__ _NamespacePath(['.../PATH1/namespace']) >>> import namespace.sub2 Traceback (most recent call last): File "<stdin>", line 1, in <module> ModuleNotFoundError: No module named 'namespace.sub2' Calling importlib.invalidate_caches() now newly allows to import it: >>> import importlib >>> importlib.invalidate_caches() >>> namespace.__path__ _NamespacePath(['.../PATH1/namespace']) >>> import namespace.sub2 >>> namespace.__path__ _NamespacePath(['.../PATH1/namespace', '.../PATH2/namespace']) This was not previously possible. Co-Authored-By: Miro Hrončok <miro@hroncok.cz> Automerge-Triggered-By: GH:encukou
* Update copyright year to 2022. (GH-30335)Miss Islington (bot)2022-01-021-1/+1
| | | | | | Automerge-Triggered-By: GH:benjaminp (cherry picked from commit ba00f0d93a4aea85ae8089f139856a7c450584d7) Co-authored-by: Benjamin Peterson <benjamin@python.org>
* bpo-45614: Fix traceback display for exceptions with invalid module name ↵Irit Katriel2021-11-291-1/+1
| | | | | (GH-29726) (GH-29827) (cherry picked from commit 4dfae6f38e1720ddafcdd68043e476ecb41cb4d5)
* [3.9] bpo-45806: Fix recovery from stack overflow for 3.9. Again. (GH-29640)Mark Shannon2021-11-193-13/+16
| | | Co-authored-by: Łukasz Langa <lukasz@langa.pl>
* [3.9] bpo-42540: reallocation of id_mutex should not force default allocator ↵Sam Gross2021-11-171-1/+4
| | | | | | | | | | (GH-29564) (GH-29600) Unlike the other locks reinitialized by _PyRuntimeState_ReInitThreads, the "interpreters.main->id_mutex" is not freed by _PyRuntimeState_Fini and should not force the default raw allocator.. (cherry picked from commit 736684b1bb67369a2e95a9f621752deead44e7ef) Co-authored-by: Sam Gross <colesbury@gmail.com>
* bpo-45831: _Py_DumpASCII() uses a single write() call if possible (GH-29596) ↵Miss Islington (bot)2021-11-171-0/+22
| | | | | | | | | (GH-29597) If the string is ASCII only and doesn't need to escape characters, write the whole string with a single write() syscall. (cherry picked from commit b919d8105c4d77f00509b6d3ab2073f09db640de) Co-authored-by: Victor Stinner <vstinner@python.org>
* bpo-44959: Add fallback to extension modules with '.sl' suffix on HP-UX ↵Miss Islington (bot)2021-10-221-1/+1
| | | | | | | (GH-27857) (cherry picked from commit 2396fa6537d79554ac694dbd2b0b30eeb3476c80) Co-authored-by: Florin Spătar <florin.spatar@gmail.com>
* [3.9] bpo-45461: Fix IncrementalDecoder and StreamReader in the ↵Serhiy Storchaka2021-10-141-1/+1
| | | | | | | | | | | | "unicode-escape" codec (GH-28939) (GH-28945) They support now splitting escape sequences between input chunks. Add the third parameter "final" in codecs.unicode_escape_decode(). It is True by default to match the former behavior. (cherry picked from commit c96d1546b11b4c282a7e21737cb1f5d16349656d) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* Fix format string in _PyImport_LoadDynamicModuleWithSpec() (GH-28863)Miss Islington (bot)2021-10-121-1/+1
| | | | | (cherry picked from commit f79f3b41c8c1360d4e0ae884a52d0a486974ca53) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* Handle error when PyUnicode_GetLength returns a negative value. (GH-28859)Miss Islington (bot)2021-10-111-0/+3
| | | | | (cherry picked from commit 560a79f94e94de66a18f2a5e4194c2fe51e2adf1) Co-authored-by: Dong-hee Na <donghee.na@python.org>
* Fix a leak in _PyImport_LoadDynamicModuleWithSpec() after failing ↵Miss Islington (bot)2021-10-111-1/+1
| | | | | | | PySys_Audit() (GH-28862) (cherry picked from commit 9883ca498d654a4792d530bd8d6d64fef4dc971c) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [3.9] Fix typos in the Python directory (GH-28767) (GH-28798)Christian Clauss2021-10-074-4/+4
| | | | | (cherry picked from commit db693df3e112c5a61f2cbef63eedce3a36520ded) Automerge-Triggered-By: GH:JulienPalard
* [3.9] bpo-44050: Extension modules can share state when they don't support ↵Łukasz Langa2021-10-051-1/+3
| | | | | | | sub-interpreters. (GH-27794) (GH-28741) (cherry picked from commit b9bb74871b27d9226df2dd3fce9d42bda8b43c2b) Co-authored-by: Hai Shi <shihai1992@gmail.com>
* [3.9] Remove trailing spaces (GH-28710)Serhiy Storchaka2021-10-032-4/+4
|
* bpo-41710: PyThread_acquire_lock_timed() uses sem_clockwait() (GH-28671) ↵Miss Islington (bot)2021-10-011-12/+41
| | | | | | | | | | | | | | (GH-28683) On Unix, if the sem_clockwait() function is available in the C library (glibc 2.30 and newer), the threading.Lock.acquire() method now uses the monotonic clock (time.CLOCK_MONOTONIC) for the timeout, rather than using the system clock (time.CLOCK_REALTIME), to not be affected by system clock changes. configure now checks if the sem_clockwait() function is available. (cherry picked from commit 6df8c327532627d6a99991993c52e8e4a9b34968) Co-authored-by: Victor Stinner <vstinner@python.org>
* bpo-44219: Release the GIL during isatty syscalls (GH-28250)Miss Islington (bot)2021-09-091-2/+14
| | | | | | | | | Release the GIL while performing isatty() system calls on arbitrary file descriptors. In particular, this affects os.isatty(), os.device_encoding() and io.TextIOWrapper. By extension, io.open() in text mode is also affected. (cherry picked from commit 06148b1870fceb1a21738761b8e1ac3bf654319b) Co-authored-by: Vincent Michel <vxgmichel@gmail.com>
* [3.9] bpo-45083: Include the exception class qualname when formatting an ↵Miss Islington (bot)2021-09-032-36/+38
| | | | | | | | | | | exception (GH-28119) (GH-28135) * bpo-45083: Include the exception class qualname when formatting an exception (GH-28119) Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no> (cherry picked from commit b4b6342848ec0459182a992151099252434cc619) Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com> Co-authored-by: Łukasz Langa <lukasz@langa.pl>
* bpo-44449: faulthandler don't modify frame refcnt (GH-27850)Miss Islington (bot)2021-08-301-5/+5
| | | | | | | Fix a crash in the signal handler of the faulthandler module: no longer modify the reference count of frame objects. (cherry picked from commit fe997e1a67835a929705c8c305d41c4d7dd326e3) Co-authored-by: Victor Stinner <vstinner@python.org>
* bpo-25782: avoid hang in PyErr_SetObject when current exception has a cycle ↵Miss Islington (bot)2021-08-101-1/+15
| | | | | | | | in its context chain (GH-27626) (GH-27707) Co-authored-by: Dennis Sweeney 36520290+sweeneyde@users.noreply.github.com (cherry picked from commit d5c217475c4957a8084ac3f92ae012ece5edc7cb) Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
* bpo-44856: Possible reference leak in error paths of update_bases() and ↵Miss Islington (bot)2021-08-071-22/+13
| | | | | | | __build_class__ (GH-27647) (GH-27651) (cherry picked from commit a40675c659cd8c0699f85ee9ac31660f93f8c2f5) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
* bpo-44849: Fix os.set_inheritable() on FreeBSD 14 with O_PATH (GH-27623)Miss Islington (bot)2021-08-061-3/+4
| | | | | | | | Fix the os.set_inheritable() function on FreeBSD 14 for file descriptor opened with the O_PATH flag: ignore the EBADF error on ioctl(), fallback on the fcntl() implementation. (cherry picked from commit c24896c0e3b32c8a9f614ef51366007b67d5c665) Co-authored-by: Victor Stinner <vstinner@python.org>
* bpo-39091: Fix segfault when Exception constructor returns non-exception for ↵Miss Islington (bot)2021-08-031-4/+16
| | | | | | | | gen.throw. (GH-17658) (GH-27573) Co-authored-by: Benjamin Peterson <benjamin@python.org> (cherry picked from commit 83ca46b7784b7357d82ec47b33295e09ed7380cb) Co-authored-by: Noah <33094578+coolreader18@users.noreply.github.com>
* Set line number of END_ASYNC_FOR so that it doesn't show in traces. (GH-27255)Mark Shannon2021-07-201-0/+6
|
* bpo-44472: Fix ltrace functionality when exceptions are raised (GH-26822) ↵Miss Islington (bot)2021-07-121-0/+3
| | | | | | | (#26831) (cherry picked from commit 06cda808f149fae9b4c688f752b6eccd0d455ba4) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* bpo-41180: Replace marshal code.__new__ audit event with marshal.load[s] and ↵Steve Dower2021-06-301-10/+20
| | | | marshal.dumps (GH-26971)
* bpo-44441: _PyImport_Fini2() resets PyImport_Inittab (GH-26874) (GH-26878)Victor Stinner2021-06-231-0/+3
| | | | | | | Py_RunMain() now resets PyImport_Inittab to its initial value at exit. It must be possible to call PyImport_AppendInittab() or PyImport_ExtendInittab() at each Python initialization. (cherry picked from commit 489699ca05bed5cfd10e847d8580840812b476cd)
* bpo-41299: Reduce lag in Windows threading timeouts by using a higher ↵Miss Islington (bot)2021-06-111-4/+10
| | | | | | | precision time source (GH-26568) (cherry picked from commit 449e6f0ef395231e3abe467f910b02d7f075c27f) Co-authored-by: Ryan Hileman <lunixbochs@gmail.com>
* [3.9] bpo-11105: Do not crash when compiling recursive ASTs (GH-20594) ↵Batuhan Taskaya2021-06-031-0/+700
| | | | | | | | | | | | (GH-26522) When compiling an AST object with a direct / indirect reference cycles, on the conversion phase because of exceeding amount of calls, a segfault was raised. This patch adds recursion guards to places for preventing user inputs to not to crash AST but instead raise a RecursionError.. (cherry picked from commit f3491242e41933aa9529add7102edb68b80a25e9) Co-authored-by: Batuhan Taskaya <batuhan@python.org>
* [3.9] bpo-43667: Fix broken Unicode encoding in non-UTF locales on Solaris ↵Jakub Kulík2021-05-211-0/+106
| | | | | | | (GH-25096) (GH-25847) (cherry picked from commit 9032cf5cb1e33c0349089cfb0f6bf11ed3c30e86) Co-authored-by: Jakub Kulík <Kulikjak@gmail.com>
* bpo-28146: Fix a confusing error message in str.format() (GH-24213)Miss Islington (bot)2021-05-131-2/+8
| | | | | | Automerge-Triggered-By: GH:pitrou (cherry picked from commit 4aeee0b47b3a2b604bbac37040320ffc88c291f2) Co-authored-by: Irit Katriel <iritkatriel@yahoo.com>
* bpo-44070: No longer eagerly makes import filenames absolute, except for ↵Steve Dower2021-05-101-1829/+1830
| | | | extension modules (GH-26025)
* bpo-42800: Add audit events for f_code and tb_frame (GH-24182)Steve Dower2021-05-031-1/+1
| | | | | | | | Accessing the following attributes will now fire PEP 578 style audit hooks as (object.__getattr__, obj, name): * PyTracebackObject: tb_frame * PyFrameObject: f_code * PyGenObject: gi_code, gi_frame * PyCoroObject: cr_code, cr_frame * PyAsyncGenObject: ag_code, ag_frame
* bpo-43105: Importlib now resolves relative paths when creating module spec ↵Steve Dower2021-04-071-2687/+2777
| | | | objects from file locations (GH-25121)
* [3.9] bpo-43710: Rollback the 3.9 bpo-42500 fix, it broke the ABI in 3.9.3 ↵Gregory P. Smith2021-04-044-16/+16
| | | | | | | (#25179) This reverts commit 8b795ab5541d8a4e69be4137dfdc207714270b77. It changed the PyThreadState structure size, breaking the ABI in 3.9.3.
* bpo-43660: Fix crash when displaying exceptions with custom values for ↵Miss Islington (bot)2021-03-291-1/+2
| | | | | | | | | sys.stderr (GH-25075) (GH-25083) (cherry picked from commit 09b90a037d18f5d4acdf1b14082e57bda78e85d3) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com> Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* [3.9] bpo-43517: Fix false positive in detection of circular imports ↵Antoine Pitrou2021-03-201-1/+1
| | | | | | | | | (GH-24895) (GH-24948) (cherry picked from commit 2fd16ef406bba239b1334057fb499496a84b3aa2) Co-authored-by: Antoine Pitrou <antoine@python.org> Automerge-Triggered-By: GH:pitrou
* bpo-35883: Py_DecodeLocale() escapes invalid Unicode characters (GH-24843)Miss Islington (bot)2021-03-171-39/+79
| | | | | | | | | | | | | Python no longer fails at startup with a fatal error if a command line argument contains an invalid Unicode character. The Py_DecodeLocale() function now escapes byte sequences which would be decoded as Unicode characters outside the [U+0000; U+10ffff] range. Use MAX_UNICODE constant in unicodeobject.c. (cherry picked from commit 9976834f807ea63ca51bc4f89be457d734148682) Co-authored-by: Victor Stinner <vstinner@python.org>
* bpo-43499: Silence compiler warnings about using legacy C API on Windows ↵Serhiy Storchaka2021-03-162-0/+9
| | | | (GH-24873)
* bpo-42500: Fix recursion in or after except (GH-23568) (#24501)Mark Shannon2021-03-024-16/+16
| | | | | * Use counter, rather boolean state when handling soft overflows. (cherry picked from commit 4e7a69bdb63a104587759d7784124492dcdd496e)
* bpo-42780: Fix set_inheritable() for O_PATH file descriptors on Linux ↵cptpcrd2021-01-211-0/+7
| | | | | (GH-24172) (GH-24278) (cherry picked from commit 7dc71c425cf6aa6a4070a418dce5d95ca435c79f)
* Bring Python into the new year. (GH-24036)Miss Islington (bot)2021-01-011-1/+1
| | | | | (cherry picked from commit de6f20a6de48d63066b2cf5b317f50629f01d74a) Co-authored-by: Dong-hee Na <donghee.na@python.org>