Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ def README():
return f.read()


# Backward-compatibility dependencies for Python 2
_python2_requires = [
'future', # For backport of surrogateescape
] if sys.version_info < (3,) else []


setup(
name='backports.os',
description="Backport of new features in Python's os module",
Expand All @@ -29,7 +23,9 @@ def README():
setup_requires=['setuptools_scm'],
use_scm_version=True,

install_requires=_python2_requires,
install_requires=[
'future;python_version<"3.0"', # For backport of surrogateescape
],

license='Python Software Foundation License',
classifiers=[
Expand Down
6 changes: 3 additions & 3 deletions src/backports/os.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ def _invalid_utf8_indexes(bytes):
# U+0080 - U+07FF - 11 bits
c = (((c1 & 0x1F) << 6) |
(c2 & 0x3F))
if c < 0x80:
if c < 0x80: # pragma: no cover
# Overlong encoding
skips.extend([i, i + 1])
skips.extend([i, i + 1]) # pragma: no cover
i += 2
continue
c3 = bytes[i + 2]
Expand All @@ -70,7 +70,7 @@ def _invalid_utf8_indexes(bytes):
(c2 & 0x3F)) << 6) |
(c3 & 0x3F)) << 6) |
(c4 & 0x3F))
if (c < 0x10000) or (c > 0x10FFFF):
if (c < 0x10000) or (c > 0x10FFFF): # pragma: no cover
# Overlong encoding or invalid code point.
skips.extend([i, i + 1, i + 2, i + 3])
i += 4
Expand Down