[Python-checkins] bpo-31583: Fix 2to3 for using with --add-suffix option (GH-3758) (GH-6529)

Łukasz Langa webhook-mailer at python.org
Thu Apr 19 01:10:01 EDT 2018


https://github.com/python/cpython/commit/1957e7b76a1319995360492223a4dfe1cd5d105c
commit: 1957e7b76a1319995360492223a4dfe1cd5d105c
branch: 3.6
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: Łukasz Langa <lukasz at langa.pl>
date: 2018-04-18T22:09:51-07:00
summary:

bpo-31583: Fix 2to3 for using with --add-suffix option (GH-3758) (GH-6529)

(cherry picked from commit e3a523a0fa16aec880880928303bfcbd1fb74bc2)

Co-authored-by: Denis Osipov <osipov_d at list.ru>

files:
A Misc/NEWS.d/next/Tools-Demos/2017-09-26-10-11-21.bpo-31583.TM90_H.rst
M Lib/lib2to3/main.py

diff --git a/Lib/lib2to3/main.py b/Lib/lib2to3/main.py
index 1a1df013ade3..d6b708848ede 100644
--- a/Lib/lib2to3/main.py
+++ b/Lib/lib2to3/main.py
@@ -80,7 +80,7 @@ def write_file(self, new_text, filename, old_text, encoding):
             filename += self._append_suffix
         if orig_filename != filename:
             output_dir = os.path.dirname(filename)
-            if not os.path.isdir(output_dir):
+            if not os.path.isdir(output_dir) and output_dir:
                 os.makedirs(output_dir)
             self.log_message('Writing converted %s to %s.', orig_filename,
                              filename)
diff --git a/Misc/NEWS.d/next/Tools-Demos/2017-09-26-10-11-21.bpo-31583.TM90_H.rst b/Misc/NEWS.d/next/Tools-Demos/2017-09-26-10-11-21.bpo-31583.TM90_H.rst
new file mode 100644
index 000000000000..472f61c5129e
--- /dev/null
+++ b/Misc/NEWS.d/next/Tools-Demos/2017-09-26-10-11-21.bpo-31583.TM90_H.rst
@@ -0,0 +1,2 @@
+Fix 2to3 for using with --add-suffix option but without --output-dir
+option for relative path to files in current directory.



More information about the Python-checkins mailing list