Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.

Bug 1789631

Summary: future fails to build with Python 3.9 (_dummy_thread removal)
Product: [Fedora] Fedora Reporter: Charalampos Stratakis <cstratak>
Component: futureAssignee: Antonio T. (sagitter) <anto.trande>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: rawhideCC: anto.trande, cstratak, mhroncok
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-02-11 16:16:29 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1785415    

Description Charalampos Stratakis 2020-01-09 23:19:55 UTC
future fails to build with Python 3.9.0a2.

Test failures:

______ TestStandardLibraryReorganization.test_underscore_prefixed_modules ______

self = <test_future.test_standard_library.TestStandardLibraryReorganization testMethod=test_underscore_prefixed_modules>

    def test_underscore_prefixed_modules(self):
        import _thread
>       import _dummy_thread
E       ModuleNotFoundError: No module named '_dummy_thread'

tests/test_future/test_standard_library.py:427: ModuleNotFoundError
______________________ TestFutureMoves.test_future_moves _______________________

self = <test_future.test_standard_library.TestFutureMoves testMethod=test_future_moves>

    def test_future_moves(self):
        """
        Ensure everything is available from the future.moves interface that we
        claim and expect. (Issue #104).
        """
        from future.moves.collections import Counter, OrderedDict   # backported to Py2.6
        from future.moves.collections import UserDict, UserList, UserString
    
        from future.moves import configparser
        from future.moves import copyreg
    
        from future.moves.itertools import filterfalse, zip_longest
    
        from future.moves import html
        import future.moves.html.entities
        import future.moves.html.parser
    
        from future.moves import http
        import future.moves.http.client
        import future.moves.http.cookies
        import future.moves.http.cookiejar
        import future.moves.http.server
    
        from future.moves import queue
    
        from future.moves import socketserver
    
        from future.moves.subprocess import check_output              # even on Py2.6
        from future.moves.subprocess import getoutput, getstatusoutput
    
        from future.moves.sys import intern
    
        from future.moves import urllib
        import future.moves.urllib.error
        import future.moves.urllib.parse
        import future.moves.urllib.request
        import future.moves.urllib.response
        import future.moves.urllib.robotparser
    
        try:
            # Is _winreg available on Py2? If so, ensure future.moves._winreg is available too:
            import _winreg
        except ImportError:
            pass
        else:
            from future.moves import winreg
    
        from future.moves import xmlrpc
        import future.moves.xmlrpc.client
        import future.moves.xmlrpc.server
    
>       from future.moves import _dummy_thread

tests/test_future/test_standard_library.py:575: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

    from __future__ import absolute_import
    from future.utils import PY3
    
    if PY3:
>       from _dummy_thread import *
E       ModuleNotFoundError: No module named '_dummy_thread'

build/lib/future/moves/_dummy_thread.py:5: ModuleNotFoundError
________________________ UnquotingTests.test_unquoting _________________________

self = <test_future.test_urllib_toplevel.UnquotingTests testMethod=test_unquoting>

    def test_unquoting(self):
        # Make sure unquoting of all ASCII values works
        escape_list = []
        for num in range(128):
            given = hexescape(chr(num))
            expect = chr(num)
            result = urllib_parse.unquote(given)
            self.assertEqual(expect, result,
                             "using unquote(): %r != %r" % (expect, result))
            result = urllib_parse.unquote_plus(given)
            self.assertEqual(expect, result,
                             "using unquote_plus(): %r != %r" %
                             (expect, result))
            escape_list.append(given)
        escape_string = ''.join(escape_list)
        del escape_list
        result = urllib_parse.unquote(escape_string)
        self.assertEqual(result.count('%'), 1,
                         "using unquote(): not all characters escaped: "
                         "%s" % result)
        self.assertRaises((TypeError, AttributeError), urllib_parse.unquote, None)
        self.assertRaises((TypeError, AttributeError), urllib_parse.unquote, ())
        with support.check_warnings(('', BytesWarning), quiet=True):
>           self.assertRaises((TypeError, AttributeError), urllib_parse.unquote, bytes(b''))
E           AssertionError: (<class 'TypeError'>, <class 'AttributeError'>) not raised by unquote

tests/test_future/test_urllib_toplevel.py:785: AssertionError


For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.9/fedora-rawhide-x86_64/01142496-future/

For all our attempts to build future with Python 3.9, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.9/package/future/

Testing and mass rebuild of packages is happening in copr. You can follow these instructions to test locally in mock if your package builds with Python 3.9:
https://copr.fedorainfracloud.org/coprs/g/python/python3.9/

