Skip to content

Conversation

@colesbury
Copy link
Contributor

@colesburycolesbury commented Nov 21, 2024

The methodcaller C vectorcall implementation uses an arguments array that is shared across calls. The first argument is modified on every invocation. This isn't thread-safe in the free threading build. I think it's also not safe in general, but for now just disable it in the free threading build.

The `methodcaller` C vectorcall implementation uses an arguments array that is shared across calls. The first argument is modified on every invocation. This isn't thread-safe in the free threading build. I think it's also not safe in general, but for now just disable it in the free threading build.
@mpage
Copy link
Contributor

Would it be worth adding a regression test?

@colesbury
Copy link
ContributorAuthor

I think it'll be better to rely on something similar to pytest-run-parallel on test_operator.py, but I will add a test case if you prefer.

@mpage
Copy link
Contributor

I think it'll be better to rely on something similar to pytest-run-parallel on test_operator.py

sgtm

@miss-islington-app
Copy link

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

@colesburycolesbury deleted the gh-127065-methodcaller branch November 22, 2024 14:22
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Nov 22, 2024
…ild (pythonGH-127109) The `methodcaller` C vectorcall implementation uses an arguments array that is shared across calls. The first argument is modified on every invocation. This isn't thread-safe in the free threading build. I think it's also not safe in general, but for now just disable it in the free threading build. (cherry picked from commit f83ca69) Co-authored-by: Sam Gross <colesbury@gmail.com>
@bedevere-app
Copy link

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

@bedevere-appbedevere-appbot removed the needs backport to 3.13 bugs and security fixes label Nov 22, 2024
colesbury added a commit that referenced this pull request Nov 22, 2024
…uild (GH-127109) (GH-127150) The `methodcaller` C vectorcall implementation uses an arguments array that is shared across calls. The first argument is modified on every invocation. This isn't thread-safe in the free threading build. I think it's also not safe in general, but for now just disable it in the free threading build. (cherry picked from commit f83ca69) Co-authored-by: Sam Gross <colesbury@gmail.com>
ebonnal pushed a commit to ebonnal/cpython that referenced this pull request Jan 12, 2025
…ild (python#127109) The `methodcaller` C vectorcall implementation uses an arguments array that is shared across calls. The first argument is modified on every invocation. This isn't thread-safe in the free threading build. I think it's also not safe in general, but for now just disable it in the free threading build.
Sign up for freeto 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

@colesbury@mpage