From f7cc0bf0ac2dfaa6d6edb868ac9eb2aebdf8821f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Martin=20v=2E=20L=C3=B6wis?= Date: Mon, 1 Dec 2003 21:04:02 +0000 Subject: [PATCH] Convert path objects to strings in askdirectory. Fixes #852314. --- Lib/lib-tk/tkFileDialog.py | 6 ++++++ Misc/NEWS | 2 ++ 2 files changed, 8 insertions(+) diff --git a/Lib/lib-tk/tkFileDialog.py b/Lib/lib-tk/tkFileDialog.py index 8419718acbc2..c2c661cbad5e 100644 --- a/Lib/lib-tk/tkFileDialog.py +++ b/Lib/lib-tk/tkFileDialog.py @@ -105,6 +105,12 @@ class Directory(Dialog): def _fixresult(self, widget, result): if result: + # convert Tcl path objects to strings + try: + result = result.string + except AttributeError: + # it already is a string + pass # keep directory until next time self.options["initialdir"] = result self.directory = result # compatibility diff --git a/Misc/NEWS b/Misc/NEWS index b205a1547f50..e0d5c8453a13 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -39,6 +39,8 @@ Core and builtins Extension modules ----------------- +- Bug #852314: Fix return type of tkFileDialog.askdirectory on Unix. + - Bug #834676: Fix crashes when normalizing Hangul syllables. - Bug #703198: Ignore "b" and "t" in os.popen on Unix. -- 2.47.3