bpo-45949: Pure Python freeze module for cross builds (GH-29899)

This commit is contained in:
Christian Heimes 2021-12-13 21:48:46 +02:00 committed by GitHub
parent a62be77266
commit eb483c46d6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 205 additions and 115 deletions

View file

@ -393,13 +393,14 @@ _Py_get_%%NAME%%_toplevel(void)
}
"""
FROZEN_COMMENT = "/* Auto-generated by Programs/_freeze_module.c */"
FROZEN_COMMENT_C = "/* Auto-generated by Programs/_freeze_module.c */"
FROZEN_COMMENT_PY = "/* Auto-generated by Programs/_freeze_module.py */"
FROZEN_DATA_LINE = r"\s*(\d+,\s*)+\s*"
def is_frozen_header(source: str) -> bool:
return source.startswith(FROZEN_COMMENT)
return source.startswith((FROZEN_COMMENT_C, FROZEN_COMMENT_PY))
def decode_frozen_data(source: str) -> types.CodeType: