Skip to content

Commit ffa18a4

Browse files
Enforce ruff/flake8-2020 rule (YTT301)
YTT301 `sys.version[0]` referenced (python10), use `sys.version_info` The Python documentation discourages the use of `sys.version`: Do not extract version information out of it, rather, use `version_info` and [...]
1 parent b7ee725 commit ffa18a4

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

distutils/sysconfig.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ def get_python_lib(plat_specific=False, standard_lib=False, prefix=None):
236236
if prefix is None:
237237
prefix = PREFIX
238238
if standard_lib:
239-
return os.path.join(prefix, "lib-python", sys.version[0])
239+
return os.path.join(prefix, "lib-python", sys.version_info.major)
240240
return os.path.join(prefix, 'site-packages')
241241

242242
early_prefix = prefix

ruff.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ extend-select = [
99
"RUF010",
1010
"RUF100",
1111
"UP",
12+
"YTT",
1213
]
1314
ignore = [
1415
# https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules

0 commit comments

Comments
 (0)