Skip to content

Commits on Jul 31, 2022

Commits on Jul 13, 2022

  1. gh-90815: Fix test_embed for Windows PGO build with mimalloc (GH-94790)

    Fixes the failure of PGO building with `mimalloc` on Windows, ensuring that `test_bpo20891` does not break profiling data (`python31*.pgc`).
    neonene committed Jul 13, 2022

Commits on Jul 5, 2022

  1. gh-94485: Set line number of module's RESUME instruction to 0, as spe…

    …cified by PEP 626 (GH-94552)
    
    Co-authored-by: Mark Shannon <mark@hotpy.org>
    iritkatriel and markshannon committed Jul 5, 2022

Commits on Jun 21, 2022

  1. GH-91432: Specialize FOR_ITER (GH-91713)

    * Adds FOR_ITER_LIST and FOR_ITER_RANGE specializations.
    
    * Adds _PyLong_AssignValue() internal function to avoid temporary boxing of ints.
    sweeneyde committed Jun 21, 2022

Commits on Jun 16, 2022

Commits on Jun 3, 2022

  1. gh-93382: Cache result of PyCode_GetCode in codeobject (GH-93383)

    Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
    Co-authored-by: Dennis Sweeney <36520290+sweeneyde@users.noreply.github.com>
    3 people committed Jun 3, 2022

Commits on May 19, 2022