Let us know here if you have any questions.

Python 3.9 will be included in Fedora 33, but the initial bootstrapping has already started.
A build failure this early in the bootstrap sequence blocks us very much.

Comment 1 Charalampos Stratakis 2020-01-09 23:22:06 UTC
On Python 3.9 _dummy_thread was removed and _thread is supposed to be used in its place. Also the last test failure is from a test which was copied from Python sources but removed on 3.9 with this change: https://github.com/python/cpython/commit/aad2ee01561f260c69af1951c0d6fcaf75c4d41b

I've hacked a bit the code to make it build, but that would be better to be moved upstream as well:

diff --git a/future-0.18.0/src/future/moves/_dummy_thread.py b/future-0.18.0/src/future/moves/_dummy_thread.py
index 688d249..cc2fc89 100644
--- a/future-0.18.0/src/future/moves/_dummy_thread.py
+++ b/future-0.18.0/src/future/moves/_dummy_thread.py
@@ -2,7 +2,7 @@ from __future__ import absolute_import
 from future.utils import PY3
 
 if PY3:
-    from _dummy_thread import *
+    from _thread import *
 else:
     __future_module__ = True
     from dummy_thread import *
diff --git a/future-0.18.0/src/future/standard_library/__init__.py b/future-0.18.0/src/future/standard_library/__init__.py
index cff02f9..3e8da8a 100644
--- a/future-0.18.0/src/future/standard_library/__init__.py
+++ b/future-0.18.0/src/future/standard_library/__init__.py
@@ -125,7 +125,7 @@ RENAMES = {
            # 'Tkinter': 'tkinter',
            '_winreg': 'winreg',
            'thread': '_thread',
-           'dummy_thread': '_dummy_thread',
+           'dummy_thread': '_thread',
            # 'anydbm': 'dbm',   # causes infinite import loop
            # 'whichdb': 'dbm',  # causes infinite import loop
            # anydbm and whichdb are handled by fix_imports2
diff --git a/future-0.18.0/tests/test_future/test_standard_library.py b/future-0.18.0/tests/test_future/test_standard_library.py
index e55876d..5b3a8f3 100644
--- a/future-0.18.0/tests/test_future/test_standard_library.py
+++ b/future-0.18.0/tests/test_future/test_standard_library.py
@@ -424,7 +424,6 @@ class TestStandardLibraryReorganization(CodeHandler):
 
     def test_underscore_prefixed_modules(self):
         import _thread
-        import _dummy_thread
         import _markupbase
         self.assertTrue(True)
 
diff --git a/future-0.18.0/tests/test_future/test_urllib_toplevel.py b/future-0.18.0/tests/test_future/test_urllib_toplevel.py
index 11e7720..25f4ca8 100644
--- a/future-0.18.0/tests/test_future/test_urllib_toplevel.py
+++ b/future-0.18.0/tests/test_future/test_urllib_toplevel.py
@@ -781,8 +781,6 @@ class UnquotingTests(unittest.TestCase):
                          "%s" % result)
         self.assertRaises((TypeError, AttributeError), urllib_parse.unquote, None)
         self.assertRaises((TypeError, AttributeError), urllib_parse.unquote, ())
-        with support.check_warnings(('', BytesWarning), quiet=True):
-            self.assertRaises((TypeError, AttributeError), urllib_parse.unquote, bytes(b''))
 
     def test_unquoting_badpercent(self):
         # Test unquoting on bad percent-escapes

Comment 2 Antonio T. (sagitter) 2020-01-10 21:18:50 UTC
Upstream does not even support Python-3.8

Comment 3 Miro Hrončok 2020-02-10 18:39:33 UTC
Antonio, have you talked to upstream? Should we do that instead? I see you have ASSIGNED this bugzilla, so I don't want to do something you are already doing.

Comment 4 Antonio T. (sagitter) 2020-02-10 18:52:51 UTC
I think upstream is not interested to Python 3.9 yet.

Comment 5 Miro Hrončok 2020-02-10 18:56:43 UTC
Would you carry a downstream only fix then? Or why have you assigned the bugzilla?

Comment 6 Miro Hrončok 2020-02-10 18:59:53 UTC
The following packages require python3-future. Making it build with Python 3.9 is quite essential for all of those listed. If you need further help with the fix, let us know.

