port: advance VC6 typeobject frontier and preserve regression coverage
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Regression for PySlice_New declarations accepted by VC6 C89."""
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
|
||||
source = Path(sys.argv[1] if len(sys.argv) > 1 else "cpython/Objects/sliceobject.c")
|
||||
text = source.read_text()
|
||||
match = re.search(r"PySlice_New\(PyObject \*start, PyObject \*stop, PyObject \*step\)\s*\{(.*?)\n\}", text, re.S)
|
||||
assert match, "PySlice_New definition not found"
|
||||
body = match.group(1)
|
||||
assert re.search(r"^\s*PyInterpreterState \*interp;\s*$", body, re.M), "interp must be declared at function entry"
|
||||
assert re.search(r"^\s*PySliceObject \*obj;\s*$", body, re.M), "obj must be declared at function entry"
|
||||
assert "PyInterpreterState *interp = _PyInterpreterState_GET();" not in body, "interp initialization must remain a separate assignment"
|
||||
assert re.search(r"interp\s*=\s*_PyInterpreterState_GET\(\);", body), "preserve interpreter lookup"
|
||||
print("PySlice_New C89 declaration placement and lookup: PASS")
|
||||
Reference in New Issue
Block a user