summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPablo Galindo <pablogsal@gmail.com>2022-09-06 09:18:57 (GMT)
committerPablo Galindo <pablogsal@gmail.com>2022-09-06 09:18:57 (GMT)
commit6ac0f8f0d795bba678be56bd4b0bb9ae3fbedb15 (patch)
treeebeedcbde9b398f5e4999d86744db75b8eeaf775
parent0abc6a3493d12acd6894066c27744c0a9d46fcad (diff)
parent75c3a4ccaff2ed581be67c5f48c3ca8a9fed23b7 (diff)
downloadcpython-6ac0f8f0d795bba678be56bd4b0bb9ae3fbedb15.zip
cpython-6ac0f8f0d795bba678be56bd4b0bb9ae3fbedb15.tar.gz
cpython-6ac0f8f0d795bba678be56bd4b0bb9ae3fbedb15.tar.bz2
Merge remote-tracking branch 'upstream/3.10' into 3.10
-rw-r--r--Lib/ast.py2
-rw-r--r--Lib/test/test_unparse.py6
-rwxr-xr-xMac/BuildScript/build-installer.py1
-rw-r--r--Mac/BuildScript/openssl1.1.1q-pr-18719.patch17
-rw-r--r--Misc/NEWS.d/next/Library/2022-05-19-22-34-42.gh-issue-92986.e6uKxj.rst1
5 files changed, 26 insertions, 1 deletions
diff --git a/Lib/ast.py b/Lib/ast.py
index f4d2f6e..d63cb2f 100644
--- a/Lib/ast.py
+++ b/Lib/ast.py
@@ -849,7 +849,7 @@ class _Unparser(NodeVisitor):
def visit_ImportFrom(self, node):
self.fill("from ")
- self.write("." * node.level)
+ self.write("." * (node.level or 0))
if node.module:
self.write(node.module)
self.write(" import ")
diff --git a/Lib/test/test_unparse.py b/Lib/test/test_unparse.py
index 33e1149..6e38c5e 100644
--- a/Lib/test/test_unparse.py
+++ b/Lib/test/test_unparse.py
@@ -341,6 +341,12 @@ class UnparseTestCase(ASTTestCase):
def test_invalid_yield_from(self):
self.check_invalid(ast.YieldFrom(value=None))
+ def test_import_from_level_none(self):
+ tree = ast.ImportFrom(module='mod', names=[ast.alias(name='x')])
+ self.assertEqual(ast.unparse(tree), "from mod import x")
+ tree = ast.ImportFrom(module='mod', names=[ast.alias(name='x')], level=None)
+ self.assertEqual(ast.unparse(tree), "from mod import x")
+
def test_docstrings(self):
docstrings = (
'this ends with double quote"',
diff --git a/Mac/BuildScript/build-installer.py b/Mac/BuildScript/build-installer.py
index 668667c..67a6e4b 100755
--- a/Mac/BuildScript/build-installer.py
+++ b/Mac/BuildScript/build-installer.py
@@ -249,6 +249,7 @@ def library_recipes():
name="OpenSSL 1.1.1q",
url="https://www.openssl.org/source/openssl-1.1.1q.tar.gz",
checksum='d7939ce614029cdff0b6c20f0e2e5703158a489a72b2507b8bd51bf8c8fd10ca',
+ patches=['openssl1.1.1q-pr-18719.patch'],
buildrecipe=build_universal_openssl,
configure=None,
install=None,
diff --git a/Mac/BuildScript/openssl1.1.1q-pr-18719.patch b/Mac/BuildScript/openssl1.1.1q-pr-18719.patch
new file mode 100644
index 0000000..6b4b188
--- /dev/null
+++ b/Mac/BuildScript/openssl1.1.1q-pr-18719.patch
@@ -0,0 +1,17 @@
+https://github.com/openssl/openssl/commit/60f011f584d80447e86cae1d1bd3ae24bc13235b
+This fixes a regression in 1.1.1q:
+
+test/v3ext.c:201:24: error: implicitly declaring library function 'memcmp' with type 'int (const void *, const void *, unsigned long)' [-Werror,-Wimplicit-function-declaration]
+ if (!TEST_true(memcmp(ip1->data, ip2->data, ip1->length) <= 0))
+
+diff -Naur openssl-1.1.1q/test/v3ext.c openssl-1.1.1q-patched/test/v3ext.c
+--- openssl-1.1.1q/test/v3ext.c 2022-07-05 09:08:33.000000000 +0000
++++ openssl-1.1.1q-patched/test/v3ext.c 2022-09-05 16:54:45.740859256 +0000
+@@ -8,6 +8,7 @@
+ */
+
+ #include <stdio.h>
++#include <string.h>
+ #include <openssl/x509.h>
+ #include <openssl/x509v3.h>
+ #include <openssl/pem.h>
diff --git a/Misc/NEWS.d/next/Library/2022-05-19-22-34-42.gh-issue-92986.e6uKxj.rst b/Misc/NEWS.d/next/Library/2022-05-19-22-34-42.gh-issue-92986.e6uKxj.rst
new file mode 100644
index 0000000..691c0dd
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2022-05-19-22-34-42.gh-issue-92986.e6uKxj.rst
@@ -0,0 +1 @@
+Fix :func:`ast.unparse` when ``ImportFrom.level`` is None