Protect logging call against None argument (fixes #11045).
Initial patch by Kelsey Hightower. Approved by Raymond. A test was
non-trivial to write without calling the private function directly, so
we moved that for later.
diff --git a/Lib/shutil.py b/Lib/shutil.py
index b808633..d47c67c 100644
--- a/Lib/shutil.py
+++ b/Lib/shutil.py
@@ -391,7 +391,8 @@
archive_dir = os.path.dirname(archive_name)
if not os.path.exists(archive_dir):
- logger.info("creating %s" % archive_dir)
+ if logger is not None:
+ logger.info("creating %s" % archive_dir)
if not dry_run:
os.makedirs(archive_dir)