Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Skip __index__ handling in PyLong_AsNativeBytes #121115

Closed
Assignees
zooba
Labels
3.13bugs and security fixes3.14bugs and security fixes
@zooba

Description

@zooba

As per the discussion incapi-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_AsNativeBytes and 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 omitPyLong_Check before 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

Metadata

Metadata

Assignees

Labels

3.13bugs and security fixes3.14bugs and security fixes

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp