Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(169542)

Delta Between Two Patch Sets: Objects/typeobject.c

Issue 23722: During metaclass.__init__, super() of the constructed class does not work
Left Patch Set: Created 3 years ago
Right Patch Set: Created 3 years ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
LEFTRIGHT
1 /* Type object implementation */ 1 /* Type object implementation */
2 2
3 #include "Python.h" 3 #include "Python.h"
4 #include "frameobject.h" 4 #include "frameobject.h"
5 #include "structmember.h" 5 #include "structmember.h"
6 6
7 #include <ctype.h> 7 #include <ctype.h>
8 8
9 9
10 /* Support type attribute cache */ 10 /* Support type attribute cache */
(...skipping 2676 matching lines...) Expand 10 before | Expand all | Expand 10 after
2687 else 2687 else
2688 type->tp_free = PyObject_Del; 2688 type->tp_free = PyObject_Del;
2689 2689
2690 /* store type in class' cell if one is supplied */ 2690 /* store type in class' cell if one is supplied */
2691 cell = _PyDict_GetItemId(dict, &PyId___classcell__); 2691 cell = _PyDict_GetItemId(dict, &PyId___classcell__);
2692 if (cell != NULL) { 2692 if (cell != NULL) {
2693 /* At least one method requires a reference to its defining class */ 2693 /* At least one method requires a reference to its defining class */
2694 if (!PyCell_Check(cell)) { 2694 if (!PyCell_Check(cell)) {
2695 PyErr_Format(PyExc_TypeError, 2695 PyErr_Format(PyExc_TypeError,
2696 "__classcell__ must be a nonlocal cell, not %.200R", 2696 "__classcell__ must be a nonlocal cell, not %.200R",
2697 Py_TYPE(cell)); 2697 Py_TYPE(cell));
storchaka 2016/12/04 11:23:35 It would be better to output a type name instead o
Nick Coghlan 2016/12/04 13:39:05 The reason I switched was because the default __re
2698 goto error; 2698 goto error;
2699 } 2699 }
2700 PyCell_Set(cell, (PyObject *) type); 2700 PyCell_Set(cell, (PyObject *) type);
2701 _PyDict_DelItemId(dict, &PyId___classcell__); 2701 _PyDict_DelItemId(dict, &PyId___classcell__);
2702 PyErr_Clear(); 2702 PyErr_Clear();
2703 } 2703 }
2704 2704
2705 /* Initialize the rest */ 2705 /* Initialize the rest */
2706 if (PyType_Ready(type) < 0) 2706 if (PyType_Ready(type) < 0)
2707 goto error; 2707 goto error;
(...skipping 4866 matching lines...) Expand 10 before | Expand all | Expand 10 after
7574 0, /* tp_base */ 7574 0, /* tp_base */
7575 0, /* tp_dict */ 7575 0, /* tp_dict */
7576 super_descr_get, /* tp_descr_get */ 7576 super_descr_get, /* tp_descr_get */
7577 0, /* tp_descr_set */ 7577 0, /* tp_descr_set */
7578 0, /* tp_dictoffset */ 7578 0, /* tp_dictoffset */
7579 super_init, /* tp_init */ 7579 super_init, /* tp_init */
7580 PyType_GenericAlloc, /* tp_alloc */ 7580 PyType_GenericAlloc, /* tp_alloc */
7581 PyType_GenericNew, /* tp_new */ 7581 PyType_GenericNew, /* tp_new */
7582 PyObject_GC_Del, /* tp_free */ 7582 PyObject_GC_Del, /* tp_free */
7583 }; 7583 };
LEFTRIGHT

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+