Skip to content

Conversation

@vfdev-5
Copy link
Contributor

@vfdev-5 vfdev-5 commented May 2, 2025

Fixes #133253

Description:

  • Making linecache thread-safe

cc @colesbury

@python-cla-bot
Copy link

python-cla-bot bot commented May 2, 2025

All commit authors signed the Contributor License Agreement.

CLA signed

@bedevere-app
Copy link

bedevere-app bot commented May 2, 2025

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

Copy link
Contributor

@hawkinsp hawkinsp left a comment

Choose a reason for hiding this comment

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

Consider checking in your tests, somewhere?

@vfdev-5 vfdev-5 force-pushed the make-linecache-threadsafe branch from a19749b to 67bfa7d Compare May 2, 2025 20:16
@bedevere-app
Copy link

bedevere-app bot commented May 2, 2025

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

@vfdev-5 vfdev-5 force-pushed the make-linecache-threadsafe branch 3 times, most recently from 690f5a8 to ff93d54 Compare May 5, 2025 10:46
@vfdev-5 vfdev-5 marked this pull request as ready for review May 5, 2025 10:46
@vfdev-5
Copy link
Contributor Author

vfdev-5 commented May 5, 2025

@rhettinger could you please review this PR fixing the data race in linecache (issue 133253) or suggest a right person for the code review. Thanks!

@colesbury colesbury requested a review from rhettinger May 5, 2025 15:46
Copy link
Contributor

@colesbury colesbury left a comment

Choose a reason for hiding this comment

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

This LGTM, but I'd appreciate @rhettinger's review

@vfdev-5 vfdev-5 force-pushed the make-linecache-threadsafe branch from ff93d54 to f4fe446 Compare May 5, 2025 19:21
@kumaraditya303 kumaraditya303 merged commit 8054184 into python:main May 9, 2025
39 checks passed
Pranjal095 pushed a commit to Pranjal095/cpython that referenced this pull request Jul 12, 2025
Co-authored-by: Sam Gross <colesbury@gmail.com>
taegyunkim pushed a commit to taegyunkim/cpython that referenced this pull request Aug 4, 2025
Co-authored-by: Sam Gross <colesbury@gmail.com>
@rostan-t
Copy link

@kumaraditya303, sorry to bump an old PR. Since this is a bugfix, could we please get it backported to 3.13 and 3.14?

@colesbury
Copy link
Contributor

colesbury commented Jan 16, 2026

Yeah, I think we should backport this.

@colesbury colesbury added the needs backport to 3.13 bugs and security fixes label Jan 16, 2026
@colesbury colesbury added the needs backport to 3.14 bugs and security fixes label Jan 16, 2026
@miss-islington-app
Copy link

Thanks @vfdev-5 for the PR, and @kumaraditya303 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

@miss-islington-app
Copy link

Thanks @vfdev-5 for the PR, and @kumaraditya303 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

@miss-islington-app
Copy link

Sorry, @vfdev-5 and @kumaraditya303, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 8054184f9f32c7ba561e6e23b358074824e4928d 3.13

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jan 16, 2026
(cherry picked from commit 8054184)

Co-authored-by: vfdev <vfdev.5@gmail.com>
Co-authored-by: Sam Gross <colesbury@gmail.com>
@bedevere-app
Copy link

bedevere-app bot commented Jan 16, 2026

GH-143910 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.14 bugs and security fixes label Jan 16, 2026
@vfdev-5 vfdev-5 deleted the make-linecache-threadsafe branch January 16, 2026 16:26
colesbury added a commit to colesbury/cpython that referenced this pull request Jan 16, 2026
(cherry picked from commit 8054184)

Co-authored-by: vfdev <vfdev.5@gmail.com>
Co-authored-by: Sam Gross <colesbury@gmail.com>
@bedevere-app
Copy link

bedevere-app bot commented Jan 16, 2026

GH-143911 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Jan 16, 2026
colesbury pushed a commit that referenced this pull request Jan 16, 2026
(cherry picked from commit 8054184)

Co-authored-by: vfdev <vfdev.5@gmail.com>
colesbury added a commit that referenced this pull request Jan 16, 2026
(cherry picked from commit 8054184)

Co-authored-by: vfdev <vfdev.5@gmail.com>
@bedevere-bot
Copy link

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot ARM64 MacOS M1 Refleaks NoGIL 3.13 (tier-2) has failed when building commit 0f21962.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/#/builders/1396/builds/1965) and take a look at the build logs.
  4. Check if the failure is related to this commit (0f21962) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/#/builders/1396/builds/1965

Failed tests:

  • test.test_multiprocessing_forkserver.test_processes

Failed subtests:

  • test_repr_rlock - test.test_multiprocessing_forkserver.test_processes.WithProcessesTestLock.test_repr_rlock

Summary of the results of the build (if available):

==

Click to see traceback logs
Traceback (most recent call last):
  File "/Users/buildbot/buildarea/3.13.itamaro-macos-arm64-aws.macos-with-brew.refleak.nogil/build/Lib/test/_test_multiprocessing.py", line 1493, in test_repr_rlock
    self.assertEqual('<RLock(SomeOtherThread, nonzero)>', repr(lock))
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: '<RLock(SomeOtherThread, nonzero)>' != '<RLock(None, 0)>'
- <RLock(SomeOtherThread, nonzero)>
+ <RLock(None, 0)>

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.

Race in linecache under free-threading

6 participants