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

functools.partial does not re-set vector call. #119109

Closed
Labels
stdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error
@dg-pb

Description

@dg-pb

Bug report

Bug description:

The comment here

/* pto->kw is mutable, so need to check every time */

Indicates that it needs to be checked every time. However, once it removes vectorcall inpartial_vectorcall_fallback there is no mechanism to set it back.

deffunc(a,b,c=0):returna-b-cp2=partial(func,1,c=1)In [13]:print(p2(2))# -1vectorcallcall-2In [14]:In [14]:print(p2(2))# -1call-2In [15]:delp2.keywords['c']In [16]:print(p2(2))# -1call-1

I see 3 possibilities:

  1. Set additional flag inpartial_setvectorcall(pto->hasvcall) storing state whethervectorcall is supported. Then implement fallback inpartial_call in the same manner as it looks now inpartial_vectorcall
  2. Re-setting vectorcall after_PyObject_MakeTpCall inpartial_vectorcall_fallback. So thatpartial_vectorcall will stay as a primary entry in all cases. This adds 4ns overhead compared to 1.
  3. Leave it as it is, but remove confusion that this needs to be checked more than 1 time.

CPython versions tested on:

3.11

Operating systems tested on:

macOS

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp