Skip to content

Commit f840398

Browse files
tirangvanrossum
andauthored
bpo-45873: Restore Python 3.6 compatibility (GH-29730)
Co-authored-by: Guido van Rossum <[email protected]>
1 parent 4ae26b9 commit f840398

File tree

3 files changed

+28
-3
lines changed

3 files changed

+28
-3
lines changed

Tools/scripts/deepfreeze.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,24 @@
55
import contextlib
66
import os
77
import re
8+
import sys
89
import time
910
import types
11+
import unicodedata
1012
from typing import Dict, FrozenSet, Tuple, TextIO
1113

1214
import umarshal
1315

1416
verbose = False
1517

1618

19+
def isprintable(b: bytes) -> bool:
20+
return all(0x20 <= c < 0x7f for c in b)
21+
22+
1723
def make_string_literal(b: bytes) -> str:
1824
res = ['"']
19-
if b.isascii() and b.decode("ascii").isprintable():
25+
if isprintable(b):
2026
res.append(b.decode("ascii").replace("\\", "\\\\").replace("\"", "\\\""))
2127
else:
2228
for i in b:

configure

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3142,7 +3142,7 @@ case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
31423142
# pybuilddir.txt will be created by --generate-posix-vars in the Makefile
31433143
rm -f pybuilddir.txt
31443144

3145-
for ac_prog in python$PACKAGE_VERSION python3 python
3145+
for ac_prog in python$PACKAGE_VERSION python3.10 python3.9 python3.8 python3.7 python3.6 python3 python
31463146
do
31473147
# Extract the first word of "$ac_prog", so it can be a program name with args.
31483148
set dummy $ac_prog; ac_word=$2
@@ -3187,6 +3187,16 @@ test -n "$PYTHON_FOR_REGEN" || PYTHON_FOR_REGEN="python3"
31873187

31883188

31893189

3190+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking Python for regen version" >&5
3191+
$as_echo_n "checking Python for regen version... " >&6; }
3192+
if command -v $PYTHON_FOR_REGEN >/dev/null 2>&1; then
3193+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $($PYTHON_FOR_REGEN -V 2>/dev/null)" >&5
3194+
$as_echo "$($PYTHON_FOR_REGEN -V 2>/dev/null)" >&6; }
3195+
else
3196+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: missing" >&5
3197+
$as_echo "missing" >&6; }
3198+
fi
3199+
31903200
if test "$cross_compiling" = yes; then
31913201
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for python interpreter for cross build" >&5
31923202
$as_echo_n "checking for python interpreter for cross build... " >&6; }

configure.ac

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,18 @@ AC_SUBST(host)
9696
# pybuilddir.txt will be created by --generate-posix-vars in the Makefile
9797
rm -f pybuilddir.txt
9898

99-
AC_CHECK_PROGS(PYTHON_FOR_REGEN, python$PACKAGE_VERSION python3 python, python3)
99+
AC_CHECK_PROGS([PYTHON_FOR_REGEN],
100+
[python$PACKAGE_VERSION python3.10 python3.9 python3.8 python3.7 python3.6 python3 python],
101+
[python3])
100102
AC_SUBST(PYTHON_FOR_REGEN)
101103

104+
AC_MSG_CHECKING([Python for regen version])
105+
if command -v $PYTHON_FOR_REGEN >/dev/null 2>&1; then
106+
AC_MSG_RESULT([$($PYTHON_FOR_REGEN -V 2>/dev/null)])
107+
else
108+
AC_MSG_RESULT([missing])
109+
fi
110+
102111
if test "$cross_compiling" = yes; then
103112
AC_MSG_CHECKING([for python interpreter for cross build])
104113
if test -z "$PYTHON_FOR_BUILD"; then

0 commit comments

Comments
 (0)