Staging
v0.5.1
https://github.com/python/cpython
Revision 3daf0017de56ec1a5d61f5ff833d63dc3ca35278 authored by Miss Islington (bot) on 10 July 2020, 15:50:45 UTC, committed by GitHub on 10 July 2020, 15:50:45 UTC
(cherry picked from commit 6fc732a2116e2c42b0431bb7e2a21719351af755)

Co-authored-by: marload <rladhkstn8@gmail.com>
1 parent 51b36ed
Raw File
Tip revision: 3daf0017de56ec1a5d61f5ff833d63dc3ca35278 authored by Miss Islington (bot) on 10 July 2020, 15:50:45 UTC
Fix typo in docs: 'created by th' -> 'created by the' (GH-21384)
Tip revision: 3daf001
field3.py
# An absurd workaround for the lack of arithmetic in MS's resource compiler.
# After building Python, run this, then paste the output into the appropriate
# part of PC\python_nt.rc.
# Example output:
#
# * For 2.3a0,
# * PY_MICRO_VERSION = 0
# * PY_RELEASE_LEVEL = 'alpha' = 0xA
# * PY_RELEASE_SERIAL = 1
# *
# * and 0*1000 + 10*10 + 1 = 101.
# */
# #define FIELD3 101

import sys

major, minor, micro, level, serial = sys.version_info
levelnum = {'alpha': 0xA,
            'beta': 0xB,
            'candidate': 0xC,
            'final': 0xF,
           }[level]
string = sys.version.split()[0] # like '2.3a0'

print(" * For %s," % string)
print(" * PY_MICRO_VERSION = %d" % micro)
print(" * PY_RELEASE_LEVEL = %r = %s" % (level, hex(levelnum)))
print(" * PY_RELEASE_SERIAL = %d" % serial)
print(" *")

field3 = micro * 1000 + levelnum * 10 + serial

print(" * and %d*1000 + %d*10 + %d = %d" % (micro, levelnum, serial, field3))
print(" */")
print("#define FIELD3", field3)
back to top