mirror of
https://github.com/python/cpython.git
synced 2025-11-11 14:44:57 +00:00
Made 2nd arg to mkdir optional
This commit is contained in:
parent
1266a01e47
commit
b0824db52c
1 changed files with 13 additions and 2 deletions
|
|
@ -485,7 +485,18 @@ posix_mkdir(self, args)
|
||||||
object *self;
|
object *self;
|
||||||
object *args;
|
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
|
#ifdef HAVE_NICE
|
||||||
|
|
@ -1407,7 +1418,7 @@ static struct methodlist posix_methods[] = {
|
||||||
#endif /* HAVE_LINK */
|
#endif /* HAVE_LINK */
|
||||||
{"listdir", posix_listdir},
|
{"listdir", posix_listdir},
|
||||||
{"lstat", posix_lstat},
|
{"lstat", posix_lstat},
|
||||||
{"mkdir", posix_mkdir},
|
{"mkdir", posix_mkdir, 1},
|
||||||
#ifdef HAVE_NICE
|
#ifdef HAVE_NICE
|
||||||
{"nice", posix_nice},
|
{"nice", posix_nice},
|
||||||
#endif /* HAVE_NICE */
|
#endif /* HAVE_NICE */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue