-
-
Notifications
You must be signed in to change notification settings - Fork 29.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Skip __index__ handling in PyLong_AsNativeBytes #121115
Comments
zooba
added a commit
to zooba/cpython
that referenced
this issue
Jun 28, 2024
zooba
added a commit
that referenced
this issue
Jun 28, 2024
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this issue
Jun 28, 2024
…ythonGH-121118) (cherry picked from commit 2894aa1) Co-authored-by: Steve Dower <steve.dower@python.org>
zooba
added a commit
that referenced
this issue
Jun 28, 2024
mrahtz
pushed a commit
to mrahtz/cpython
that referenced
this issue
Jun 30, 2024
noahbkim
pushed a commit
to hudson-trading/cpython
that referenced
this issue
Jul 11, 2024
estyxx
pushed a commit
to estyxx/cpython
that referenced
this issue
Jul 17, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

As per the discussion in capi-workgroup/decisions#32 (and some other bugs here that I haven't bothered to look up), having int conversion functions call back into Python to evaluate
__index__can be problematic or unexpected (Python code may cause the GIL to be released, which could break threading invariants in the calling code).We should disable
__index__handling by default inPyLong_AsNativeBytesand provide a flag to reenable it. In general, calling__index__is only really useful on user-provided arguments, which are easily distinguishable from "private" variables in the caller's code.This allows the caller to omit
PyLong_Checkbefore calling the conversion function (if they need to guarantee they retain the thread), or to provide a single flag if they will allow it. They'll discover they need the flag due to aTypeError, which is safe, rather than a crash or native threading related issue, which is unsafe.Linked PRs
The text was updated successfully, but these errors were encountered: