From 2e9749297c21370fbb0255a5844ec609445fba94 Mon Sep 17 00:00:00 2001 From: Andy Freeland Date: Mon, 27 Feb 2023 10:17:01 -0800 Subject: [PATCH] Fix `Context.cd()` behavior to match the type hint Issue found when fixing the type hint in typeshed: https://github.com/python/typeshed/pull/9823#pullrequestreview-1316129640 --- invoke/context.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/invoke/context.py b/invoke/context.py index e9beaf4d1..21c5101e3 100644 --- a/invoke/context.py +++ b/invoke/context.py @@ -389,7 +389,7 @@ def cd(self, path: Union[PathLike, str]) -> Generator[None, None, None]: (such as the various ``Path`` objects out there), and not just string literals. """ - path = str(path) + path = os.fspath(path) self.command_cwds.append(path) try: yield