$ repoquery --repo=rawhide{,-source} --whatrequires python3-future
appliance-tools-0:009.0-10.fc32.noarch
buildbot-0:2.5.1-2.fc32.src
buildbot-worker-0:2.5.1-2.fc32.noarch
cobbler-0:3.1.1-2.fc32.noarch
cobbler-0:3.1.1-2.fc32.src
duplicity-0:0.8.10-2.fc32.x86_64
kiwi-0:9.19.15-1.fc32.src
libolm-0:3.1.4-2.fc32.src
libolm-python3-0:3.1.4-2.fc32.x86_64
linkchecker-0:9.4.0-9.20191005.d13b3f5.fc32.noarch
linkchecker-0:9.4.0-9.20191005.d13b3f5.fc32.src
openqa-0:4.6-41.20200101git68ae00a.fc32.src
openqa-devel-0:4.6-41.20200101git68ae00a.fc32.noarch
openqa-python-scripts-0:4.6-41.20200101git68ae00a.fc32.noarch
preprocess-0:1.2.3-0.15.20170318git6e868bc.fc32.src
proselint-0:0.10.2-6.fc32.noarch
proselint-0:0.10.2-6.fc32.src
python-CommonMark-0:0.9.0-5.fc32.src
python-cloudflare-0:2.6.0-1.fc32.src
python-cookiecutter-0:1.6.0-12.fc32.src
python-dns-lexicon-0:3.3.4-3.fc32.src
python-flask-autoindex-0:0.6-10.fc32.src
python-ipmi-0:0.4.2-2.fc32.src
python-lz4-0:3.0.2-2.fc32.src
python-mdp-0:3.5-16.fc32.src
python-netssh2-0:0.1.7-7.fc32.src
python-okaara-0:1.0.37-13.fc32.src
python-onionbalance-0:0.1.8-10.fc32.src
python-pymatreader-0:0.0.21-1.fc32.src
python-sievelib-0:1.1.1-9.fc32.src
python-stestr-0:2.6.0-5.fc32~bootstrap.src
python-twitter-0:3.5-6.fc32.src
python3-CommonMark-0:0.9.0-5.fc32.noarch
python3-brian2-0:2.3-1.fc32.x86_64
python3-cloudflare-0:2.6.0-1.fc32.noarch
python3-cookiecutter-0:1.6.0-12.fc32.noarch
python3-dns-lexicon-0:3.3.4-3.fc32.noarch
python3-fdb-0:2.0.0-6.fc32.noarch
python3-flask-autoindex-0:0.6-10.fc32.noarch
python3-ipmi-0:0.4.2-2.fc32.noarch
python3-mailmerge-0:1.9-6.fc32.noarch
python3-mdp-0:3.5-16.fc32.noarch
python3-molecule-0:2.22-2.fc32.noarch
python3-okaara-0:1.0.37-13.fc32.noarch
python3-onionbalance-0:0.1.8-10.fc32.noarch
python3-otf2-0:2.2-8.fc32.x86_64
python3-pefile-0:2019.4.18-2.fc32.noarch
python3-pyglet-0:1.4.6-2.fc32.noarch
python3-pykeepass-0:3.2.0-2.fc32.noarch
python3-pymatreader-0:0.0.21-1.fc32.noarch
python3-pyqtrailer-0:0.6.2-23.fc32.noarch
python3-pysaml2-0:4.5.0-10.fc32.noarch
python3-rdopkg-0:1.1.1-2.fc32.noarch
python3-sievelib-0:1.1.1-9.fc32.noarch
python3-stestr-0:2.6.0-5.fc32~bootstrap.noarch
python3-stomper-0:0.4.3-6.fc32.noarch
python3-tracer-0:0.7.1-8.fc32.noarch
python3-twitter-0:3.5-6.fc32.noarch
python3-vertica-0:0.10.1-2.fc32.noarch
python3-zanata-client-0:1.5.3-5.fc32.noarch
quasselgrep-0:0.1-0.9.20170411git502c88b.fc32.src
roca-detect-0:1.2.12-11.fc32.noarch
roca-detect-0:1.2.12-11.fc32.src
sagemath-0:8.8-7.fc32.src
sagemath-core-0:8.8-7.fc32.x86_64
taskotron-trigger-0:0.7.0-6.fc32.noarch
taskotron-trigger-0:0.7.0-6.fc32.src

Comment 7 Antonio T. (sagitter) 2020-02-10 19:02:23 UTC
> If you need further help with the fix, let us know.

Yes, please. i'm leaving this ticket unassigned.