/
githubmirror
/
cpython
Обзор
Документация
Войти
/
githubmirror
/
cpython
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
Tools/build/consts_getter.py
20 строк
711 B
Albert N
gh-133059: Fix `Tools/build/deepfreeze.py` for new nsmallposints (#139906)
17 окт 2025, 11:48
Не верифицирован
17 окт 2025, 11:48
999ab89
Код
Авторство
О чём код?
from pathlib import Path ROOT = Path(__file__).resolve().parents[2] INTERNAL = ROOT / "Include" / "internal" def get_nsmallnegints_and_nsmallposints() -> tuple[int, int]: nsmallposints = None nsmallnegints = None with open(INTERNAL / "pycore_runtime_structs.h") as infile: for line in infile: if line.startswith("#define _PY_NSMALLPOSINTS"): nsmallposints = int(line.split()[-1]) elif line.startswith("#define _PY_NSMALLNEGINTS"): nsmallnegints = int(line.split()[-1]) break else: raise NotImplementedError assert nsmallposints assert nsmallnegints return nsmallnegints, nsmallposints