Skip to content

Commit 7f494f8

Browse files
committed
Merge branch 'fix_39' of https://github.com/shadchin/python-future into shadchin-fix_39
2 parents 85643c1 + 21ae5c7 commit 7f494f8

File tree

6 files changed

+16
-8
lines changed

6 files changed

+16
-8
lines changed

Diff for: src/future/backports/xmlrpc/client.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,11 @@
134134
from future.builtins import bytes, dict, int, range, str
135135

136136
import base64
137-
# Py2.7 compatibility hack
138-
base64.encodebytes = base64.encodestring
139-
base64.decodebytes = base64.decodestring
140137
import sys
138+
if sys.version_info < (3, 9):
139+
# Py2.7 compatibility hack
140+
base64.encodebytes = base64.encodestring
141+
base64.decodebytes = base64.decodestring
141142
import time
142143
from datetime import datetime
143144
from future.backports.http import client as http_client

Diff for: src/future/moves/_dummy_thread.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
from future.utils import PY3
33

44
if PY3:
5-
from _dummy_thread import *
5+
try:
6+
from _dummy_thread import *
7+
except ImportError:
8+
from _thread import *
69
else:
710
__future_module__ = True
811
from dummy_thread import *

Diff for: src/future/standard_library/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@
126126
# 'Tkinter': 'tkinter',
127127
'_winreg': 'winreg',
128128
'thread': '_thread',
129-
'dummy_thread': '_dummy_thread',
129+
'dummy_thread': '_dummy_thread' if sys.version_info < (3, 9) else '_thread',
130130
# 'anydbm': 'dbm', # causes infinite import loop
131131
# 'whichdb': 'dbm', # causes infinite import loop
132132
# anydbm and whichdb are handled by fix_imports2

Diff for: tests/test_future/test_standard_library.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,8 @@ def test_urllib_imports_install_hooks(self):
421421

422422
def test_underscore_prefixed_modules(self):
423423
import _thread
424-
import _dummy_thread
424+
if sys.version_info < (3, 9):
425+
import _dummy_thread
425426
import _markupbase
426427
self.assertTrue(True)
427428

Diff for: tests/test_future/test_urllib2.py

+3
Original file line numberDiff line numberDiff line change
@@ -710,6 +710,9 @@ def connect_ftp(self, user, passwd, host, port, dirs,
710710
("ftp://localhost/baz.gif;type=a",
711711
"localhost", ftplib.FTP_PORT, "", "", "A",
712712
[], "baz.gif", None),
713+
("ftp://localhost/baz.gif",
714+
"localhost", ftplib.FTP_PORT, "", "", "I",
715+
[], "baz.gif", "image/gif"),
713716
]:
714717
req = Request(url)
715718
req.timeout = None

Diff for: tests/test_future/test_urllib_toplevel.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def setUp(self):
120120
finally:
121121
f.close()
122122
self.pathname = support.TESTFN
123-
self.returned_obj = urlopen("file:%s" % self.pathname)
123+
self.returned_obj = urlopen("file:%s" % urllib_parse.quote(self.pathname))
124124

125125
def tearDown(self):
126126
"""Shut down the open object"""
@@ -167,7 +167,7 @@ def test_info(self):
167167
self.assertIsInstance(self.returned_obj.info(), email_message.Message)
168168

169169
def test_geturl(self):
170-
self.assertEqual(self.returned_obj.geturl(), self.pathname)
170+
self.assertEqual(self.returned_obj.geturl(), urllib_parse.quote(self.pathname))
171171

172172
def test_getcode(self):
173173
self.assertIsNone(self.returned_obj.getcode())

0 commit comments

Comments
 (0)