Commits on May 5, 2022

  1. gh-57684: Add -P cmdline option and PYTHONSAFEPATH env var (#31542)

    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.
    vstinner committed May 5, 2022

Commits on May 4, 2022

  1. gh-78214: marshal: Stabilize FLAG_REF usage (GH-8226)

    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.
    methane committed May 4, 2022

Commits on Apr 21, 2022

  1. GH-88116: Use a compact format to represent end line and column offse…

    …ts. (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
    markshannon committed Apr 21, 2022

Commits on Feb 21, 2022

  1. bpo-46329: Streamline calling sequence a bit. (GH-31465)

    * Move handling of bound-methods to PRECALL.
    
    * Remove call_shape.postcall_shrink
    
    * Remove call_shape.callable
    
    * Remove call_shape.callable. Change CALL oparg to match PRECALL oparg.
    
    * Move KW_NAMES before PRECALL.
    
    * Update opcode docs in dis.rst
    markshannon committed Feb 21, 2022

Commits on Feb 18, 2022

  1. bpo-46329: Change calling sequence (again) (GH-31373)

    * Change calling sequence: Add PUSH_NULL. Merge PRECALL_FUNCTION and PRECALL_METHOD into PRECALL.
    markshannon committed Feb 18, 2022

Commits on Feb 8, 2022

  1. bpo-46541: Replace core use of _Py_IDENTIFIER() with statically initi…

    …alized global objects. (gh-30928)
    
    We're no longer using _Py_IDENTIFIER() (or _Py_static_string()) in any core CPython code.  It is still used in a number of non-builtin stdlib modules.
    
    The replacement is: PyUnicodeObject (not pointer) fields under _PyRuntimeState, statically initialized as part of _PyRuntime.  A new _Py_GET_GLOBAL_IDENTIFIER() macro facilitates lookup of the fields (along with _Py_GET_GLOBAL_STRING() for non-identifier strings).
    
    https://bugs.python.org/issue46541#msg411799 explains the rationale for this change.
    
    The core of the change is in:
    
    * (new) Include/internal/pycore_global_strings.h - the declarations for the global strings, along with the macros
    * Include/internal/pycore_runtime_init.h - added the static initializers for the global strings
    * Include/internal/pycore_global_objects.h - where the struct in pycore_global_strings.h is hooked into _PyRuntimeState
    * Tools/scripts/generate_global_objects.py - added generation of the global string declarations and static initializers
    
    I've also added a --check flag to generate_global_objects.py (along with make check-global-objects) to check for unused global strings.  That check is added to the PR CI config.
    
    The remainder of this change updates the core code to use _Py_GET_GLOBAL_IDENTIFIER() instead of _Py_IDENTIFIER() and the related _Py*Id functions (likewise for _Py_GET_GLOBAL_STRING() instead of _Py_static_string()).  This includes adding a few functions where there wasn't already an alternative to _Py*Id(), replacing the _Py_Identifier * parameter with PyObject *.
    
    The following are not changed (yet):
    
    * stop using _Py_IDENTIFIER() in the stdlib modules
    * (maybe) get rid of _Py_IDENTIFIER(), etc. entirely -- this may not be doable as at least one package on PyPI using this (private) API
    * (maybe) intern the strings during runtime init
    
    https://bugs.python.org/issue46541
    ericsnowcurrently committed Feb 8, 2022

Commits on Jan 28, 2022

  1. bpo-46329: Split calls into precall and call instructions. (GH-30855)

    * Add PRECALL_FUNCTION opcode.
    
    * Move 'call shape' varaibles into struct.
    
    * Replace CALL_NO_KW and CALL_KW with KW_NAMES and CALL instructions.
    
    * Specialize for builtin methods taking using the METH_FASTCALL | METH_KEYWORDS protocol.
    
    * Allow kwnames for specialized calls to builtin types.
    
    * Specialize calls to tuple(arg) and str(arg).
    markshannon committed Jan 28, 2022

Commits on Jan 27, 2022

  1. bpo-46476: Fix memory leak in code objects generated by deepfreeze (G…

    …H-30853)
    
    Add _Py_Deepfreeze_Fini() and _PyStaticCode_Dealloc() functions.
    kumaraditya303 committed Jan 27, 2022

Commits on Jan 21, 2022

  1. bpo-46417: _testembed.c avoids Py_SetProgramName() (GH-30732)

    * _testembed_Py_Initialize() now uses the PyConfig API, rather than
      deprecated Py_SetProgramName().
    * Reduce INIT_LOOPS from 16 to 4: test_embed now takes 8.7 seconds
      rather than 14.7 seconds.
    vstinner committed Jan 21, 2022
  2. bpo-46417: Finalize structseq types at exit (GH-30645)

    Add _PyStructSequence_FiniType() and _PyStaticType_Dealloc()
    functions to finalize a structseq static type in Py_Finalize().
    Currrently, these functions do nothing if Python is built in release
    mode.
    
    Clear static types:
    
    * AsyncGenHooksType: sys.set_asyncgen_hooks()
    * FlagsType: sys.flags
    * FloatInfoType: sys.float_info
    * Hash_InfoType: sys.hash_info
    * Int_InfoType: sys.int_info
    * ThreadInfoType: sys.thread_info
    * UnraisableHookArgsType: sys.unraisablehook
    * VersionInfoType: sys.version
    * WindowsVersionType: sys.getwindowsversion()
    vstinner committed Jan 21, 2022

Commits on Jan 11, 2022

  1. bpo-46303: Move fileutils.h private functions to internal C API (GH-3…

    …0484)
    
    Move almost all private functions of Include/cpython/fileutils.h to
    the internal C API Include/internal/pycore_fileutils.h.
    
    Only keep _Py_fopen_obj() in Include/cpython/fileutils.h, since it's
    used by _testcapi which must not use the internal C API.
    
    Move EncodeLocaleEx() and DecodeLocaleEx() functions from _testcapi
    to _testinternalcapi, since the C API moved to the internal C API.
    vstinner committed Jan 11, 2022

Commits on Jan 6, 2022

  1. bpo-45923: Handle call events in bytecode (GH-30364)

    * Add a RESUME instruction to handle "call" events.
    markshannon committed Jan 6, 2022

Commits on Dec 14, 2021

  1. bpo-44525: Split calls into PRECALL and CALL (GH-30011)

    * Add 3 new opcodes for calls: PRECALL_METHOD, CALL_NO_KW, CALL_KW.
    
    * Update specialization to handle new CALL opcodes.
    
    * Specialize call to method descriptors.
    
    * Remove old CALL opcodes: CALL_FUNCTION, CALL_METHOD, CALL_METHOD_KW, CALL_FUNCTION_KW.
    markshannon committed Dec 14, 2021

Commits on Dec 3, 2021

  1. bpo-45950: Introduce Bootstrap Python again (#29859)

    The build system now uses a :program:`_bootstrap_python` interpreter for
    freezing and deepfreezing again. To speed up build process the build tools
    :program:`_bootstrap_python` and :program:`_freeze_module` are no longer
    build with LTO.
    
    Cross building depends on a build Python interpreter, which must have same
    version and bytecode as target host Python.
    tiran committed Dec 3, 2021

Commits on Dec 2, 2021

  1. bpo-45954: Rename PyConfig.no_debug_ranges to code_debug_ranges (GH-2…

    …9886)
    
    Rename PyConfig.no_debug_ranges to PyConfig.code_debug_ranges and
    invert the value.
    
    Document -X no_debug_ranges and PYTHONNODEBUGRANGES env var in
    PyConfig.code_debug_ranges documentation.
    vstinner committed Dec 2, 2021

Commits on Nov 2, 2021

Commits on Nov 1, 2021

  1. bpo-45666: Use %S for MSVC and %s elsewhere for swprintf in `_t…

    …estembed.c` (GH-29341)
    
    Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
    sobolevn and Fidget-Spinner committed Nov 1, 2021

Commits on Oct 31, 2021

Commits on Oct 28, 2021

  1. bpo-45395: Make custom frozen modules additions instead of replacemen…

    …ts. (gh-28778)
    
    Currently custom modules (the array set on PyImport_FrozenModules) replace all the frozen stdlib modules. That can be problematic and is unlikely to be what the user wants. This change treats the custom frozen modules as additions instead. They take precedence over all other frozen modules except for those needed to bootstrap the import system. If the "code" field of an entry in the custom array is NULL then that frozen module is treated as disabled, which allows a custom entry to disable a frozen stdlib module.
    
    This change allows us to get rid of is_essential_frozen_module() and simplifies the logic for which frozen modules should be ignored.
    
    https://bugs.python.org/issue45395
    ericsnowcurrently committed Oct 28, 2021
Older