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
C call specialization misses with METH_CLASS, METH_STATIC or METH_COEXIST #157833
The specializer ignores METH_CLASS, METH_STATIC and METH_COEXIST when selecting a specialized C-call instruction, but the corresponding flag guards compare all flags. Affected calls fail these guards and fall back to generic CALL, even after repeated specialization. Return values are correct.
Save this as repro.py and run PYTHON_JIT=0 python repro.py with CPython 3.13 or newer:
Output from an unpatched Linux build of 5539c2a5437 (3.16.0a0):
control CALL_BUILTIN_FAST hit
affected CALL_BUILTIN_FAST miss
Both call sites should report hit. The example detects misses by comparing the adaptive counter before and after ten calls.
For dict.fromkeys, the specializer masks out METH_CLASS and selects CALL_BUILTIN_FAST, but its guard requires exactly METH_FASTCALL. The actual flags are METH_FASTCALL | METH_CLASS. The method-descriptor guards and corresponding Tier 2 optimizer checks have the same mismatch.
I also reproduced the issue on Linux with CPython 3.13.14, 3.14.7, 3.14.7 free-threaded and 3.15.0rc2.
Activity
pythongh-157833: Fix specialized C calls with additional method flags
fixup! pythongh-157833: Fix specialized C calls with additional metho…
fixup! pythongh-157833: Fix specialized C calls with additional metho…
gh-157833: Fix specialized C calls with additional method flags (GH-1…