Skip to content

Commit a7fdc06

Browse files
committed
Only apply workaround on required Pythons.
1 parent bbee59b commit a7fdc06

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

distutils/tests/test_dir_util.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import os
44
import pathlib
55
import stat
6+
import sys
67
import unittest.mock as mock
78
from distutils import dir_util, errors
89
from distutils.dir_util import (
@@ -124,9 +125,12 @@ class FailPath(pathlib.Path):
124125
def mkdir(self, *args, **kwargs):
125126
raise OSError("Failed to create directory")
126127

127-
_flavour = (
128-
pathlib._windows_flavour if os.name == 'nt' else pathlib._posix_flavour
129-
)
128+
if sys.version_info < (3, 12):
129+
_flavour = (
130+
pathlib._windows_flavour
131+
if os.name == 'nt'
132+
else pathlib._posix_flavour
133+
)
130134

131135
target = tmp_path / 'foodir'
132136

0 commit comments

Comments
 (0)