summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1996-02-25 04:50:32 (GMT)
committerGuido van Rossum <guido@python.org>1996-02-25 04:50:32 (GMT)
commitb0824db52c1805a267aea1f49e4778251ff802fe (patch)
treeb60f959ee0415c9f9df949a7eedfb7dce95b9e55 /Modules
parent1266a01e477c3efb2ac8aa541379ad86616ec99a (diff)
downloadcpython-b0824db52c1805a267aea1f49e4778251ff802fe.zip
cpython-b0824db52c1805a267aea1f49e4778251ff802fe.tar.gz
cpython-b0824db52c1805a267aea1f49e4778251ff802fe.tar.bz2
Made 2nd arg to mkdir optional
Diffstat (limited to 'Modules')
-rw-r--r--Modules/posixmodule.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index ca311c4..3ecbc35 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -485,7 +485,18 @@ posix_mkdir(self, args)
object *self;
object *args;
{
- return posix_strint(args, mkdir);
+ int res;
+ char *path;
+ int mode = 0777; /* Unused */
+ if (!newgetargs(args, "s|i", &path, &mode))
+ return NULL;
+ BGN_SAVE
+ res = mkdir(path, mode);
+ END_SAVE
+ if (res < 0)
+ return posix_error();
+ INCREF(None);
+ return None;
}
#ifdef HAVE_NICE
@@ -1407,7 +1418,7 @@ static struct methodlist posix_methods[] = {
#endif /* HAVE_LINK */
{"listdir", posix_listdir},
{"lstat", posix_lstat},
- {"mkdir", posix_mkdir},
+ {"mkdir", posix_mkdir, 1},
#ifdef HAVE_NICE
{"nice", posix_nice},
#endif /* HAVE_NICE */