summaryrefslogtreecommitdiffstats
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
* GH-96678: Fix undefined behavior in ceval.c (GH-96708)Miss Islington (bot)2022-09-101-1/+7
| | | | | (cherry picked from commit 50a70a083d34305a52fac4f5901bff2ead152d68) Co-authored-by: Mark Shannon <mark@hotpy.org>
* Fix possible NULL pointer dereference in _PyThread_CurrentFrames (GH-96584)Miss Islington (bot)2022-09-101-1/+6
| | | | | (cherry picked from commit 88a7f661ca02c0eb76b8f19234b8293b70f171e2) Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
* [3.11] GH-96636: Remove all uses of NOTRACE_DISPATCH (GH-96643) (#96688)Mark Shannon2022-09-091-59/+57
| | | | | Co-authored-by: Brandt Bucher <brandtbucher@gmail.com> (cherry picked from commit aa3b4cf779b3dddb84e094879b91703354910d8c)
* [3.11] GH-96569: Avoid undefined behavior (#96616)Mark Shannon2022-09-081-8/+8
| | | Co-authored-by: Michael Droettboom <mdboom@gmail.com>
* GH-96572: fix use after free in trace refs build mode (GH-96618)Miss Islington (bot)2022-09-061-1/+1
| | | | | (cherry picked from commit 67444902a0f10419a557d0a2d3b8675c31b075a9) Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
* [3.11] gh-95778: CVE-2020-10735: Prevent DoS by very large int() (#96500)Gregory P. Smith2022-09-023-3/+161
| | | | | | | | | | | | | | | | | | Integer to and from text conversions via CPython's bignum `int` type is not safe against denial of service attacks due to malicious input. Very large input strings with hundred thousands of digits can consume several CPU seconds. This PR comes fresh from a pile of work done in our private PSRT security response team repo. This backports https://github.com/python/cpython/pull/96499 aka 511ca9452033ef95bc7d7fc404b8161068226002 Signed-off-by: Christian Heimes [Red Hat] <christian@python.org> Tons-of-polishing-up-by: Gregory P. Smith [Google] <greg@krypto.org> Reviews via the private PSRT repo via many others (see the NEWS entry in the PR). <!-- gh-issue-number: gh-95778 --> * Issue: gh-95778 <!-- /gh-issue-number --> I wrote up [a one pager for the release managers](https://docs.google.com/document/d/1KjuF_aXlzPUxTK4BMgezGJ2Pn7uevfX7g0_mvgHlL7Y/edit#).
* gh-96125: Fix sys.thread_info.name on pthread platforms (GH-96126) (#96128)Miss Islington (bot)2022-08-211-1/+1
| | | | | | | | Automerge-Triggered-By: GH:tiran (cherry picked from commit 822955c16654c22c10a993f5a94bbb68b857a150) Co-authored-by: Christian Heimes <christian@python.org> Co-authored-by: Christian Heimes <christian@python.org>
* GH-96071: fix deadlock in PyGILState_Ensure (GH-96124) (#96129)Miss Islington (bot)2022-08-191-11/+16
| | | | | | | | Alternative of GH-96107 (cherry picked from commit e0d54a4a799dae4ebdd72a16bcf287ed62ae2972) Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com> Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
* GH-95818: Skip incomplete frames in `PyThreadState_GetFrame` (GH-95886) (#95890)Miss Islington (bot)2022-08-121-2/+6
| | | | | | | (cherry picked from commit 1b46d118e6e72daa64b98cafddb406c68b419efa) Co-authored-by: Mark Shannon <mark@hotpy.org> Co-authored-by: Mark Shannon <mark@hotpy.org>
* [3.11] gh-95174: Add pthread stubs for WASI (GH-95234) (#95503)Christian Heimes2022-08-013-6/+201
| | | | | | Co-authored-by: Brett Cannon <brett@python.org>. (cherry picked from commit 0fe645d6fd22a6f57e777a29e65cf9a4ff9785ae) Co-authored-by: Christian Heimes <christian@python.org>
* bpo-45445: Revert "bpo-45445: Fail if an invalid X-option is provided in the ↵Miss Islington (bot)2022-07-311-48/+0
| | | | | | | command line (GH-28823)" (GH-94745) (cherry picked from commit aa37ffda29ac48fb2df5a7029ba2e626ecc45850) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
* [3.11] gh-95174: Handle missing dup() and constants in WASI (GH-95229) ↵Christian Heimes2022-07-312-1/+11
| | | | | (GH-95272) Co-authored-by: Christian Heimes <christian@python.org>
* GH-90081: Run python tracers at full speed (GH-95328) (#95363)Miss Islington (bot)2022-07-291-4/+7
| | | | | | | (cherry picked from commit b8b2990fb3218cffedfe7bc92e9e7ae2275b3c98) Co-authored-by: Mark Shannon <mark@hotpy.org> Co-authored-by: Mark Shannon <mark@hotpy.org>
* [3.11] gh-94938: Fix errror detection of unexpected keyword arguments ↵Serhiy Storchaka2022-07-281-85/+57
| | | | | | | | | | | | | | | (GH-94999) (GH-95353) 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.11] gh-95185: Check recursion depth in the AST constructor (GH-95186) ↵Miss Islington (bot)2022-07-261-1/+106
| | | | | | | | (GH-95208) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> (cherry picked from commit 00474472944944b346d8409cfded84bb299f601a) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
* [3.11] GH-94739: Backport GH-94958 to 3.11 (#94965)Mark Shannon2022-07-251-14/+0
|
* [3.11] GH-94036: Fix more attribute location quirks (GH-95028) (GH-95156)Brandt Bucher2022-07-231-20/+23
| | | (cherry picked from commit 900bfc53cb133e8bc2b122362ec04256f623d5b0)
* [3.11] GH-95113: Don't use EXTENDED_ARG_QUICK in unquickened code (GH-95121) ↵Brandt Bucher2022-07-223-3/+14
| | | | | (GH-95143) (cherry picked from commit e402b26b7fb953a2f0c17a0044bb6d6cbd726e54)
* [3.11] GH-91409: Don't overwrite valid locations with NOP locations ↵Brandt Bucher2022-07-201-1/+4
| | | | | (GH-95067) (GH-95068) (cherry picked from commit 742d4614e1a645d765dbf76c19bd9a818239b1cb)
* GH-94851: fix immortal objects refcounting in compiler (gh-95040)Miss Islington (bot)2022-07-201-1/+1
| | | | | (cherry picked from commit 74761548862eb5a324c23d86a6233d884f386f2e) Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
* gh-91256: Ensure help text has the program name even before getpath is ↵Miss Islington (bot)2022-07-191-0/+3
| | | | | | | called (GH-94929) (cherry picked from commit 49aeff49d71fa4bd935212340410311f13879447) Co-authored-by: Steve Dower <steve.dower@python.org>
* [3.11] GH-94822: Don't specialize when metaclasses are involved (GH-94892) ↵Brandt Bucher2022-07-181-6/+5
| | | | | | | (GH-94980) (cherry picked from commit daf68ba92f315bfd239a0c993f9f683fb90325fb) Co-authored-by: Brandt Bucher <brandtbucher@microsoft.com>
* gh-94930: skipitem() in getargs.c should return non-NULL on error (GH-94931)Miss Islington (bot)2022-07-181-3/+1
| | | | | (cherry picked from commit 067f0da33506f70c36a67d5f3d8d011c8dae10c9) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* gh-91348: Restore frame argument to sys._getframe audit event (GH-94928)Miss Islington (bot)2022-07-171-5/+7
| | | | | (cherry picked from commit 044a593cbbe1639e906e06c47504dd1020ddfee4) Co-authored-by: Steve Dower <steve.dower@python.org>
* gh-94864: Fix PyArg_Parse* with deprecated format units "u" and "Z" (GH-94902)Serhiy Storchaka2022-07-171-1/+1
| | | It returned 1 (success) when warnings are turned into exceptions.
* [3.11] gh-93883: elide traceback indicators when possible (GH-93994) (GH-94740)John Belmonte2022-07-111-4/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Elide traceback column indicators when the entire line of the frame is implicated. This reduces traceback length and draws more attention to the remaining (very relevant) indicators. Example: ``` Traceback (most recent call last): File "query.py", line 99, in <module> bar() File "query.py", line 66, in bar foo() File "query.py", line 37, in foo magic_arithmetic('foo') File "query.py", line 18, in magic_arithmetic return add_counts(x) / 25 ^^^^^^^^^^^^^ File "query.py", line 24, in add_counts return 25 + query_user(user1) + query_user(user2) ^^^^^^^^^^^^^^^^^ File "query.py", line 32, in query_user return 1 + query_count(db, response['a']['b']['c']['user'], retry=True) ~~~~~~~~~~~~~~~~~~^^^^^ TypeError: 'NoneType' object is not subscriptable ``` Automerge-Triggered-By: GH:pablogsal
* [3.11] GH-94694: Fix column offsets for multi-line method lookups (GH-94721)Brandt Bucher2022-07-101-2/+9
| | | (cherry picked from commit 264b3ddfd561d97204ffb30be6a7d1fb0555e560)
* [3.11] GH-93252: Fix error handling for failed Python calls (GH-94693) ↵Kumar Aditya2022-07-091-1/+5
| | | | | (GH-94708) Automerge-Triggered-By: GH:tiran
* [3.11] gh-94215: Fix error handling for line-tracing events (GH-94681) ↵Christian Heimes2022-07-081-5/+14
| | | | | | | | | | (GH-94688) * Re-enable crasher * Fix error handling for line-tracing events * blurb add (cherry picked from commit 23ee4a8067506e6c9c47748185653617413f7a60) Co-authored-by: Brandt Bucher <brandtbucher@microsoft.com>
* [3.11] gh-92228: disable the compiler's 'small exit block inlining' ↵Christian Heimes2022-07-071-0/+14
| | | | | | | | | | optimization for blocks that have a line number (GH-94592) (GH-94643) Inlining of code that corresponds to source code lines, can make it hard to distinguish later between code which is only reachable from except handlers, and that which is reachable in normal control flow. This caused problems with the debugger's jump feature. This PR turns off the inlining optimisation for code which has line numbers. We still inline things like the implicit "return None".. (cherry picked from commit bde06e1b8381f140b296a397ddd1deb1c784ff8e) Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
* [3.11] gh-94510: Raise on re-entrant calls to sys.setprofile and ↵Łukasz Langa2022-07-051-2/+24
| | | | | | | | sys.settrace (GH-94511) (GH-94578) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com> Co-authored-by: Łukasz Langa <lukasz@langa.pl> (cherry picked from commit 40d81fd63b46cf998880ce3bf3e5cb42bc3199c1)
* [3.11] gh-94485: Set line number of module's RESUME instruction to 0 as ↵Łukasz Langa2022-07-051-1/+4
| | | | | | | | | specified by PEP 626 (GH-94552) (GH-94562) Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com> Co-authored-by: Mark Shannon <mark@hotpy.org> (cherry picked from commit 324d01944d16868b07df9e8eef6987766a31a36d)
* [3.11] GH-94262: Don't create frame objects for frames that aren't yet ↵Miss Islington (bot)2022-07-042-5/+17
| | | | | complete. (GH-94371) (#94482) Co-authored-by: Mark Shannon <mark@hotpy.org>
* [3.11] GH-93354: Use exponential backoff to avoid excessive specialization ↵Mark Shannon2022-06-302-45/+48
| | | | | | attempts (GH-93355) (GH-93379) Co-authored-by: Mark Shannon <mark@hotpy.org> Co-authored-by: Łukasz Langa <lukasz@langa.pl>
* gh-91719: Reload opcode on unknown error so that C can optimize the ↵Miss Islington (bot)2022-06-301-0/+3
| | | | | | | dispatching in ceval.c (GH-94364) (#94453) (cherry picked from commit ea39b77de9fa25b447d0b4148f75f351076e890a) Co-authored-by: neonene <53406459+neonene@users.noreply.github.com>
* GH-94329: Don't raise on excessive stack consumption (GH-94421) (GH-94446)Miss Islington (bot)2022-06-301-6/+1
| | | | (cherry picked from commit b152bf448b321e3a4c0a7280e0b608840f5ac661)
* 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-94442) (cherry picked from commit be82d26570343dafc8a89be5a1a0e2f58d51a904)
* [3.11] GH-93516: Drop broken assert, fixes GH-93769 (GH-94411)Christian Heimes2022-06-291-4/+0
|
* [3.11] GH-93516: Backport GH-93769 (GH-94231)Mark Shannon2022-06-281-52/+41
| | | * Store offset of first traceable instruction to avoid having to recompute it all the time when tracing.
* [3.11] GH-93516: Backport GH-93769: Speedup line number checks when tracing ↵Mark Shannon2022-06-221-7/+9
| | | | | (GH-94127) Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
* gh-94021: Address unreachable code warning in specialize code (GH-94022)Miss Islington (bot)2022-06-211-1/+2
| | | | | (cherry picked from commit 77c839c98fe57dcb01f5cad2e65fb4cac5a052c1) Co-authored-by: Christian Heimes <christian@python.org>
* gh-91985: Ensure in-tree builds override platstdlib_dir in every path ↵Miss Islington (bot)2022-06-201-1/+22
| | | | | | | calculation (GH-93641) (cherry picked from commit 38af903506e9b18c6350c1dadcb489f057713f36) Co-authored-by: neonene <53406459+neonene@users.noreply.github.com>
* gh-93937, C API: Move PyFrame_GetBack() to Python.h (#93938) (#94000)Victor Stinner2022-06-206-6/+4
| | | | | | | | | | | | | | | | | | Move the follow functions and type from frameobject.h to pyframe.h, so the standard <Python.h> provide frame getter functions: * PyFrame_Check() * PyFrame_GetBack() * PyFrame_GetBuiltins() * PyFrame_GetGenerator() * PyFrame_GetGlobals() * PyFrame_GetLasti() * PyFrame_GetLocals() * PyFrame_Type Remove #include "frameobject.h" from many C files. It's no longer needed. (cherry picked from commit 27b989403356ccdd47545a93aeab8434e9c69f21)
* gh-74953: Fix PyThread_acquire_lock_timed() code recomputing the timeout ↵Miss Islington (bot)2022-06-171-1/+1
| | | | | | | | (GH-93941) Set timeout, don't create a local variable with the same name. (cherry picked from commit f64557f4803528c53bb9a1d565e3cdf92e97152f) Co-authored-by: Victor Stinner <vstinner@python.org>
* [3.11] GH-93662: Make sure that column offsets are correct in multi-line ↵Irit Katriel2022-06-161-4/+16
| | | | | method calls. (GH-93673) (#93895) Co-authored-by: Mark Shannon <mark@hotpy.org>
* gh-90300: split --help output into separate options (GH-30331)Miss Islington (bot)2022-06-142-65/+123
| | | | | | | | | Make --help output shorter and add new help options. --help-env, --help-xoptions and --help-all command-line options are added to complement --help. (cherry picked from commit 8aa9d40b00741213c5a53b1ae15509998893ae31) Co-authored-by: Éric <earaujo@caravan.coop>
* [3.11] gh-93741: Add private C API _PyImport_GetModuleAttrString() ↵Serhiy Storchaka2022-06-141-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)
* gh-92597: Improve error message for AST nodes with invalid ranges (GH-93398) ↵Miss Islington (bot)2022-06-011-3/+3
| | | | | | | (GH-93414) (cherry picked from commit 8a221a853787c18d5acaf46f5c449d28339cde21) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
* gh-92597: Ensure that AST nodes without explicit end positions can be ↵Miss Islington (bot)2022-05-311-12/+12
| | | | | | | compiled (GH-93359) (cherry picked from commit 705eaec28f7bee530b1c1635ba385a49a1feaf32) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
* gh-93351: Ensure the position information in AST nodes created by the parser ↵Miss Islington (bot)2022-05-301-0/+26
| | | | | | | is always consistent (GH-93352) (cherry picked from commit 5893b5db98b38b17750c0572c7209774a5034898) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>