-
Notifications
You must be signed in to change notification settings - Fork 281
Open
Labels
Description
Describe the Bug
This code reports two errors
import unittest
import pathlib
import tempfile
class TestMigrationUtils(unittest.TestCase):
def setUp(self) -> None:
tmp_path = pathlib.Path(self.enterContext(tempfile.TemporaryDirectory()))
with tempfile.TemporaryDirectory() as tmpdir:
pathlib.Path(tmpdir)ERROR sandbox.py:7:83-85: No matching overload found for function `tempfile.TemporaryDirectory.__init__` called with arguments: () [[no-matching-overload](https://pyrefly.org/en/docs/error-kinds/#no-matching-overload)]
Possible overloads:
(suffix: str | None = None, prefix: str | None = None, dir: PathLike[str] | str | None = None, ignore_cleanup_errors: bool = False, *, delete: bool = True) -> None [closest match]
(suffix: bytes | None = None, prefix: bytes | None = None, dir: PathLike[bytes] | bytes | None = None, ignore_cleanup_errors: bool = False, *, delete: bool = True) -> None
ERROR sandbox.py:7:83-85: `PathLike[str] | str` is not assignable to upper bound `bytes | str` of type variable `AnyStr` [[bad-specialization](https://pyrefly.org/en/docs/error-kinds/#bad-specialization)]
I'm a bit confused why the self.enterContext causes this error (especially retroactively causing an error with tempfile.TemporaryDirectory()?).
Sandbox Link
(Only applicable for extension issues) IDE Information
No response
Reactions are currently unavailable