GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-155985: Do not fuse a set difference under IGNORECASE with LOCALE by fedonman · Pull Request #155993 · python/cpython

Conversation

@fedonman

@fedonman fedonman commented Aug 18, 2026 •
edited by bedevere-app Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

_fuse_difference() now sees the compile flags and skips the fusion when IGNORECASE and LOCALE are both set, which is exactly when the fused set would compile to IN_LOC_IGNORE. The flags are threaded through optimize() and _walk() and recombined for a scoped group, so (?i:...) inside a re.LOCALE pattern is covered too.

$ ./python -m test test_re

Total duration: 1.3 sec
Total tests: run=170 skipped=3
Total test files: run=1/1
Result: SUCCESS

No NEWS fragment: the fusion landed earlier in this cycle (GH-152214) and has never been in a release, so there is nothing a user could have hit.

  • Issue: Negative lookbehind ignored under re.IGNORECASE | re.LOCALE #155985

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@fedonman
pythongh-155985: Do not fuse a set difference under IGNORECASE with L…
8e9ae5d
…OCALE

_fuse_difference() rewrites <flat charset A> (?<![B]) into the single
charset [NEGATE] B [NEGATE] A.  That is sound where the engine walks a
set once, but SRE(charset_loc_ignore) walks it twice, once with the
lowercased character and once with the uppercased one, and matches if
either walk does.  The second walk starts with the NEGATE polarity
reset, so a character that matches B in one case and A in the other
escapes the subtraction.

The pass did not see the compile flags, so it could not tell the two
apart.  Thread the effective flags through optimize() and _walk(),
combining them for a scoped group, and skip the fusion when IGNORECASE
and LOCALE are both set, the condition _compiler.py already uses to
emit IN_LOC_IGNORE.
@bedevere-app bedevere-app Bot mentioned this pull request Aug 18, 2026
Negative lookbehind ignored under re.IGNORECASE | re.LOCALE #155985
Closed
@bedevere-app bedevere-app Bot added the awaiting review label Aug 18, 2026
@serhiy-storchaka
serhiy-storchaka self-requested a review August 27, 2026 08:13
This was referenced Aug 27, 2026
re.IGNORECASE | re.LOCALE: a negated character set matches the other case #156444
Closed
gh-156444: Fix a negated character set with IGNORECASE and LOCALE #156445
Merged
@serhiy-storchaka

serhiy-storchaka commented Aug 27, 2026

Copy link
Copy Markdown
Member

Thank you, but this is no longer needed after fixing the underlying issue.

fedonman reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@serhiy-storchaka serhiy-storchaka closed this Aug 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@serhiy-storchaka serhiy-storchaka Awaiting requested review from serhiy-storchaka

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

awaiting review

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@fedonman @serhiy-storchaka
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.