Skip to content

Commit 0e34954

Browse files
[PY3.13] Handle pathlib._local
1 parent bf33b6e commit 0e34954

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pylint/checkers/stdlib.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@
3333
ENV_GETTERS = ("os.getenv",)
3434
SUBPROCESS_POPEN = "subprocess.Popen"
3535
SUBPROCESS_RUN = "subprocess.run"
36-
OPEN_MODULE = {"_io", "pathlib"}
36+
OPEN_MODULE = {"_io", "pathlib", "pathlib._local"}
37+
PATHLIB_MODULE = {"pathlib", "pathlib._local"}
3738
DEBUG_BREAKPOINTS = ("builtins.breakpoint", "sys.breakpointhook", "pdb.set_trace")
3839
LRU_CACHE = {
3940
"functools.lru_cache", # Inferred for @lru_cache
@@ -784,7 +785,7 @@ def _check_open_call(
784785
mode_arg = utils.get_argument_from_call(
785786
node, position=1, keyword="mode"
786787
)
787-
elif open_module == "pathlib":
788+
elif open_module in PATHLIB_MODULE:
788789
mode_arg = utils.get_argument_from_call(
789790
node, position=0, keyword="mode"
790791
)
@@ -814,7 +815,7 @@ def _check_open_call(
814815
):
815816
confidence = HIGH
816817
try:
817-
if open_module == "pathlib":
818+
if open_module in PATHLIB_MODULE:
818819
if node.func.attrname == "read_text":
819820
encoding_arg = utils.get_argument_from_call(
820821
node, position=0, keyword="encoding"

0 commit comments

Comments
 (0)