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

Receiving vector calls in the Py_LIMITED_API #93274

Closed
Assignees
encukou
Labels
@wjakob

Description

@wjakob

Feature or enhancement

ThePyType_FromSpec family of functions provides a convenient and forward-compatible way mechanism for creating new types. It could in principle also be used to createcallables providing aPEP-590 vector call interface, which has significant performance benefits for binding libraries (see therelated discussion here).

One can already specify a member named__vectorcalloffset__ inPyType_FromSpec. This isn't fully working in the limited API, however. I encountered the following problems.

  1. ThePy_TPFLAGS_HAVE_VECTORCALL flag is not part of the limited API.
  2. ThePyVectorcall_NARGS() helper function is not part of the limited API.
  3. One would normally settp_call to the compatibility dispatch routinePyVectorcall_Call. It is, however, also not part of the public ABI.
  4. Leavingtp_call unspecified is not an option.PyType_Ready() even throws an exception intype_ready_pre_checks() whentp_call is unspecified.

Pitch

I propose the following changes:

  1. AddingPy_TPFLAGS_HAVE_VECTORCALL,PyVectorcall_NARGS(), andPyVectorcall_Call() to the limited API.
  2. Redundant, but nice: Settingtp_call toPyVectorcall_Call whenPyType_Ready encounters a type that doesn't have this field set.

Note that vector calls can bereceived andperformed. This issue is just about the receiving end.

Previous discussion

See the discord threadhttps://discuss.python.org/t/ideas-for-forward-compatible-and-fast-extension-libraries-in-python-3-12/15993/12.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp