Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

gh-151039: Fix a crash when datetime.timedelta outlives _datetime module#151044

Open
sobolevn wants to merge 4 commits into
python:mainpython/cpython:mainfrom
sobolevn:issue-151039sobolevn/cpython:issue-151039Copy head branch name to clipboard
Open

gh-151039: Fix a crash when datetime.timedelta outlives _datetime module#151044
sobolevn wants to merge 4 commits into
python:mainpython/cpython:mainfrom
sobolevn:issue-151039sobolevn/cpython:issue-151039Copy head branch name to clipboard

Conversation

@sobolevn
Copy link
Copy Markdown
Member

@sobolevn sobolevn commented Jun 7, 2026

Several changes:

  1. Always check that GET_CURRENT_STATE can return NULL
  2. Unwrap (void)PyWeakref_GetRef call into a full check for safety, there are multiple things that can go wrong when getting a weakref
  3. Remove assert(!PyErr_Occurred()); followed by if (PyErr_Occurred()) {

@sobolevn sobolevn requested a review from picnixz June 7, 2026 14:33
@sobolevn sobolevn 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 Jun 7, 2026
@sobolevn
Copy link
Copy Markdown
Member Author

sobolevn commented Jun 7, 2026

Ok, I just discovered #132413 which is related.

Comment thread Lib/test/datetimetester.py Outdated
Comment thread Misc/NEWS.d/next/Library/2026-06-07-17-29-33.gh-issue-151039.AZ0qBn.rst Outdated
…Z0qBn.rst

Co-authored-by: Stan Ulbrych <stan@python.org>
Comment thread Lib/test/datetimetester.py Outdated
Comment thread Lib/test/datetimetester.py Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting core review 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.