Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c33a423

Browse files
committed
Treat an empty kwdict argument the same as a missing one.
1 parent 726d873 commit c33a423

1 file changed

Lines changed: 20 additions & 20 deletions

File tree

Mac/Modules/Nav.c

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -437,8 +437,8 @@ nav_NavGetFile(self, args, kw)
437437
NavTypeListHandle typeList = NULL;
438438
OSErr err;
439439

440-
if ( kw ) {
441-
if (!PyArg_ParseTuple(args, ""))
440+
if ( kw && PyObject_IsTrue(kw) ) {
441+
if (!PyArg_ParseTuple(args, ";either keyword arguments or dictionary expected"))
442442
return NULL;
443443
dict = kw;
444444
} else if (!PyArg_ParseTuple(args, "O!", &PyDict_Type, &dict))
@@ -474,8 +474,8 @@ nav_NavPutFile(self, args, kw)
474474
OSType fileCreator;
475475
OSErr err;
476476

477-
if ( kw ) {
478-
if (!PyArg_ParseTuple(args, ""))
477+
if ( kw && PyObject_IsTrue(kw) ) {
478+
if (!PyArg_ParseTuple(args, ";either keyword arguments or dictionary expected"))
479479
return NULL;
480480
dict = kw;
481481
} else if (!PyArg_ParseTuple(args, "O!", &PyDict_Type, &dict))
@@ -510,7 +510,7 @@ nav_NavAskSaveChanges(self, args, kw)
510510
NavEventUPP eventProc = NULL;
511511
OSErr err;
512512

513-
if ( kw ) {
513+
if ( kw && PyObject_IsTrue(kw) ) {
514514
if (!PyArg_ParseTuple(args, "l", &action))
515515
return NULL;
516516
dict = kw;
@@ -542,8 +542,8 @@ nav_NavCustomAskSaveChanges(self, args, kw)
542542
NavEventUPP eventProc = NULL;
543543
OSErr err;
544544

545-
if ( kw ) {
546-
if (!PyArg_ParseTuple(args, ""))
545+
if ( kw && PyObject_IsTrue(kw) ) {
546+
if (!PyArg_ParseTuple(args, ";either keyword arguments or dictionary expected"))
547547
return NULL;
548548
dict = kw;
549549
} else if (!PyArg_ParseTuple(args, "O!", &PyDict_Type, &dict))
@@ -574,8 +574,8 @@ nav_NavAskDiscardChanges(self, args, kw)
574574
NavEventUPP eventProc = NULL;
575575
OSErr err;
576576

577-
if ( kw ) {
578-
if (!PyArg_ParseTuple(args, ""))
577+
if ( kw && PyObject_IsTrue(kw) ) {
578+
if (!PyArg_ParseTuple(args, ";either keyword arguments or dictionary expected"))
579579
return NULL;
580580
dict = kw;
581581
} else if (!PyArg_ParseTuple(args, "O!", &PyDict_Type, &dict))
@@ -610,8 +610,8 @@ nav_NavChooseFile(self, args, kw)
610610
NavTypeListHandle typeList = NULL;
611611
OSErr err;
612612

613-
if ( kw ) {
614-
if (!PyArg_ParseTuple(args, ""))
613+
if ( kw && PyObject_IsTrue(kw) ) {
614+
if (!PyArg_ParseTuple(args, ";either keyword arguments or dictionary expected"))
615615
return NULL;
616616
dict = kw;
617617
} else if (!PyArg_ParseTuple(args, "O!", &PyDict_Type, &dict))
@@ -646,8 +646,8 @@ nav_NavChooseFolder(self, args, kw)
646646
NavObjectFilterUPP filterProc = NULL;
647647
OSErr err;
648648

649-
if ( kw ) {
650-
if (!PyArg_ParseTuple(args, ""))
649+
if ( kw && PyObject_IsTrue(kw) ) {
650+
if (!PyArg_ParseTuple(args, ";either keyword arguments or dictionary expected"))
651651
return NULL;
652652
dict = kw;
653653
} else if (!PyArg_ParseTuple(args, "O!", &PyDict_Type, &dict))
@@ -682,8 +682,8 @@ nav_NavChooseVolume(self, args, kw)
682682
NavObjectFilterUPP filterProc = NULL;
683683
OSErr err;
684684

685-
if ( kw ) {
686-
if (!PyArg_ParseTuple(args, ""))
685+
if ( kw && PyObject_IsTrue(kw) ) {
686+
if (!PyArg_ParseTuple(args, ";either keyword arguments or dictionary expected"))
687687
return NULL;
688688
dict = kw;
689689
} else if (!PyArg_ParseTuple(args, "O!", &PyDict_Type, &dict))
@@ -718,8 +718,8 @@ nav_NavChooseObject(self, args, kw)
718718
NavObjectFilterUPP filterProc = NULL;
719719
OSErr err;
720720

721-
if ( kw ) {
722-
if (!PyArg_ParseTuple(args, ""))
721+
if ( kw && PyObject_IsTrue(kw) ) {
722+
if (!PyArg_ParseTuple(args, ";either keyword arguments or dictionary expected"))
723723
return NULL;
724724
dict = kw;
725725
} else if (!PyArg_ParseTuple(args, "O!", &PyDict_Type, &dict))
@@ -753,8 +753,8 @@ nav_NavNewFolder(self, args, kw)
753753
NavEventUPP eventProc = NULL;
754754
OSErr err;
755755

756-
if ( kw ) {
757-
if (!PyArg_ParseTuple(args, ""))
756+
if ( kw && PyObject_IsTrue(kw) ) {
757+
if (!PyArg_ParseTuple(args, ";either keyword arguments or dictionary expected"))
758758
return NULL;
759759
dict = kw;
760760
} else if (!PyArg_ParseTuple(args, "O!", &PyDict_Type, &dict))
@@ -771,7 +771,7 @@ nav_NavNewFolder(self, args, kw)
771771
}
772772

773773
#if 0
774-
XXXX I don't know what to do with the void * argument
774+
/* XXXX I don't know what to do with the void * argument */
775775
static char nav_NavCustomControl__doc__[] =
776776
""
777777
;

0 commit comments

Comments
 (0)