You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
functools.partial does not re-set vector call. #119109
/* pto->kw is mutable, so need to check every time */
Indicates that it needs to be checked every time. However, once it removes vectorcall in partial_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:
Set additional flag in partial_setvectorcall(pto->hasvcall) storing state whether vectorcall is supported. Then implement fallback in partial_call in the same manner as it looks now in partial_vectorcall
Re-setting vectorcall after _PyObject_MakeTpCall in partial_vectorcall_fallback. So that partial_vectorcall will stay as a primary entry in all cases. This adds 4ns overhead compared to 1.
Leave it as it is, but remove confusion that this needs to be checked more than 1 time.
Activity
Merge remote-tracking branch 'upstream/main' into pythongh-119109-par…
Merge remote-tracking branch 'upstream/main' into pythongh-119109-par…
Merge branch 'main' into pythongh-119109-partial_vectorcall_kw
Merge branch 'main' into pythongh-119109-partial_vectorcall_kw
gh-119109: improve `functools.partial` vectorcall with keywords (#124584
pythongh-119109: improve `functools.partial` vectorcall with keywords (…
pythongh-119109: improve `functools.partial` vectorcall with keywords (…
pythongh-119109: improve `functools.partial` vectorcall with keywords (…
pythongh-119109: improve `functools.partial` vectorcall with keywords (…
pythongh-119109: improve `functools.partial` vectorcall with keywords (…
functools.partialmethodsimplification #124652