Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: python/cpython
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
Choose a base ref
...
head repository: eendebakpt/cpython
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: feature/clinic-parser-split
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 1 commit
  • 48 files changed
  • 2 contributors

Commits on Sep 13, 2026

  1. gh-136681: Shrink _PyArg_Parser and skip its init for static kwtuples

    Move the fields only used by parsers with a format string (format,
    custom_msg, min, max) into a new _PyArg_ParserExt structure, referenced
    by _PyArg_Parser.ext.  Argument Clinic emits it only for the few
    functions parsed with _PyArg_ParseStackAndKeywords(); the ~750 parsers
    using _PyArg_UnpackKeywords() leave ext NULL.  With is_kwtuple_owned
    narrowed to uint8_t, _PyArg_Parser shrinks from 72 to 48 bytes on 64-bit
    platforms.
    
    Argument Clinic now also stores the number of positional-only
    parameters (pos) statically.  _PyArg_UnpackKeywords() therefore skips
    parser_init() when the keyword tuple is statically allocated (builtin
    modules): such parsers are never written to at run time, and are no
    longer registered for cleanup at finalization.  Lazily built keyword
    tuples are published with _Py_atomic_store_ptr_release() after all
    other fields are set.
    
    _parser_init() accepts a statically set pos (checked against the
    keyword list), and parser_clear() keeps it, since it only depends on
    the keywords.  The PyErr_BadInternalCall() checks in the internal
    _PyArg_UnpackKeywords() become assertions.  c-analyzer is taught about
    the new _PyArg_ParserExt static variables.
    
    Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
    eendebakpt and claude committed Sep 13, 2026
    Configuration menu
    Copy the full SHA
    6f9a09d View commit details
    Browse the repository at this point in the history
Loading