Skip to content

gh-148286: Remove invalid test in test_decodeescape#153187

Merged
StanFromIreland merged 4 commits into
python:mainfrom
StanFromIreland:PyBytes_DecodeEscape-ub
Jul 6, 2026
Merged

gh-148286: Remove invalid test in test_decodeescape#153187
StanFromIreland merged 4 commits into
python:mainfrom
StanFromIreland:PyBytes_DecodeEscape-ub

Conversation

@StanFromIreland

@StanFromIreland StanFromIreland commented Jul 6, 2026

Copy link
Copy Markdown
Member

This is technically disallowed by the documentation of PyBytes_DecodeEscape (added in 37e2762), which says:

s must not be NULL

However, this was triggered by our test suite, which explicitly tests this case:

self.assertEqual(decodeescape(NULL), b'')

Should we also update the documentation? CC @ZeroIntensity (added docs) and @serhiy-storchaka (added test)

@serhiy-storchaka

Copy link
Copy Markdown
Member

Simply comment out the test.

@StanFromIreland StanFromIreland marked this pull request as ready for review July 6, 2026 12:09
@StanFromIreland StanFromIreland changed the title gh-148286: Fix UB (applying zero offset to null pointer) in PyBytes_DecodeEscape gh-148286: Remove invalid test in test_decodeescape Jul 6, 2026

@serhiy-storchaka serhiy-storchaka left a comment

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.

LGTM. 👍

@StanFromIreland StanFromIreland added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes labels Jul 6, 2026
@StanFromIreland StanFromIreland merged commit 8477652 into python:main Jul 6, 2026
58 checks passed
@StanFromIreland StanFromIreland deleted the PyBytes_DecodeEscape-ub branch July 6, 2026 14:47
@miss-islington-app

Copy link
Copy Markdown

Thanks @StanFromIreland for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14, 3.15.
🐍🍒⛏🤖

@miss-islington-app

Copy link
Copy Markdown

Sorry, @StanFromIreland, I could not cleanly backport this to 3.14 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 8477652cc122e744bcc70c1e133905bcbe2d8516 3.14

@bedevere-app

bedevere-app Bot commented Jul 6, 2026

Copy link
Copy Markdown

GH-153204 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 pre-release feature fixes, bugs and security fixes label Jul 6, 2026
@miss-islington-app

Copy link
Copy Markdown

Sorry, @StanFromIreland, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 8477652cc122e744bcc70c1e133905bcbe2d8516 3.13

@StanFromIreland StanFromIreland removed the needs backport to 3.13 bugs and security fixes label Jul 6, 2026
@StanFromIreland StanFromIreland removed the needs backport to 3.14 bugs and security fixes label Jul 6, 2026
StanFromIreland added a commit that referenced this pull request Jul 6, 2026
…) (#153204)

(cherry picked from commit 8477652)

Co-authored-by: Stan Ulbrych <stan@python.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants