summaryrefslogtreecommitdiffstats
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
* gh-93103: Parser uses PyConfig.parser_debug instead of Py_DebugFlag (#93106)Victor Stinner2022-05-241-1/+1
| | | | | | | * Replace deprecated Py_DebugFlag with PyConfig.parser_debug in the parser. * Add Parser.debug member. * Add tok_state.debug member. * Py_FrozenMain(): Replace Py_VerboseFlag with PyConfig.verbose.
* gh-93065: Fix HAMT to iterate correctly over 7-level deep trees (GH-93066)Yury Selivanov2022-05-231-3/+11
| | | | | | | 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>
* gh-93061: Mark as artificial: backwards jump after async for (GH-93062)Dennis Sweeney2022-05-231-0/+2
|
* GH-89914: Make the oparg of the YIELD_VALUE instruction equal the stack ↵Mark Shannon2022-05-193-9/+13
| | | | depth. (GH-92960)
* GH-90690: Remove `PRECALL` instruction (GH-92925)Mark Shannon2022-05-194-309/+211
|
* Split refcount stats into 'interpreter' and 'non-interpreter' (GH-92919)Mark Shannon2022-05-183-0/+6
|
* bpo-42047: Add native thread ID for DragonFlyBSD (#22714)David CARLIER2022-05-181-0/+5
| | | | | | Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: kj <28750310+Fidget-Spinner@users.noreply.github.com> Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@protonmail.com> Co-authored-by: Victor Stinner <vstinner@python.org>
* gh-92782: unify the style of CFG traversal algorithms in the compiler (GH-92784)Irit Katriel2022-05-171-38/+45
|
* Improve object stats (#92845)Mark Shannon2022-05-162-0/+4
| | | | | * Add incref/decref stats * Show ratios for allocation in summary
* gh-89653: Use int type for Unicode kind (#92704)Victor Stinner2022-05-131-2/+2
| | | | Use the same type that PyUnicode_FromKindAndData() kind parameter type (public C API): int.
* GH-92236: Remove spurious "line" event when starting coroutine or generator. ↵Mark Shannon2022-05-131-0/+6
| | | | (GH-92722)
* Update outdated `LOAD_METHOD` comments in `Python/ceval.c` (GH-92641)Crowthebird2022-05-121-2/+2
|
* gh-92536: PEP 623: Remove wstr and legacy APIs from Unicode (GH-92537)Inada Naoki2022-05-124-86/+3
|
* gh-92651: Remove the Include/token.h header file (#92652)Victor Stinner2022-05-111-1/+0
| | | | | | | | | | | | | | | Remove the token.h header file. There was never any public tokenizer C API. The token.h header file was only designed to be used by Python internals. Move Include/token.h to Include/internal/pycore_token.h. Including this header file now requires that the Py_BUILD_CORE macro is defined. It no longer checks for the Py_LIMITED_API macro. Rename functions: * PyToken_OneChar() => _PyToken_OneChar() * PyToken_TwoChars() => _PyToken_TwoChars() * PyToken_ThreeChars() => _PyToken_ThreeChars()
* gh-92632: Make function starunpack_helper run faster when encounters starred ↵zikcheng2022-05-111-0/+1
| | | | argument. (GH-92655)
* gh-92619: Fix bug where the compiler duplicates exit blocks unnecessarily ↵Irit Katriel2022-05-101-1/+9
| | | | (GH-92620)
* gh-88750: On Windows, PyThread_acquire_lock() no longer checks for NULL (#92586)Victor Stinner2022-05-101-8/+12
| | | | | On Windows, PyThread_acquire_lock(), PyThread_acquire_lock_timed() and PyThread_release_lock() no longer check at runtime if the lock is not NULL.
* gh-88750: Remove the PYTHONTHREADDEBUG env var support. (#92509)Gregory P. Smith2022-05-094-84/+3
| | | | Remove the `PYTHONTHREADDEBUG` env var support. Remove no-op dprintf() macro calls.
* gh-88279: Fix compiler warning for using deprecated PySys_SetArgvEx (#92428)Serhiy Storchaka2022-05-071-0/+3
|
* 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
|
* gh-90667: Add specializations of Py_DECREF when types are known (GH-30872)Dennis Sweeney2022-04-192-41/+45
|
* bpo-46712: share more global strings in deepfreeze (gh-32152)Kumar Aditya2022-04-191-0/+3
| | | (for gh-90868)
* gh-91625: Don't ignore extended args of adaptive opcodes (GH-91626)Dennis Sweeney2022-04-171-16/+21
|
* Fix refleaks in PyErr_SetHandledException (GH-91627)Dennis Sweeney2022-04-171-3/+2
|
* gh-78607: Replace __ltrace__ with __lltrace__ (GH-91619)Dennis Sweeney2022-04-161-1/+1
|
* gh-91462: Make lltrace output human-readable. (GH-91463)Dennis Sweeney2022-04-161-35/+83
| | | | | | * Transform opcodes into opnames * Print the whole stack at each opcode, and eliminate prtrace output at each (push/pop/stackadj) * Display info about the function at each resume_frame
* Fix an out of date comment in compile.c (GH-91615)Irit Katriel2022-04-161-1/+2
|
* gh-89770: Implement PEP-678 - Exception notes (GH-31317)Irit Katriel2022-04-161-24/+57
|
* gh-91276: Make JUMP_IF_TRUE_OR_POP/JUMP_IF_FALSE_OR_POP relative (GH-32215)Irit Katriel2022-04-152-4/+19
|
* gh-90501: Add PyErr_GetHandledException and PyErr_SetHandledException (GH-30531)Irit Katriel2022-04-151-8/+33
|
* gh-90699: Use _Py_STR(empty) instead of PyUnicode_New(0, 0) for BUILD_STRING ↵Dennis Sweeney2022-04-151-6/+2
| | | | (GH-91476)