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

Skip to content

Commit 6d946f9

Browse files
committed
* macmodule.c: include allobjects.h, not .c
* timemodule.c: the mac has no unistd.h * classobject.c: fixed several cases of return NULL that should be return -1 !!!
1 parent e6eefc2 commit 6d946f9

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

Modules/timemodule.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
3333
#include <signal.h>
3434
#include <setjmp.h>
3535

36+
#ifdef macintosh
37+
#define NO_UNISTD
38+
#endif
39+
3640
#ifndef NO_UNISTD
3741
#include <unistd.h>
3842
#endif

Objects/classobject.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ instance_ass_subscript(inst, key, value)
396396
arg = mkvalue("(OO)", key, value);
397397
if (arg == NULL) {
398398
DECREF(func);
399-
return NULL;
399+
return -1;
400400
}
401401
res = call_object(func, arg);
402402
DECREF(func);
@@ -509,14 +509,14 @@ instance_ass_item(inst, i, item)
509509
else
510510
func = instance_getattr(inst, "__setitem__");
511511
if (func == NULL)
512-
return NULL;
512+
return -1;
513513
if (item == NULL)
514514
arg = mkvalue("i", i);
515515
else
516516
arg = mkvalue("(iO)", i, item);
517517
if (arg == NULL) {
518518
DECREF(func);
519-
return NULL;
519+
return -1;
520520
}
521521
res = call_object(func, arg);
522522
DECREF(func);
@@ -540,14 +540,14 @@ instance_ass_slice(inst, i, j, value)
540540
else
541541
func = instance_getattr(inst, "__setslice__");
542542
if (func == NULL)
543-
return NULL;
543+
return -1;
544544
if (value == NULL)
545545
arg = mkvalue("(ii)", i, j);
546546
else
547547
arg = mkvalue("(iiO)", i, j, value);
548548
if (arg == NULL) {
549549
DECREF(func);
550-
return NULL;
550+
return -1;
551551
}
552552
res = call_object(func, arg);
553553
DECREF(func);

0 commit comments

Comments
 (0)