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: gpshead/cpython
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: claude/gifted-noether-pFmpK
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 1 commit
  • 6 files changed
  • 1 contributor

Commits on Jun 4, 2026

  1. gh-150877: Emit SyntaxWarning for 'from . lazy import x'

    Whitespace between relative-import dots and the module name is
    insignificant, so 'from . lazy import x' is parsed exactly like
    'from .lazy import x'. With PEP 810's 'lazy' soft keyword that
    spelling is most likely a transposition of 'lazy from . import x',
    and if a sibling module named 'lazy' exists the typo silently
    succeeds with completely different semantics (an eager import of
    the wrong module).
    
    The parser now uses the token positions (which are still available
    even though whitespace is insignificant to the grammar) to detect a
    gap between the last dot and a leading 'lazy' name component, and
    emits a SyntaxWarning suggesting 'lazy from . import'. Under
    warnings-as-errors it becomes a SyntaxError pointing at the module
    name. No warning is emitted for 'from .lazy import x', for other
    module names, or when the statement already uses the 'lazy' keyword.
    
    _PyPegen_checked_future_import is renamed to
    _PyPegen_checked_import_from and now receives the dot tokens and the
    module-name expression so it can perform the check; the existing
    __future__ handling is unchanged.
    
    https://claude.ai/code/session_012LQ4pV2HZEh5NAVQUoipMt
    claude committed Jun 4, 2026
    Configuration menu
    Copy the full SHA
    0f55141 View commit details
    Browse the repository at this point in the history
Loading