[3.14] gh-139525: Don't specialize functions which have a modified vectorcall (GH-139524) (#139709)

Don't specialize functions which have a modified vectorcall
This commit is contained in:
Dino Viehland 2025-10-08 09:13:34 -07:00 committed by GitHub
parent 1c1a0bdfdc
commit 81dc8b12f0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 37 additions and 0 deletions

View file

@ -567,6 +567,14 @@ def test(default=None):
with self.assertRaises(RecursionError):
test()
def test_dont_specialize_custom_vectorcall(self):
def f():
raise Exception("no way")
_testinternalcapi.set_vectorcall_nop(f)
for _ in range(_testinternalcapi.SPECIALIZATION_THRESHOLD):
f()
def make_deferred_ref_count_obj():
"""Create an object that uses deferred reference counting.