Blob Blame History Raw
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Fedora Python maintainers <python-devel@lists.fedoraproject.org>
Date: Wed, 22 Jul 2020 16:15:29 +0200
Subject: [PATCH] 00186-dont-raise-from-py_compile.patch

Fix for https://bugzilla.redhat.com/show_bug.cgi?id=1023607
Previously, this fixed a problem where some *.py files were not being
bytecompiled properly during build. This was result of py_compile.compile
raising exception when trying to convert test file with bad encoding, and
thus not continuing bytecompilation for other files.
This was fixed upstream, but the test hasn't been merged yet, so we keep it
---
 Lib/test/test_py_compile.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Lib/test/test_py_compile.py b/Lib/test/test_py_compile.py
index c1fd4f60da0..3dcccf72a99 100644
--- a/Lib/test/test_py_compile.py
+++ b/Lib/test/test_py_compile.py
@@ -69,6 +69,10 @@ class PyCompileTests(unittest.TestCase):
         self.assertTrue(os.path.exists(self.pyc_path))
         self.assertFalse(os.path.exists(self.cache_path))
 
+    def test_bad_coding(self):
+        bad_coding = os.path.join(os.path.dirname(__file__), 'bad_coding2.py')
+        self.assertIsNone(py_compile.compile(bad_coding, doraise=False))
+
     def test_relative_path(self):
         py_compile.compile(os.path.relpath(self.source_path),
                            os.path.relpath(self.pyc_path))