summaryrefslogtreecommitdiffstats
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
* [3.10] gh-94938: Fix errror detection of unexpected keyword arguments ↵Serhiy Storchaka2022-07-281-56/+55
| | | | | | | | | | | | | | | (GH-94999) (GH-95354) When keyword argument name is an instance of a str subclass with overloaded methods __eq__ and __hash__, the former code could not find the name of an extraneous keyword argument to report an error, and _PyArg_UnpackKeywords() returned success without setting the corresponding cell in the linearized arguments array. But since the number of expected initialized cells is determined as the total number of passed arguments, this lead to reading NULL as a keyword parameter value, that caused SystemError or crash or other undesired behavior.. (cherry picked from commit ebad53a4dc1bb591820724a22cef9b8459185b5f) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [3.10] gh-94930: skipitem() in getargs.c should return non-NULL on error ↵Miss Islington (bot)2022-07-191-3/+1
| | | | | | | | (GH-94931) (GH-94963) (cherry picked from commit 067f0da33506f70c36a67d5f3d8d011c8dae10c9) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* gh-94864: Fix PyArg_Parse* with deprecated format units "u" and "Z" (GH-94902)Miss Islington (bot)2022-07-171-1/+1
| | | | | | It returned 1 (success) when warnings are turned into exceptions. (cherry picked from commit 107c21c5d56682320b38c01b5575c1604a429239) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [3.10] GH-94329: Don't raise on excessive stack consumption (GH-94421) (#94448)Mark Shannon2022-07-111-7/+0
|
* [3.10] gh-94510: Raise on re-entrant calls to sys.setprofile and syssettrace ↵Pablo Galindo Salgado2022-07-051-2/+24
| | | | | | (GH-94511) (#94579) Co-authored-by: Łukasz Langa <lukasz@langa.pl>. Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
* gh-94332: make it safe to call assemble_free when assemble_init has not been ↵Irit Katriel2022-06-301-0/+1
| | | | | called (GH-94389) (GH-94443) (cherry picked from commit be82d26570343dafc8a89be5a1a0e2f58d51a904)
* [3.10] GH-93964: Harden overflow checks before _PyBytes_Resize in compile.c ↵Dennis Sweeney2022-06-221-5/+21
| | | | (GH-94045)
* [3.11] gh-93741: Add private C API _PyImport_GetModuleAttrString() ↵Miss Islington (bot)2022-06-161-0/+31
| | | | | | | | | | | | (GH-93742) (GH-93792) It combines PyImport_ImportModule() and PyObject_GetAttrString() and saves 4-6 lines of code on every use. Add also _PyImport_GetModuleAttr() which takes Python strings as arguments. (cherry picked from commit 6fd4c8ec7740523bb81191c013118d9d6959bc9d) (cherry picked from commit d42b3689f4a14694f5b1ff75c155141102aa2557) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [3.10] gh-93217: fix some issues in man page and --help (GH-93219) (#93261)Éric2022-05-291-4/+3
|
* [3.10] gh-91924: Fix __ltrace__ for non-UTF-8 stdout encoding (#93214)Victor Stinner2022-05-251-0/+2
| | | | | | | | | | Fix __ltrace__ debug feature if the stdout encoding is not UTF-8. If the stdout encoding is not UTF-8, the first call to lltrace_resume_frame() indirectly sets lltrace to 0 when calling unicode_check_encoding_errors() which calls encodings.search_function(). Add test_lltrace.test_lltrace() test.
* gh-93065: Fix HAMT to iterate correctly over 7-level deep trees (GH-93066) ↵Miss Islington (bot)2022-05-241-3/+11
| | | | | | | | | | | | (GH-93146) 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)
* gh-93061: Mark as artificial: backwards jump after async for (GH-93120)Dennis Sweeney2022-05-231-0/+2
|
* bpo-47260: Fix os.closerange() potentially being a no-op in a seccomp ↵Miss Islington (bot)2022-04-081-4/+5
| | | | | | | | | | | | | | | | | | | | | sandbox (GH-32418) _Py_closerange() currently assumes that close_range() closes all file descriptors even if it returns an error (other than ENOSYS). This assumption can be wrong on Linux if a seccomp sandbox denies the underlying syscall, pretending that it returns EPERM or EACCES. In this case _Py_closerange() won't close any descriptors at all, which in the worst case can be a security issue. Fix this by falling back to other methods in case of any close_range() error. Note that fallbacks will not be triggered on any problems with closing individual file descriptors because close_range() is documented to ignore such errors on both Linux[1] and FreeBSD[2]. [1] https://man7.org/linux/man-pages/man2/close_range.2.html [2] https://www.freebsd.org/cgi/man.cgi?query=close_range&sektion=2 (cherry picked from commit 1c8b3b5d66a629258f1db16939b996264a8b9c37) Co-authored-by: Alexey Izbyshev <izbyshev@ispras.ru>
* [3.10] bpo-46940: Don't override existing AttributeError suggestion ↵Pablo Galindo Salgado2022-03-071-3/+6
| | | | | | | | | | | | | | | information (GH-31710) (GH-31724) When an exception is created in a nested call to PyObject_GetAttr, any external calls will override the context information of the AttributeError that we have already placed in the most internal call. This will cause the suggestions we create to nor work properly as the attribute name and object that we will be using are the incorrect ones. To avoid this, we need to check first if these attributes are already set and bail out if that's the case.. (cherry picked from commit 3b3be05a164da43f201e35b6dafbc840993a4d18) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
* 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.10] bpo-46724: Use `JUMP_ABSOLUTE` for all backward jumps. (GH-31326) ↵Mark Shannon2022-02-164-12/+43
| | | | (GH-31354)
* bpo-45773: Remove invalid peephole optimizations (GH-31066)Miss Islington (bot)2022-02-031-2/+0
| | | | | (cherry picked from commit e0433c1e70254d4d0357a9e14596929a04bdf769) Co-authored-by: Brandt Bucher <brandt@python.org>
* [3.10] bpo-45703: Invalidate _NamespacePath cache on ↵Petr Viktorin2022-01-271-898/+904
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | importlib.invalidate_cache (GH-29384) (GH-30922) 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.
* bpo-46347: Fix PyEval_EvalCodeEx to correctly cleanup in error paths (#30553)Yury Selivanov2022-01-121-11/+5
|
* bpo-46347: Fix memory leak in PyEval_EvalCodeEx. (GH-30546)Miss Islington (bot)2022-01-111-7/+0
| | | | | | First introduced in 0332e569c12d3dc97171546c6dc10e42c27de34b (cherry picked from commit 607d8a838f29ad3c4c4e85b39f338dade5f9cafe) Co-authored-by: Yury Selivanov <yury@edgedb.com>
* bpo-46289: Make conversion of FormattedValue not optional on ASDL (GH-30467)Miss Islington (bot)2022-01-071-8/+5
| | | | | | Automerge-Triggered-By: GH:isidentical (cherry picked from commit d382f7ee0b98e4ab6ade9384268f25c06be462ad) Co-authored-by: Batuhan Taskaya <batuhan@python.org>
* [3.10] Update copyright year to 2022. (GH-30335) (GH-30336)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-46042: Improve SyntaxError locations in the symbol table (GH-30059) ↵Miss Islington (bot)2021-12-121-60/+83
| | | | | | | | | (GH-30064) (cherry picked from commit 59435eea08d30796174552c0ca03c59b41adf8a5) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com> Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
* [3.10] bpo-46009: Do not exhaust generator when send() method raises ↵Mark Shannon2021-12-081-18/+2
| | | | | | | | | | | | (GH-29986). (GH-29988) * [3.10] bpo-46009: Do not exhaust generator when send() method raises (GH-29986). (cherry picked from commit 69806b9516dbe092381f3ef884c7c64bb9b8414a) Co-authored-by: Mark Shannon <mark@hotpy.org> * Rename variable after cherry-pick. * Add NULL check.
* bpo-45614: Fix traceback display for exceptions with invalid module name ↵Irit Katriel2021-11-291-1/+1
| | | | | (GH-29726) (GH-29826) (cherry picked from commit 4dfae6f38e1720ddafcdd68043e476ecb41cb4d5)
* [3.10] bpo-45848: Allow the parser to get error lines from encoded files ↵Łukasz Langa2021-11-201-4/+14
| | | | | | | (GH-29646) (GH-29661) (cherry picked from commit fdcc46d9554094994f78bedf6dc9220e5d5ee668) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
* bpo-44959: Add fallback to extension modules with '.sl' suffix on HP-UX ↵Miss Islington (bot)2021-11-181-1/+1
| | | | | | | (GH-27857) (GH-29152) (cherry picked from commit 2396fa6537d79554ac694dbd2b0b30eeb3476c80) Co-authored-by: Florin Spătar <florin.spatar@gmail.com>
* [3.10] bpo-45826: Fix a crash in suggestions.c by checking for `traceback is ↵Łukasz Langa2021-11-181-3/+11
| | | | | | | None` (GH-29590) (GH-29602) (cherry picked from commit 5d90c467c02ffefdb13c1abc83a171db1a99ffad) Co-authored-by: Dennis Sweeney <36520290+sweeneyde@users.noreply.github.com>
* bpo-45831: _Py_DumpASCII() uses a single write() call if possible (GH-29596) ↵Miss Islington (bot)2021-11-171-0/+22
| | | | | | | | | (GH-29598) 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-42540: reallocation of id_mutex should not force default allocator ↵Miss Islington (bot)2021-11-171-1/+4
| | | | | | | | | | (GH-29564) 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>
* [3.10] bpo-45773: Stop "optimizing" certain jump patterns (GH-29526)Brandt Bucher2021-11-114-81/+52
|
* [3.10] bpo-45688: Add _scproxy to sys.stdlib_module_names (GH-29358) (GH-29361)Miss Islington (bot)2021-11-021-0/+1
| | | Co-authored-by: Christian Heimes <christian@python.org>
* 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.10] Fix typos in the Python directory (GH-28767) (GH-28799)Christian Clauss2021-10-076-8/+8
| | | (cherry picked from commit db693df3e112c5a61f2cbef63eedce3a36520ded)
* bpo-44050: Extension modules can share state when they don't support ↵Miss Islington (bot)2021-10-051-1/+3
| | | | | | | | sub-interpreters. (GH-27794) (GH-28738) Automerge-Triggered-By: GH:encukou (cherry picked from commit b9bb74871b27d9226df2dd3fce9d42bda8b43c2b) Co-authored-by: Hai Shi <shihai1992@gmail.com>
* [3.10] bpo-45355: More use of sizeof(_Py_CODEUNIT) (GH-28720). (GH-28721)Serhiy Storchaka2021-10-041-1/+1
| | | | (cherry picked from commit 252b7bcb236dc261f3af1275bc90f9a303d9648f)
* [3.10] bpo-45355: Use sizeof(_Py_CODEUNIT) instead of literal 2 for the size ↵Serhiy Storchaka2021-10-042-5/+5
| | | | | | of the code unit (GH-28711). (GH-28718) (cherry picked from commit 60b9e040c9cf40e69f42c0008e564458aa0379e8)
* [3.10] Remove trailing spaces (GH-28709)Serhiy Storchaka2021-10-031-2/+2
|
* bpo-41710: PyThread_acquire_lock_timed() uses sem_clockwait() (GH-28671)Victor Stinner2021-10-011-12/+41
| | | | | | | | | 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.
* Move predispatch logic from DISPATCH macro to juts before switch. Reduces ↵Mark Shannon2021-09-291-7/+15
| | | | size of each opocde in interpreter. (GH-28475)
* [3.10] bpo-45307: Restore private C API function ↵Serhiy Storchaka2021-09-281-0/+17
| | | | | | | | _PyImport_FindExtensionObject() (GH-28594) py2exe and PyOxidizer rely on this API. It will be removed in Python 3.11. Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
* [3.10] bpo-45183: don't raise an exception when calling ↵Brett Cannon2021-09-181-1/+1
| | | | | | | | zipimport.zipimporter.find_spec() when the zip file is missing and the internal cache has been reset (GH-28435) (#28438) This can occur when the zip file gets deleted, you call zipimport.zipimporter.invalidate_cache(), and then try to use zipimport.zipimporter.find_spec() (i.e. you left the zip file path on sys.path). (cherry picked from commit 209b7035f714dcc41df054b0b023e0b955d7e1a2) Co-authored-by: Brett Cannon <brett@python.org>
* [3.10] bpo-34602: Quadruple stack size on macOS when compiling with UBSAN ↵Łukasz Langa2021-09-151-7/+6
| | | | | | | (GH-27309) (GH-28280) (cherry picked from commit be9de8721d63b9d8e032d508069daf88c06542c6) Co-authored-by: Łukasz Langa <lukasz@langa.pl>
* bpo-44219: Release the GIL during isatty syscalls (GH-28250) (GH-28255)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.10] bpo-45083: Include the exception class qualname when formatting an ↵Miss Islington (bot)2021-09-082-36/+38
| | | | | | | | | | | | exception (GH-28119) (GH-28134) 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> * Use a private version of _PyType_GetQualName Co-authored-by: Łukasz Langa <lukasz@langa.pl>
* [3.10] bpo-45056: Remove trailing unused constants from co_consts (GH-28109) ↵Łukasz Langa2021-09-084-4611/+4641
| | | | | | | (GH-28125) (cherry picked from commit 55c4a92fc1abfe388335071f1d64b3addfa5793f) Co-authored-by: Inada Naoki <songofacandy@gmail.com>
* bpo-45123: PyAiter_Check and PyObject_GetAiter fix & rename. (GH-28194) ↵Miss Islington (bot)2021-09-071-1/+1
| | | | | | | (GH-28199) Fix PyAiter_Check to only check for the `__anext__` presense (not for `__aiter__`). Rename `PyAiter_Check()` to `PyAIter_Check()`, `PyObject_GetAiter()` -> `PyObject_GetAIter()`.
* bpo-45039: Consistently use ADDOP_LOAD_CONST in compiler rather than ↵Miss Islington (bot)2021-08-311-2/+4
| | | | | | | ADDOP_O(c, LOAD_CONST,...) (GH-28015) (cherry picked from commit 70ccee418d1f9d34ed15cfe7104221f9cfd27d03) Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>