gh-122188: Move magic number to its own file (#122243)

* gh-122188: Move magic number to its own file

* Add versionadded directive

* Do work in C

* Integrate launcher.c

* Make _pyc_magic_number private

* Remove metadata

* Move sys.implementation -> _imp

* Modernize comment

* Move _RAW_MAGIC_NUMBER to the C side as well

* _pyc_magic_number -> pyc_magic_number

* Remove unused import

* Update docs

* Apply suggestions from code review

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>

* Fix typo in tests

---------

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
This commit is contained in:
Michael Droettboom 2024-07-30 15:31:05 -04:00 committed by GitHub
parent 2b163aa9e7
commit af0a00f022
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 307 additions and 295 deletions

View file

@ -705,7 +705,7 @@ def _unmarshal_code(self, pathname, fullpath, fullname, data):
source_bytes = _get_pyc_source(self, fullpath)
if source_bytes is not None:
source_hash = _imp.source_hash(
_bootstrap_external._RAW_MAGIC_NUMBER,
_imp.pyc_magic_number_token,
source_bytes,
)