(gh#PythonCharmers/python-future#578). OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-future?expand=0&rev=31
89 lines
3.7 KiB
Diff
89 lines
3.7 KiB
Diff
From c341d5497788923cc6ea0bd1358279f2147aa167 Mon Sep 17 00:00:00 2001
|
|
From: Alexander Shadchin <shadchin@yandex-team.ru>
|
|
Date: Sun, 15 Nov 2020 13:01:39 +0300
|
|
Subject: [PATCH 1/6] Add support Python 3.9
|
|
|
|
---
|
|
src/future/moves/_dummy_thread.py | 5 ++++-
|
|
src/future/standard_library/__init__.py | 2 +-
|
|
tests/test_future/test_builtins.py | 2 ++
|
|
tests/test_future/test_standard_library.py | 3 ++-
|
|
tests/test_future/test_urllib2.py | 3 +++
|
|
tests/test_future/test_urllib_toplevel.py | 5 +++--
|
|
6 files changed, 15 insertions(+), 5 deletions(-)
|
|
|
|
--- a/src/future/moves/_dummy_thread.py
|
|
+++ b/src/future/moves/_dummy_thread.py
|
|
@@ -2,7 +2,10 @@ from __future__ import absolute_import
|
|
from future.utils import PY3
|
|
|
|
if PY3:
|
|
- from _dummy_thread import *
|
|
+ try:
|
|
+ from _dummy_thread import *
|
|
+ except ImportError:
|
|
+ from _thread import *
|
|
else:
|
|
__future_module__ = True
|
|
from dummy_thread import *
|
|
--- a/src/future/standard_library/__init__.py
|
|
+++ b/src/future/standard_library/__init__.py
|
|
@@ -125,7 +125,7 @@ RENAMES = {
|
|
# 'Tkinter': 'tkinter',
|
|
'_winreg': 'winreg',
|
|
'thread': '_thread',
|
|
- 'dummy_thread': '_dummy_thread',
|
|
+ 'dummy_thread': '_dummy_thread' if sys.version_info < (3, 9) else '_thread',
|
|
# 'anydbm': 'dbm', # causes infinite import loop
|
|
# 'whichdb': 'dbm', # causes infinite import loop
|
|
# anydbm and whichdb are handled by fix_imports2
|
|
--- a/tests/test_future/test_standard_library.py
|
|
+++ b/tests/test_future/test_standard_library.py
|
|
@@ -422,7 +422,8 @@ class TestStandardLibraryReorganization(
|
|
|
|
def test_underscore_prefixed_modules(self):
|
|
import _thread
|
|
- import _dummy_thread
|
|
+ if sys.version_info < (3, 9):
|
|
+ import _dummy_thread
|
|
import _markupbase
|
|
self.assertTrue(True)
|
|
|
|
--- a/tests/test_future/test_urllib_toplevel.py
|
|
+++ b/tests/test_future/test_urllib_toplevel.py
|
|
@@ -781,8 +781,9 @@ 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''))
|
|
+ if sys.version_info < (3, 9):
|
|
+ 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
|
|
--- a/tests/test_future/test_builtins.py
|
|
+++ b/tests/test_future/test_builtins.py
|
|
@@ -1305,6 +1305,8 @@ class BuiltinTest(unittest.TestCase):
|
|
self.assertAlmostEqual(pow(-1, 1/3), 0.5 + 0.8660254037844386j)
|
|
|
|
# Raises TypeError in Python < v3.5, ValueError in v3.5:
|
|
+ if sys.version_info < (3, 8):
|
|
+ self.assertRaises((TypeError, ValueError), pow, -1, -2, 3)
|
|
self.assertRaises(ValueError, pow, 1, 2, 0)
|
|
|
|
self.assertRaises(TypeError, pow)
|
|
--- a/tests/test_future/test_urllib2.py
|
|
+++ b/tests/test_future/test_urllib2.py
|
|
@@ -710,6 +710,9 @@ class HandlerTests(unittest.TestCase):
|
|
("ftp://localhost/baz.gif;type=a",
|
|
"localhost", ftplib.FTP_PORT, "", "", "A",
|
|
[], "baz.gif", None),
|
|
+ ("ftp://localhost/baz.gif",
|
|
+ "localhost", ftplib.FTP_PORT, "", "", "I",
|
|
+ [], "baz.gif", "image/gif"),
|
|
]:
|
|
req = Request(url)
|
|
req.timeout = None
|