Skip to content

Commits on Oct 17, 2022

  1. gh-97669: Create Tools/build/ directory (#97963)

    Create Tools/build/ directory. Move the following scripts from
    Tools/scripts/ to Tools/build/:
    
    * check_extension_modules.py
    * deepfreeze.py
    * freeze_modules.py
    * generate_global_objects.py
    * generate_levenshtein_examples.py
    * generate_opcode_h.py
    * generate_re_casefix.py
    * generate_sre_constants.py
    * generate_stdlib_module_names.py
    * generate_token.py
    * parse_html5_entities.py
    * smelly.py
    * stable_abi.py
    * umarshal.py
    * update_file.py
    * verify_ensurepip_wheels.py
    
    Update references to these scripts.
    vstinner committed Oct 17, 2022

Commits on Oct 6, 2022

  1. gh-97973: Return all necessary information from the tokenizer (GH-97984)

    Right now, the tokenizer only returns type and two pointers to the start and end of the token.
    This PR modifies the tokenizer to return the type and set all of the necessary information,
    so that the parser does not have to this.
    lysnikolaou committed Oct 6, 2022

Commits on Sep 17, 2022

  1. gh-91210: Improve error message when non-default param follows default (

    GH-95933)
    
    - Improve error message when parameter without a default follows one with a default
    - Show same error message when positional-only params precede the default/non-default sequence
    lysnikolaou committed Sep 17, 2022

Commits on Sep 13, 2022

  1. gh-96678: Fix UB of null pointer arithmetic (GH-96782)

    Automerge-Triggered-By: GH:pablogsal
    matthiasgoergens committed Sep 13, 2022

Commits on Sep 7, 2022

  1. gh-96268: Fix loading invalid UTF-8 (#96270)

    This makes tokenizer.c:valid_utf8 match stringlib/codecs.h:decode_utf8.
    
    It also fixes an off-by-one error introduced in 3.10 for the line number when the tokenizer reports bad UTF8.
    mdboom committed Sep 7, 2022

Commits on Sep 2, 2022

  1. gh-95778: CVE-2020-10735: Prevent DoS by very large int() (#96499)

    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.
    
    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#). Much of that text wound up in the Issue. Backports PRs already exist. See the issue for links.
    gpshead committed Sep 2, 2022

Commits on Jul 28, 2022

  1. gh-95355: Check tokens[0] after allocating memory (GH-95356)

    #95355
    
    Automerge-Triggered-By: GH:pablogsal
    imzhuhl committed Jul 28, 2022

Commits on Jul 24, 2022

  1. gh-95185: Check recursion depth in the AST constructor (#95186)

    Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
    pablogsal and serhiy-storchaka committed Jul 24, 2022

Commits on Jul 18, 2022

  1. gh-94949: Disallow parsing parenthesised ctx mgr with old feature_ver…

    …sion (#94950)
    
    * gh-94949: Disallow parsing parenthesised ctx manager with old feature_version
    
    * 📜🤖 Added by blurb_it.
    
    * Allow it with feature_version=(3, 9) as well
    
    Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
    hauntsaninja and blurb-it[bot] committed Jul 18, 2022
  2. gh-94947: Disallow parsing walrus with feature_version < (3, 8) (#94948)

    * gh-94947: Disallow parsing walrus with feature_version < (3, 8)
    
    * oops, commit the parser
    
    * 📜🤖 Added by blurb_it.
    
    Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
    hauntsaninja and blurb-it[bot] committed Jul 18, 2022

Commits on Jul 16, 2022

  1. [3.11] bpo-14916: interactive fd is not tied to stdin [type-bug] (#91469

    )
    
    * bpo-14916: interactive fd is not always stdin
    
    related to #31006 merged bugfix
    
    following https://bugs.python.org/issue14916
    
    * 📜🤖 Added by blurb_it.
    
    Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
    pmp-p and blurb-it[bot] committed Jul 16, 2022

Commits on Jul 5, 2022

  1. gh-94360: Fix a tokenizer crash when reading encoded files with synta…

    …x errors from stdin (#94386)
    
    * gh-94360: Fix a tokenizer crash when reading encoded files with syntax errors from stdin
    
    Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
    
    * nitty nit
    
    Co-authored-by: Łukasz Langa <lukasz@langa.pl>
    pablogsal and ambv committed Jul 5, 2022

Commits on Jun 26, 2022

  1. gh-94192: Fix error for dictionary literals with invalid expression a…

    …s value. (#94304)
    
    * Fix error for dictionary literals with invalid expression as value.
    
    * Remove trailing whitespace
    wookie184 committed Jun 26, 2022

Commits on Jun 22, 2022

Commits on Jun 20, 2022

  1. gh-93937: PyOS_StdioReadline() uses PyConfig.legacy_windows_stdio (#9…

    …4024)
    
    On Windows, PyOS_StdioReadline() now gets
    PyConfig.legacy_windows_stdio from _PyOS_ReadlineTState, rather than
    using the deprecated global Py_LegacyWindowsStdioFlag variable.
    
    Fix also a compiler warning in Py_SetStandardStreamEncoding().
    vstinner committed Jun 20, 2022

Commits on Jun 14, 2022

  1. gh-93741: Add private C API _PyImport_GetModuleAttrString() (GH-93742)

    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.
    serhiy-storchaka committed Jun 14, 2022

Commits on Jun 10, 2022

  1. gh-93671: Avoid exponential backtracking in deeply nested sequence pa…

    …tterns in match statements (GH-93680)
    
    Co-authored-by: Łukasz Langa <lukasz@langa.pl>
    pablogsal and ambv committed Jun 10, 2022

Commits on Jun 1, 2022

  1. gh-93418: Fix an assert when an f-string expression is followed by an…

    … '=', but no closing brace. (gh-93419)
    ericvsmith committed Jun 1, 2022

Commits on May 24, 2022

  1. gh-93103: Parser uses PyConfig.parser_debug instead of Py_DebugFlag (#…

    …93106)
    
    * 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.
    vstinner committed May 24, 2022

Commits on May 11, 2022

  1. gh-92651: Remove the Include/token.h header file (#92652)

    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()
    vstinner committed May 11, 2022

Commits on May 4, 2022

  1. Use static inline function Py_EnterRecursiveCall() (#91988)

    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()
    vstinner committed May 4, 2022
Older