Skip to content

Commit 154c3f5

Browse files
authored
Merge branch 'master' into patch-3
2 parents 89c8030 + 907ab88 commit 154c3f5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+628
-292
lines changed

TESTING.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,10 @@ The test suite can be run with:
44

55
$ tox
66

7-
which tests the module under a number of different python versions, where available.
7+
which tests the module under a number of different python versions, where available, or with:
8+
9+
$ py.test
10+
11+
To execute a single test:
12+
13+
$ pytest -k test_chained_exceptions_stacktrace

docs/compatible_idioms.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1270,7 +1270,7 @@ urllib module
12701270
~~~~~~~~~~~~~
12711271

12721272
``urllib`` is the hardest module to use from Python 2/3 compatible code.
1273-
You may like to use Requests (http://python-requests.org) instead.
1273+
You might want to switch to Requests (http://python-requests.org) instead.
12741274

12751275
.. code:: python
12761276

docs/credits.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ Python-Future is largely written by Ed Schofield <[email protected]> with th
5050
- Grant Bakker
5151
- Jacob Beck
5252
- Nate Bogdanowicz
53+
- Christian Clauss
5354
- Denis Cornehl
5455
- Nicolas Delaby
5556
- Jon Dufresne
@@ -79,7 +80,6 @@ Python-Future is largely written by Ed Schofield <[email protected]> with th
7980
- Jeff Tratner
8081
- Tim Tröndle
8182
- Brad Walker
82-
- cclaus (GiHub user)
8383
- lsm (GiHub user)
8484
- Mystic-Mirage (GitHub user)
8585
- str4d (GitHub user)

docs/futurize.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ The complete list of fixers applied in Stage 2 is::
237237
lib2to3.fixes.fix_operator
238238
lib2to3.fixes.fix_raw_input
239239
lib2to3.fixes.fix_zip
240-
240+
241241
libfuturize.fixes.fix_basestring
242242
libfuturize.fixes.fix_cmp
243243
libfuturize.fixes.fix_division_safe
@@ -269,6 +269,7 @@ Not applied::
269269
lib2to3.fixes.fix_xrange # Custom one because of a bug with Py3.3's lib2to3
270270

271271

272+
272273
.. Ideally the output of this stage should not be a ``SyntaxError`` on either
273274
.. Python 3 or Python 2.
274275

docs/futurize_overview.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,5 @@ use the ``-w`` flag.
5151

5252
For complex projects, it is probably best to divide the porting into two stages.
5353
Stage 1 is for "safe" changes that modernize the code but do not break Python
54-
2.7 compatibility or introduce a depdendency on the ``future`` package. Stage 2
54+
2.7 compatibility or introduce a dependency on the ``future`` package. Stage 2
5555
is to complete the process.

docs/notebooks/Writing Python 2-3 compatible code.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1747,7 +1747,7 @@
17471747
"source": [
17481748
"# Python 2 and 3: option 3\n",
17491749
"try:\n",
1750-
" import itertools.imap as map\n",
1750+
" from itertools import imap as map\n",
17511751
"except ImportError:\n",
17521752
" pass\n",
17531753
"\n",
@@ -1845,7 +1845,7 @@
18451845
"source": [
18461846
"# Python 2 and 3: option 2\n",
18471847
"try:\n",
1848-
" import itertools.imap as map\n",
1848+
" from itertools import imap as map\n",
18491849
"except ImportError:\n",
18501850
" pass\n",
18511851
"\n",

setup.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
"past.builtins",
4747
"past.types",
4848
"past.utils",
49-
# "past.tests",
5049
"past.translation",
5150
"libfuturize",
5251
"libfuturize.fixes",

src/future/backports/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from future.standard_library import import_top_level_modules
1111

1212

13-
if sys.version_info[0] == 3:
13+
if sys.version_info[0] >= 3:
1414
import_top_level_modules()
1515

1616

src/future/backports/email/message.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -800,7 +800,7 @@ def set_boundary(self, boundary):
800800
# There was no Content-Type header, and we don't know what type
801801
# to set it to, so raise an exception.
802802
raise errors.HeaderParseError('No Content-Type header found')
803-
newparams = []
803+
newparams = list()
804804
foundp = False
805805
for pk, pv in params:
806806
if pk.lower() == 'boundary':
@@ -814,10 +814,10 @@ def set_boundary(self, boundary):
814814
# instead???
815815
newparams.append(('boundary', '"%s"' % boundary))
816816
# Replace the existing Content-Type header with the new value
817-
newheaders = []
817+
newheaders = list()
818818
for h, v in self._headers:
819819
if h.lower() == 'content-type':
820-
parts = []
820+
parts = list()
821821
for k, v in newparams:
822822
if v == '':
823823
parts.append(k)

src/future/backports/http/client.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -696,9 +696,19 @@ def _safe_readinto(self, b):
696696
while total_bytes < len(b):
697697
if MAXAMOUNT < len(mvb):
698698
temp_mvb = mvb[0:MAXAMOUNT]
699-
n = self.fp.readinto(temp_mvb)
699+
if PY2:
700+
data = self.fp.read(len(temp_mvb))
701+
n = len(data)
702+
temp_mvb[:n] = data
703+
else:
704+
n = self.fp.readinto(temp_mvb)
700705
else:
701-
n = self.fp.readinto(mvb)
706+
if PY2:
707+
data = self.fp.read(len(mvb))
708+
n = len(data)
709+
mvb[:n] = data
710+
else:
711+
n = self.fp.readinto(mvb)
702712
if not n:
703713
raise IncompleteRead(bytes(mvb[0:total_bytes]), len(b))
704714
mvb = mvb[n:]

0 commit comments

Comments
 (0)