Skip to content

Commit 8f330bc

Browse files
authored
fix: "" userDataDir on Windows with Python 3.9 (#2801)
1 parent 8870edb commit 8f330bc

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

playwright/_impl/_browser_type.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
import asyncio
1616
import pathlib
17+
import sys
1718
from pathlib import Path
1819
from typing import TYPE_CHECKING, Dict, List, Optional, Pattern, Sequence, Union, cast
1920

@@ -167,6 +168,10 @@ def _user_data_dir(self, userDataDir: Optional[Union[str, Path]]) -> str:
167168
if not userDataDir:
168169
return ""
169170
if not Path(userDataDir).is_absolute():
171+
# Can be dropped once we drop Python 3.9 support (10/2025):
172+
# https://github.com/python/cpython/issues/82852
173+
if sys.platform == "win32" and sys.version_info[:2] < (3, 10):
174+
return pathlib.Path.cwd() / userDataDir
170175
return str(Path(userDataDir).resolve())
171176
return str(Path(userDataDir))
172177

0 commit comments

Comments
 (0)