Skip to content

Commit 96f4a27

Browse files
committed
Make PathPlus.__enter__ a no-op on all Python versions.
1 parent 7ea0cb6 commit 96f4a27

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

domdf_python_tools/paths.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -799,21 +799,21 @@ def unlink(self, missing_ok: bool = False) -> None:
799799
if not missing_ok:
800800
raise
801801

802-
if sys.version_info < (3, 9): # pragma: no cover (py39+)
802+
def __enter__(self):
803+
return self
803804

804-
def __enter__(self):
805-
return self
806-
807-
def __exit__(self, t, v, tb):
808-
# https://bugs.python.org/issue39682
809-
# In previous versions of pathlib, this method marked this path as
810-
# closed; subsequent attempts to perform I/O would raise an IOError.
811-
# This functionality was never documented, and had the effect of
812-
# making Path objects mutable, contrary to PEP 428. In Python 3.9 the
813-
# _closed attribute was removed, and this method made a no-op.
814-
# This method and __enter__()/__exit__() should be deprecated and
815-
# removed in the future.
816-
pass
805+
def __exit__(self, t, v, tb):
806+
# https://bugs.python.org/issue39682
807+
# In previous versions of pathlib, this method marked this path as
808+
# closed; subsequent attempts to perform I/O would raise an IOError.
809+
# This functionality was never documented, and had the effect of
810+
# making Path objects mutable, contrary to PEP 428. In Python 3.9 the
811+
# _closed attribute was removed, and this method made a no-op.
812+
# This method and __enter__()/__exit__() should be deprecated and
813+
# removed in the future.
814+
pass
815+
816+
if sys.version_info < (3, 9): # pragma: no cover (py39+)
817817

818818
def is_relative_to(self, *other: Union[str, os.PathLike]) -> bool:
819819
r"""

0 commit comments

Comments
 (0)