Skip to content

Commit ff99234

Browse files
committed
Re-use compat.py39.LOCALE_ENCODING in editable_wheel
1 parent 03166bc commit ff99234

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

setuptools/command/editable_wheel.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
import io
1515
import os
1616
import shutil
17-
import sys
1817
import traceback
1918
from contextlib import suppress
2019
from enum import Enum
@@ -44,6 +43,7 @@
4443
namespaces,
4544
)
4645
from .._path import StrPath
46+
from ..compat import py39
4747
from ..discovery import find_package_path
4848
from ..dist import Distribution
4949
from ..warnings import (
@@ -558,9 +558,8 @@ def _encode_pth(content: str) -> bytes:
558558
(There seems to be some variety in the way different version of Python handle
559559
``encoding=None``, not all of them use ``locale.getpreferredencoding(False)``).
560560
"""
561-
encoding = "locale" if sys.version_info >= (3, 10) else None
562561
with io.BytesIO() as buffer:
563-
wrapper = io.TextIOWrapper(buffer, encoding)
562+
wrapper = io.TextIOWrapper(buffer, encoding=py39.LOCALE_ENCODING)
564563
wrapper.write(content)
565564
wrapper.flush()
566565
buffer.seek(0)

0 commit comments

Comments
 (0)