summaryrefslogtreecommitdiffstats
path: root/Lib/distutils/dir_util.py
diff options
context:
space:
mode:
authorGreg Ward <gward@python.net>2000-05-27 01:35:27 (GMT)
committerGreg Ward <gward@python.net>2000-05-27 01:35:27 (GMT)
commit2d238c56a6d28002aa5c24c732068cbe598fc5be (patch)
tree66494f279ba64fd7abc8b245fa83f42358f62574 /Lib/distutils/dir_util.py
parent46380906d19c1696f0366be9231d03fe4b1a5981 (diff)
downloadcpython-2d238c56a6d28002aa5c24c732068cbe598fc5be.zip
cpython-2d238c56a6d28002aa5c24c732068cbe598fc5be.tar.gz
cpython-2d238c56a6d28002aa5c24c732068cbe598fc5be.tar.bz2
'mkpath()' now detects non-string 'name' arguments -- this is a fairly common
bug when adding new code, so I thought I'd make it blow up earlier than deep in posix.py.
Diffstat (limited to 'Lib/distutils/dir_util.py')
-rw-r--r--Lib/distutils/dir_util.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/Lib/distutils/dir_util.py b/Lib/distutils/dir_util.py
index c049bbd..194183a 100644
--- a/Lib/distutils/dir_util.py
+++ b/Lib/distutils/dir_util.py
@@ -7,7 +7,8 @@ Utility functions for manipulating directories and directory trees."""
__revision__ = "$Id$"
import os
-from distutils.errors import DistutilsFileError
+from types import *
+from distutils.errors import DistutilsFileError, DistutilsInternalError
# cache for by mkpath() -- in addition to cheapening redundant calls,
@@ -29,6 +30,11 @@ def mkpath (name, mode=0777, verbose=0, dry_run=0):
global PATH_CREATED
+ # Detect a common bug -- name is None
+ if type(name) is not StringType:
+ raise DistutilsInternalError, \
+ "mkpath: 'name' must be a string (got %s)" % `name`
+
# XXX what's the better way to handle verbosity? print as we create
# each directory in the path (the current behaviour), or only announce
# the creation of the whole path? (quite easy to do the latter since