Handle 3.7+ "else" branch removal...

As seen in _cmp() of python3.8/distutils/version.py with optimization -O2
This commit is contained in:
rocky
2020-06-12 13:18:33 -04:00
parent 3449be024b
commit e14675c2dc
5 changed files with 23 additions and 1 deletions

View File

@@ -19,6 +19,7 @@ for path in py_source:
else:
cfile = "bytecode_%s%s/%s" % (version, suffix, short) + "c"
print("byte-compiling %s to %s" % (path, cfile))
py_compile.compile(path, cfile)
optimize = 2
py_compile.compile(path, cfile, optimize=optimize)
if isinstance(version, str) or version >= (2, 6, 0):
os.system("../bin/uncompyle6 -a -T %s" % cfile)

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,12 @@
# From python3.8/distutils/version.py with optimization -O2
# The bug was that the other "else" constant propagated removed.
# NOTE: this program needs to be compile with optimization
def _cmp (b, c):
if b:
if c:
return 0
else:
return 1
else:
assert False, "never get here"