Skip to content

Match obsolete comparison diagnostics - #9074

Draft
youknowdot wants to merge 1 commit into
RustPython:mainfrom
youknowdot:fix-obsolete-comparison-diagnostic
Draft

youknowdot wants to merge 1 commit into
RustPython:mainfrom
youknowdot:fix-obsolete-comparison-diagnostic

Conversation

@youknowdot

@youknowdot youknowdot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Current Python 3.15 main target

#8950 is merged. This PR now targets main and replays only its unique commits onto 06007c81fa99e813cbf4583dab326764ba0ef017. Current head: 0596dee73ddc11c12c6c957bcd3b68d8a132a657. The prior bootstrap commits are not part of this PR's diff.

Normal commit hooks, whitespace checks, and independent source/patch-equivalence review passed. The intervening main fixes are preserved and this PR introduces no changes under Lib/. No new local build or runtime validation is claimed for this rebased head. The maintainer-requested [skip ci] marker remains; full CI is intentionally paused pending selective validation.

The previously identified parser limitation remains unresolved; this rebase does not fix or hide it.

Prior stack and validation history

The base/head references below describe earlier revisions; the current target and validation limits above supersede them.

Temporary CI pause

The head commit includes [skip ci] at the maintainer's request. This message-only amendment preserves the exact source tree and commit parents. Normal pull-request CI is intentionally skipped; required checks may remain pending. This does not itself cancel older runs or suppress pull_request_target workflows.

Python 3.15 stack

Depends on #8950 at 80d3e52f32341d3158c659d82a927373b51b6439. This PR targets the upstream stack/python-3.15-8950 branch at that exact commit, so its displayed diff contains only the leaf changes. Unique changes above #8950.

Current head 1c369652c89e651cd125d82e5e25618f4dade037 was checked by source/range-diff review, normal commit hooks, and patch checks. Its unique delta changes no files under Lib/ and inherits the 3.15.0 reference. No new local build or runtime execution is claimed for this stacked head; validation described below applies to the earlier head unless explicitly updated. Exact-head hosted CI is temporarily skipped.

The existing parser limitation remains unresolved; this stacking change adds no parser implementation or workaround.

Summary

Extract the compiler-only obsolete <> diagnostic fix from #8954, matching the Python 3.14.8 backport 66f8dbe0 / CPython #158190.

  • Infix 2 <> 3 suggests != and highlights both operator characters.
  • Bare <> stays a generic syntax error and highlights only its first character.
  • Existing Barry-mode rewriting and original source offsets remain unchanged.

The existing registry parser already supplies the required error information. No vendored parser, new parser feature, or Python 3.15 diagnostics are included. .python-version is pinned to 3.14.8, consistently with #9063 and the other approved 3.14.8 backports; 3.14.7 intentionally retains the older behavior.

Coverage preservation

Move exactly two changed Python-visible expectations from the existing Rust test into builtin_compile.py: the infix message and bare-operator end position. Their Rust sites retain structural Parse checks; all four original rejection cases and all other control assertions remain. The Python cases assert exact messages and all four position fields, plus an unrelated-token control and valid Barry-mode evaluation. No canonical assertion is weakened to make the test pass.

Validation

  • Independent source/diff review and open-PR duplicate screening.
  • Exact Python 3.14.8 focused ASCII cases pass; Python 3.14.7 and the previous native binary fail the changed expectations as expected.
  • Seven focused compiler tests, patched native execution of the exact Python block, and all four unchanged test_flufl cases pass.
  • Normal commit hooks, native build, and scoped Clippy with warnings denied.

Local Python validation deliberately runs only the exact ASCII diagnostic block, rather than claiming the entire builtin_compile.py snippet was executed. The full hosted matrix remains required.

@coderabbitai

coderabbitai Bot commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

if let Some(error) = parse_error
&& let Some(range) = self.invalid_legacy_operator(error)
{
if error.location.start() > range.start() {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this the right place instead of patching parser?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parser is the cleaner place for this diagnostic. I used the existing BarrySource adapter to keep the extraction independent of a parser release, but the review uncovered a real weakness: for 2 <<> 3, the textual match overlaps the << token and incorrectly emits the obsolete-comparison hint. I confirmed that with compile-only CPython 3.14.8/native checks. A comparison-context check in the pinned parser is the appropriate fix; the compiler override must also stop replacing that parser diagnostic. I am checking the narrow dependency path rather than importing the broader parser changes. This draft is not ready in its current form.

@youknowdot
youknowdot force-pushed the fix-obsolete-comparison-diagnostic branch from 5b0fac6 to 7b25dc1 Compare October 11, 2026 03:17
@youknowdot youknowdot changed the title Match Python 3.14.8 obsolete comparison diagnostics Match obsolete comparison diagnostics Oct 11, 2026
@youknowdot
youknowdot force-pushed the fix-obsolete-comparison-diagnostic branch from 7b25dc1 to 1c36965 Compare October 11, 2026 03:21
@youknowone
youknowone changed the base branch from main to stack/python-3.15-8950 October 11, 2026 03:26
@youknowdot
youknowdot force-pushed the fix-obsolete-comparison-diagnostic branch from 1c36965 to 0596dee Compare October 11, 2026 04:07
@youknowone
youknowone changed the base branch from stack/python-3.15-8950 to main October 11, 2026 04:09
@youknowdot
youknowdot force-pushed the fix-obsolete-comparison-diagnostic branch from 0596dee to aa02e48 Compare October 11, 2026 04:14
@github-actions

Copy link
Copy Markdown
Contributor

📦 Library Dependencies

The following Lib/ modules were modified. Here are their dependencies:

[ ] test: cpython/Lib/test/test_mmap.py (TODO: 19)

dependencies:

dependent tests: (2 tests)

  • mmap: test_os
    • multiprocessing.shared_memory: test_genericalias

Legend:

  • [+] path exists in CPython
  • [x] up-to-date, [ ] outdated

Use the existing Barry adapter token spans for ordinary obsolete-comparison diagnostics as well. Preserve parser errors for left-shift suffixes, malformed comparisons, comments and strings, with final Python 3.15 message and span regressions.

Assisted-by: OpenAI Codex:model identifier unavailable
@youknowdot
youknowdot force-pushed the fix-obsolete-comparison-diagnostic branch from aa02e48 to dd0c42f Compare October 11, 2026 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants