Skip to content

Commit aa5e36a

Browse files
committed
[OMCPath] define limited compatibility for Python < 3.12
* use modified pathlib.Path as OMCPath
1 parent 6608b29 commit aa5e36a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

OMPython/OMCSession.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,15 @@ def size(self) -> int:
413413
raise OMCSessionException(f"Error reading file size for path {self.as_posix()}!")
414414

415415

416+
if sys.version_info < (3, 12):
417+
class OMCPathCompatibility(pathlib.Path):
418+
419+
def size(self) -> int:
420+
return self.stat().st_size
421+
422+
423+
OMCPath = OMCPathCompatibility
424+
416425

417426
class OMCSessionZMQ:
418427

0 commit comments

Comments
 (0)