Commit c11e192
committed
Thinking back to the 2.22 revision, I didn't like what I did there one
bit. For one, this class:
class C(object):
def __new__(myclass, ...): ...
would have no way to call the __new__ method of its base class, and
the workaround (to create an intermediate base class whose __new__ you
can call) is ugly.
So, I've come up with a better solution that restores object.__new__,
but still solves the original problem, which is that built-in and
extension types shouldn't inherit object.__new__. The solution is
simple: only "heap types" inherit tp_new. Simpler, less code,
perfect!1 parent a995c91 commit c11e192
1 file changed
Lines changed: 4 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
447 | 447 | | |
448 | 448 | | |
449 | 449 | | |
450 | | - | |
451 | 450 | | |
452 | 451 | | |
453 | 452 | | |
| |||
672 | 671 | | |
673 | 672 | | |
674 | 673 | | |
675 | | - | |
676 | | - | |
677 | | - | |
678 | | - | |
679 | | - | |
680 | | - | |
681 | | - | |
682 | | - | |
683 | | - | |
684 | | - | |
685 | 674 | | |
686 | 675 | | |
687 | 676 | | |
| |||
913 | 902 | | |
914 | 903 | | |
915 | 904 | | |
916 | | - | |
| 905 | + | |
917 | 906 | | |
918 | 907 | | |
919 | 908 | | |
| |||
1163 | 1152 | | |
1164 | 1153 | | |
1165 | 1154 | | |
1166 | | - | |
| 1155 | + | |
| 1156 | + | |
| 1157 | + | |
1167 | 1158 | | |
1168 | 1159 | | |
1169 | 1160 | | |
| |||
0 commit comments