Skip to content

Commit d076679

Browse files
committed
v2.0.1
-------- 2022-06-03: use io.encoding only on 3.10 upwards
1 parent 258e2eb commit d076679

6 files changed

Lines changed: 25 additions & 9 deletions

File tree

.docs/README_template.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ pathlib3x
22
=========
33

44

5-
Version v2.0.0 as of 2022-06-03 see `Changelog`_
5+
Version v2.0.1 as of 2022-06-03 see `Changelog`_
66

77

88
.. include:: ./badges.rst

CHANGES.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ Changelog
55
- new MINOR version for added functionality in a backwards compatible manner
66
- new PATCH version for backwards compatible bug fixes
77

8+
v2.0.1
9+
--------
10+
2022-06-03: use io.encoding only on 3.10 upwards
11+
812
v2.0.0
913
--------
1014
2022-06-03:

README.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ pathlib3x
22
=========
33

44

5-
Version v2.0.0 as of 2022-06-03 see `Changelog`_
5+
Version v2.0.1 as of 2022-06-03 see `Changelog`_
66

77
|build_badge| |license| |pypi| |pypi-downloads| |black|
88

@@ -469,6 +469,10 @@ Changelog
469469
- new MINOR version for added functionality in a backwards compatible manner
470470
- new PATCH version for backwards compatible bug fixes
471471

472+
v2.0.1
473+
--------
474+
2022-06-03: use io.encoding only on 3.10 upwards
475+
472476
v2.0.0
473477
--------
474478
2022-06-03:

pathlib3x/__init__conf__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
name = "pathlib3x"
44
title = "backport of pathlib 3.10 to python 3.6, 3.7, 3.8, 3.9 with a few extensions"
5-
version = "v2.0.0"
5+
version = "v2.0.1"
66
url = "https://github.com/bitranox/pathlib3x"
77
author = "Robert Nowotny"
88
author_email = "bitranox@gmail.com"
@@ -17,7 +17,7 @@ def print_info() -> None:
1717
1818
backport of pathlib 3.10 to python 3.6, 3.7, 3.8, 3.9 with a few extensions
1919
20-
Version : v2.0.0
20+
Version : v2.0.1
2121
Url : https://github.com/bitranox/pathlib3x
2222
Author : Robert Nowotny
2323
Email : bitranox@gmail.com"""

pathlib3x/pathlib3x.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1130,8 +1130,10 @@ def open(self, mode="r", buffering=-1, encoding=None, errors=None, newline=None)
11301130
Open the file pointed by this path and return a file object, as
11311131
the built-in open() function does.
11321132
"""
1133-
if "b" not in mode:
1134-
encoding = io.text_encoding(encoding)
1133+
# bitranox - io.text_encoding exists only on 3.10 upwards
1134+
if sys.version_info <= (3, 10):
1135+
if "b" not in mode:
1136+
encoding = io.text_encoding(encoding)
11351137
return io.open(self, mode, buffering, encoding, errors, newline)
11361138

11371139
def read_bytes(self):
@@ -1145,7 +1147,9 @@ def read_text(self, encoding=None, errors=None):
11451147
"""
11461148
Open the file in text mode, read it, and close the file.
11471149
"""
1148-
encoding = io.text_encoding(encoding)
1150+
# bitranox - io.text_encoding exists only on 3.10 upwards
1151+
if sys.version_info <= (3, 10):
1152+
encoding = io.text_encoding(encoding)
11491153
with self.open(mode="r", encoding=encoding, errors=errors) as f:
11501154
return f.read()
11511155

@@ -1164,7 +1168,11 @@ def write_text(self, data, encoding=None, errors=None, newline=None):
11641168
"""
11651169
if not isinstance(data, str):
11661170
raise TypeError("data must be str, not %s" % data.__class__.__name__)
1167-
encoding = io.text_encoding(encoding)
1171+
1172+
# bitranox - io.text_encoding exists only on 3.10 upwards
1173+
if sys.version_info <= (3, 10):
1174+
encoding = io.text_encoding(encoding)
1175+
11681176
with self.open(mode="w", encoding=encoding, errors=errors, newline=newline) as f:
11691177
return f.write(data)
11701178

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def get_line_data(line: str) -> str:
8484

8585
setup_kwargs: Dict[str, Any] = dict()
8686
setup_kwargs["name"] = "pathlib3x"
87-
setup_kwargs["version"] = "v2.0.0"
87+
setup_kwargs["version"] = "v2.0.1"
8888
setup_kwargs["url"] = "https://github.com/bitranox/pathlib3x"
8989
setup_kwargs["packages"] = find_packages()
9090
setup_kwargs["package_data"] = {"pathlib3x": ["py.typed", "*.pyi", "__init__.pyi"]}

0 commit comments

Comments
 (0)