From 8d94ffd4896128172b8576e4451916afc1d3bd40 Mon Sep 17 00:00:00 2001 From: barneygale Date: Mon, 4 Dec 2023 18:13:15 +0000 Subject: [PATCH] Set slot values of empty paths up front. --- Lib/pathlib.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Lib/pathlib.py b/Lib/pathlib.py index f6d30c027cfeaa..0bf75f25c7064e 100644 --- a/Lib/pathlib.py +++ b/Lib/pathlib.py @@ -609,7 +609,9 @@ def __init__(self, *args): if len(paths) == 1: self._raw_path_cached = paths[0] elif len(paths) == 0: - self._raw_path_cached = '.' + self._str = self._raw_path_cached = '.' + self._drv = self._root = '' + self._tail_cached = [] self._resolving = False def __reduce__(self):