bpo-33677: Fix signatures of tp_clear handlers for AST and deque. (GH… · python/cpython@a4dd46a (original) (raw)
3 files changed
lines changed
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -575,7 +575,7 @@ deque_concat(dequeobject *deque, PyObject *other) | ||
575 | 575 | return new_deque; |
576 | 576 | } |
577 | 577 | |
578 | -static void | |
578 | +static int | |
579 | 579 | deque_clear(dequeobject *deque) |
580 | 580 | { |
581 | 581 | block *b; |
@@ -587,7 +587,7 @@ deque_clear(dequeobject *deque) | ||
587 | 587 | PyObject **itemptr, **limit; |
588 | 588 | |
589 | 589 | if (Py_SIZE(deque) == 0) |
590 | -return; | |
590 | +return 0; | |
591 | 591 | |
592 | 592 | /* During the process of clearing a deque, decrefs can cause the |
593 | 593 | deque to mutate. To avoid fatal confusion, we have to make the |
@@ -648,14 +648,15 @@ deque_clear(dequeobject *deque) | ||
648 | 648 | } |
649 | 649 | CHECK_END(leftblock->rightlink); |
650 | 650 | freeblock(leftblock); |
651 | -return; | |
651 | +return 0; | |
652 | 652 | |
653 | 653 | alternate_method: |
654 | 654 | while (Py_SIZE(deque)) { |
655 | 655 | item = deque_pop(deque, NULL); |
656 | 656 | assert (item != NULL); |
657 | 657 | Py_DECREF(item); |
658 | 658 | } |
659 | +return 0; | |
659 | 660 | } |
660 | 661 | |
661 | 662 | static PyObject * |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -647,10 +647,11 @@ def visitModule(self, mod): | ||
647 | 647 | return 0; |
648 | 648 | } |
649 | 649 | |
650 | -static void | |
650 | +static int | |
651 | 651 | ast_clear(AST_object *self) |
652 | 652 | { |
653 | 653 | Py_CLEAR(self->dict); |
654 | + return 0; | |
654 | 655 | } |
655 | 656 | |
656 | 657 | static int |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -528,10 +528,11 @@ ast_traverse(AST_object *self, visitproc visit, void *arg) | ||
528 | 528 | return 0; |
529 | 529 | } |
530 | 530 | |
531 | -static void | |
531 | +static int | |
532 | 532 | ast_clear(AST_object *self) |
533 | 533 | { |
534 | 534 | Py_CLEAR(self->dict); |
535 | +return 0; | |
535 | 536 | } |
536 | 537 | |
537 | 538 | static int |