Skip to content

Commit aef6313

Browse files
committed
Fix compatibility with Python 2.5.
Emulate next(b, None) through for loop with single round. There wasn't print_function, while it really doesn't needed.
1 parent a2c3bc2 commit aef6313

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

jsonpointer.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,5 +217,6 @@ def _try_parse(val, cls=int):
217217
def pairwise(iterable):
218218
"s -> (s0,s1), (s1,s2), (s2, s3), ..."
219219
a, b = tee(iterable)
220-
next(b, None)
220+
for _ in b:
221+
break
221222
return izip(a, b)

tests.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
33

4-
from __future__ import print_function
54
import doctest
65
import unittest
76
import sys
@@ -73,7 +72,8 @@ def test_example(self):
7372
coverage.erase()
7473

7574
if coverage is None:
76-
print("""
77-
No coverage reporting done (Python module "coverage" is missing)
78-
Please install the python-coverage package to get coverage reporting.
79-
""", file=sys.stderr)
75+
sys.stderr.write("""
76+
No coverage reporting done (Python module "coverage" is missing)
77+
Please install the python-coverage package to get coverage reporting.
78+
""")
79+
sys.stderr.flush()

0 commit comments

Comments
 (0)