summaryrefslogtreecommitdiffstats
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
* [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>
* [3.11] bpo-40514: Drop EXPERIMENTAL_ISOLATED_SUBINTERPRETERS (gh-93185) ↵Eric Snow2022-05-285-102/+0
| | | | | | | | | | | | | (GH-93306) (cherry picked from commit caa279d6fd5f151e57f891cd4f6ba51b532501c6) This was added for bpo-40514 (gh-84694) to test out a per-interpreter GIL. However, it has since proven unnecessary to keep the experiment in the repo. (It can be done as a branch in a fork like normal.) So here we are removing: * the configure option * the macro * the code enabled by the macro Automerge-Triggered-By: GH:ericsnowcurrently
* gh-93217: fix some issues in man page and --help (GH-93219)Miss Islington (bot)2022-05-261-5/+4
| | | | | (cherry picked from commit da397194832c4b8db8446af42919d8ad47b3cb4a) Co-authored-by: Éric <merwok@netwok.org>
* gh-91924: Fix __lltrace__ for non-UTF-8 stdout encoding (GH-93199)Miss Islington (bot)2022-05-251-1/+3
| | | | | | | | | | | Fix __lltrace__ 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(). (cherry picked from commit 5695c0e0a25da58dfc1d22fc1cd68c2fda0a320d) Co-authored-by: Victor Stinner <vstinner@python.org>
* gh-93065: Fix HAMT to iterate correctly over 7-level deep trees (GH-93066) ↵Miss Islington (bot)2022-05-241-3/+11
| | | | | | | | | | | | (GH-93145) 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-93062) ↵Miss Islington (bot)2022-05-231-0/+2
| | | | | | | (GH-93110) (cherry picked from commit a458be3263b4cb92f3fde726461e8ef44b2a4a9d) Co-authored-by: Dennis Sweeney <36520290+sweeneyde@users.noreply.github.com>
* GH-92236: Remove spurious "line" event when starting coroutine or generator. ↵Miss Islington (bot)2022-05-131-0/+6
| | | | | | (GH-92722) (GH-92772) (cherry picked from commit 22a1db378c5c381272362c5b2f68ac78a368e136)
* Update outdated `LOAD_METHOD` comments in `Python/ceval.c` (GH-92641)Miss Islington (bot)2022-05-121-2/+2
| | | | | (cherry picked from commit bdf99691972c4e452a86eb3ca7ff7ae748d881a6) Co-authored-by: Crowthebird <78076854+thatbirdguythatuknownot@users.noreply.github.com>
* gh-92619: Fix bug where the compiler duplicates exit blocks unnecessarily ↵Miss Islington (bot)2022-05-101-1/+9
| | | | | | | | | (GH-92620) (GH-92621) (cherry picked from commit 7c6b7ade8df35355484d3944779fe35dcc560aab) Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com> Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
* gh-88279: Fix compiler warning for using deprecated PySys_SetArgvEx (GH-92428)Miss Islington (bot)2022-05-081-0/+3
| | | | | (cherry picked from commit bd030b633f98ea5d9f93ef0105a51d2faf67070d) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* gh-92203: Add closure support to exec(). (#92204)larryhastings2022-05-062-19/+78
| | | Add a closure keyword-only parameter to exec(). It can only be specified when exec-ing a code object that uses free variables. When specified, it must be a tuple, with exactly the number of cell variables referenced by the code object. closure has a default value of None, and it must be None if the code object doesn't refer to any free variables.
* gh-57684: Update tests for PYTHONSAFEPATH=1 (#92358)Victor Stinner2022-05-061-1/+1
| | | | | Fix tests failing with the PYTHONSAFEPATH=1 env var. Enhance also -P help in Python usage (python --help).
* gh-57684: Add -P cmdline option and PYTHONSAFEPATH env var (#31542)Victor Stinner2022-05-054-3/+26
| | | | | | | | | | | | Add the -P command line option and the PYTHONSAFEPATH environment variable to not prepend a potentially unsafe path to sys.path. * Add sys.flags.safe_path flag. * Add PyConfig.safe_path member. * Programs/_bootstrap_python.c uses config.safe_path=0. * Update subprocess._optim_args_from_interpreter_flags() to handle the -P command line option. * Modules/getpath.py sets safe_path to 1 if a "._pth" file is present.
* GH-92239: Make sure that PEP 523 is supported, even when specializing first. ↵Mark Shannon2022-05-042-0/+8
| | | | (GH-92245)
* Use static inline function Py_EnterRecursiveCall() (#91988)Victor Stinner2022-05-043-434/+436
| | | | | | | | | | | | | | | | Currently, calling Py_EnterRecursiveCall() and Py_LeaveRecursiveCall() may use a function call or a static inline function call, depending if the internal pycore_ceval.h header file is included or not. Use a different name for the static inline function to ensure that the static inline function is always used in Python internals for best performance. Similar approach than PyThreadState_GET() (function call) and _PyThreadState_GET() (static inline function). * Rename _Py_EnterRecursiveCall() to _Py_EnterRecursiveCallTstate() * Rename _Py_LeaveRecursiveCall() to _Py_LeaveRecursiveCallTstate() * pycore_ceval.h: Rename Py_EnterRecursiveCall() to _Py_EnterRecursiveCall() and Py_LeaveRecursiveCall() and _Py_LeaveRecursiveCall()
* gh-78214: marshal: Stabilize FLAG_REF usage (GH-8226)Inada Naoki2022-05-041-2/+7
| | | | | | | | | Use FLAG_REF always for interned strings. Refcounts of interned string is very unstable. When compiling same source, refcounts of interned string in the output may be 1 or >1. It makes FLAG_REF usage unstable. To help reproducible build, use FLAG_REF for interned string even if refcnt(obj)==1.
* Add more stats for freelist use and allocations. (GH-92211)Mark Shannon2022-05-032-0/+7
|
* GH-91173: disable frozen modules in debug builds (#92023)Kumar Aditya2022-05-031-20/+21
|
* gh-91320: Argument Clinic uses _PyCFunction_CAST() (#32210)Victor Stinner2022-05-036-39/+39
| | | | Replace "(PyCFunction)(void(*)(void))func" cast with _PyCFunction_CAST(func).
* suggestions.c: Improve efficiency of levenshtein_distance method (#91835)Pieter Eendebak2022-05-021-1/+3
|
* gh-92063: Enforce types in specialized PRECALL opcodes (GH-92068)Dennis Sweeney2022-04-301-16/+27
| | | | | | | | | * Check the types of PRECALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS * fix PRECALL_NO_KW_METHOD_DESCRIPTOR_NOARGS as well * fix PRECALL_NO_KW_METHOD_DESCRIPTOR_O * fix PRECALL_NO_KW_METHOD_DESCRIPTOR_FAST
* gh-91869: Fix tracing of specialized instructions with extended args (GH-91945)Dennis Sweeney2022-04-283-20/+30
|
* gh-91719: Add pycore_opcode.h internal header file (#91906)Victor Stinner2022-04-253-6/+8
| | | | | | | | | | | Move the following API from Include/opcode.h (public C API) to a new Include/internal/pycore_opcode.h header file (internal C API): * EXTRA_CASES * _PyOpcode_Caches * _PyOpcode_Deopt * _PyOpcode_Jump * _PyOpcode_OpName * _PyOpcode_RelativeJump
* gh-84461: Add sys._emscripten_info, improve docs and build (gh-91781)Christian Heimes2022-04-231-0/+118
|
* gh-89279: In ceval.c, redefine some macros for speed (#32387)Guido van Rossum2022-04-221-13/+60
| | | | | | | | | | | Macros Py_DECREF, Py_XDECREF, Py_IS_TYPE, _Py_atomic_load_32bit_impl and _Py_DECREF_SPECIALIZED are redefined as macros that completely replace the inline functions of the same name. These three came out in the top four of functions that (in MSVC) somehow weren't inlined. Co-authored-by: Victor Stinner <vstinner@python.org> Co-authored-by: Dennis Sweeney <36520290+sweeneyde@users.noreply.github.com>
* gh-91768: C API no longer use "const PyObject*" type (#91769)Victor Stinner2022-04-211-4/+6
| | | | | | | | | | | | | Py_REFCNT(), Py_TYPE(), Py_SIZE() and Py_IS_TYPE() functions argument type is now "PyObject*", rather than "const PyObject*". * Replace also "const PyObject*" with "PyObject*" in functions: * _Py_strhex_impl() * _Py_strhex_with_sep() * _Py_strhex_bytes_with_sep() * Remove _PyObject_CAST_CONST() and _PyVarObject_CAST_CONST() macros. * Py_IS_TYPE() can now use Py_TYPE() in its implementation.
* GH-91719: Make MSVC generate somewhat faster switch code (#91718)Guido van Rossum2022-04-211-2/+4
| | | | | | | | | | | Apparently a switch on an 8-bit quantity where all cases are present generates a more efficient jump (doing only one indexed memory load instead of two). So we make opcode and use_tracing uint8_t, and generate a macro full of extra `case NNN:` lines for all unused opcodes. See https://github.com/faster-cpython/ideas/issues/321#issuecomment-1103263673
* GH-88116: Use a compact format to represent end line and column offsets. ↵Mark Shannon2022-04-212-178/+145
| | | | | | | | | | | | (GH-91666) * Stores all location info in linetable to conform to PEP 626. * Remove column table from code objects. * Remove end-line table from code objects. * Document new location table format
* gh-91731: Replace Py_BUILD_ASSERT() with static_assert() (#91730)Victor Stinner2022-04-203-25/+44
| | | | | | | | | | | | Python 3.11 now uses C11 standard which adds static_assert() to <assert.h>. * In pytime.c, replace Py_BUILD_ASSERT() with preprocessor checks on SIZEOF_TIME_T with #error. * On macOS, py_mach_timebase_info() now accepts timebase members with the same size than _PyTime_t. * py_get_monotonic_clock() now saturates GetTickCount64() to _PyTime_MAX: GetTickCount64() is unsigned, whereas _PyTime_t is signed.
* Cast to (destructor) to fix compiler warnings (GH-91711)Dennis Sweeney2022-04-201-11/+11
|