Skip to content

Commit

Permalink
fix: explicitly call __init__ to setup PurePath instance (fixes #193)
Browse files Browse the repository at this point in the history
  • Loading branch information
aaraney committed Sep 25, 2024
1 parent 348a93a commit 2278547
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions python/ngen_conf/src/ngen/config/path_pair/path_pair.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import annotations

import os
import sys
from pathlib import Path, PosixPath, WindowsPath

from .protocol import Reader, Writer, Serializer, Deserializer
Expand Down Expand Up @@ -84,6 +85,9 @@ def __new__( # type: ignore
inner = _MaybeInner[cls._parameters[0]](inner=inner).inner # type: ignore
cls = WindowsPathPair[T] if os.name == "nt" else PosixPathPair[T]
self: WindowsPathPair[T] | PosixPathPair[T] = Path.__new__(cls, *args, **kwargs)
# explicitly call __init__ to setup instance (see #193)
if sys.version_info >= (3, 12):
self.__init__(*args)
self._inner = inner # type: ignore
self._serializer = serializer # type: ignore
self._deserializer = deserializer # type: ignore
Expand Down Expand Up @@ -316,6 +320,9 @@ def __new__( # type: ignore
deserializer=deserializer,
**kwargs,
)
# explicitly call __init__ to setup instance (see #193)
if sys.version_info >= (3, 12):
self.__init__(*args)
self._inner = inner
self._serializer = serializer
self._deserializer = deserializer
Expand Down

0 comments on commit 2278547

Please sign in to comment.