From 0e3495443c238bc9504526fa4d6a25f35936e2c0 Mon Sep 17 00:00:00 2001 From: Jacob Walls Date: Sat, 10 Aug 2024 08:08:05 -0400 Subject: [PATCH] [PY3.13] Handle pathlib._local --- pylint/checkers/stdlib.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pylint/checkers/stdlib.py b/pylint/checkers/stdlib.py index 9fab490b9c..8b37520b78 100644 --- a/pylint/checkers/stdlib.py +++ b/pylint/checkers/stdlib.py @@ -33,7 +33,8 @@ ENV_GETTERS = ("os.getenv",) SUBPROCESS_POPEN = "subprocess.Popen" SUBPROCESS_RUN = "subprocess.run" -OPEN_MODULE = {"_io", "pathlib"} +OPEN_MODULE = {"_io", "pathlib", "pathlib._local"} +PATHLIB_MODULE = {"pathlib", "pathlib._local"} DEBUG_BREAKPOINTS = ("builtins.breakpoint", "sys.breakpointhook", "pdb.set_trace") LRU_CACHE = { "functools.lru_cache", # Inferred for @lru_cache @@ -784,7 +785,7 @@ def _check_open_call( mode_arg = utils.get_argument_from_call( node, position=1, keyword="mode" ) - elif open_module == "pathlib": + elif open_module in PATHLIB_MODULE: mode_arg = utils.get_argument_from_call( node, position=0, keyword="mode" ) @@ -814,7 +815,7 @@ def _check_open_call( ): confidence = HIGH try: - if open_module == "pathlib": + if open_module in PATHLIB_MODULE: if node.func.attrname == "read_text": encoding_arg = utils.get_argument_from_call( node, position=0, keyword="encoding"