16 lines
565 B
Python
16 lines
565 B
Python
from pathlib import Path
|
|
|
|
|
|
def test_mro_loop_index_declared_before_c89_for_loop():
|
|
source = Path("cpython/Objects/typeobject.c").read_text()
|
|
start = source.index("_PyType_InitCache(PyInterpreterState *interp)")
|
|
end = source.index("\n}", start) + 2
|
|
function = source[start:end]
|
|
assert "Py_ssize_t i;" in function
|
|
assert "for (i = 0;" in function
|
|
assert "for (Py_ssize_t i = 0;" not in function
|
|
|
|
|
|
if __name__ == "__main__":
|
|
test_mro_loop_index_declared_before_c89_for_loop()
|
|
print("typeobject MRO loop index C89 declaration: PASS") |