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

Side by Side Diff: Objects/typeobject.c

Issue 25958: Implicit ABCs have no means of "anti-registration"
Patch Set: Created 4 years, 3 months 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:
View unified diff | Download patch
« Objects/enumobject.c ('K') | « Objects/enumobject.c ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 5801 matching lines...) Expand 10 before | Expand all | Expand 10 after
5812 } 5812 }
5813 5813
5814 static int 5814 static int
5815 slot_sq_contains(PyObject *self, PyObject *value) 5815 slot_sq_contains(PyObject *self, PyObject *value)
5816 { 5816 {
5817 PyObject *func, *res, *args; 5817 PyObject *func, *res, *args;
5818 int result = -1; 5818 int result = -1;
5819 _Py_IDENTIFIER(__contains__); 5819 _Py_IDENTIFIER(__contains__);
5820 5820
5821 func = lookup_maybe(self, &PyId___contains__); 5821 func = lookup_maybe(self, &PyId___contains__);
5822 if (func == Py_None) {
5823 Py_DECREF(func);
5824 PyErr_Format(PyExc_TypeError,
5825 "argument of type '%.200s' is not a container",
storchaka 2016/01/05 21:48:04 Why not "'%.200s' object is not a container" (for
abarnert 2016/01/05 23:28:55 Sure--especially if we're going out of our way to
5826 Py_TYPE(self)->tp_name);
5827 return NULL;
gvanrossum 2016/01/05 20:55:20 Should be -1.
5828 }
5822 if (func != NULL) { 5829 if (func != NULL) {
5823 args = PyTuple_Pack(1, value); 5830 args = PyTuple_Pack(1, value);
5824 if (args == NULL) 5831 if (args == NULL)
5825 res = NULL; 5832 res = NULL;
5826 else { 5833 else {
5827 res = PyObject_Call(func, args, NULL); 5834 res = PyObject_Call(func, args, NULL);
5828 Py_DECREF(args); 5835 Py_DECREF(args);
5829 } 5836 }
5830 Py_DECREF(func); 5837 Py_DECREF(func);
5831 if (res != NULL) { 5838 if (res != NULL) {
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
6197 return res; 6204 return res;
6198 } 6205 }
6199 6206
6200 static PyObject * 6207 static PyObject *
6201 slot_tp_iter(PyObject *self) 6208 slot_tp_iter(PyObject *self)
6202 { 6209 {
6203 PyObject *func, *res; 6210 PyObject *func, *res;
6204 _Py_IDENTIFIER(__iter__); 6211 _Py_IDENTIFIER(__iter__);
6205 6212
6206 func = lookup_method(self, &PyId___iter__); 6213 func = lookup_method(self, &PyId___iter__);
6214 if (func == Py_None) {
6215 Py_DECREF(func);
6216 PyErr_Format(PyExc_TypeError,
6217 "'%.200s' object is not iterable",
6218 Py_TYPE(self)->tp_name);
6219 return NULL;
6220 }
6207 if (func != NULL) { 6221 if (func != NULL) {
6208 PyObject *args; 6222 PyObject *args;
6209 args = res = PyTuple_New(0); 6223 args = res = PyTuple_New(0);
6210 if (args != NULL) { 6224 if (args != NULL) {
6211 res = PyObject_Call(func, args, NULL); 6225 res = PyObject_Call(func, args, NULL);
6212 Py_DECREF(args); 6226 Py_DECREF(args);
6213 } 6227 }
6214 Py_DECREF(func); 6228 Py_DECREF(func);
6215 return res; 6229 return res;
6216 } 6230 }
(...skipping 1206 matching lines...) Expand 10 before | Expand all | Expand 10 after
7423 0, /* tp_base */ 7437 0, /* tp_base */
7424 0, /* tp_dict */ 7438 0, /* tp_dict */
7425 super_descr_get, /* tp_descr_get */ 7439 super_descr_get, /* tp_descr_get */
7426 0, /* tp_descr_set */ 7440 0, /* tp_descr_set */
7427 0, /* tp_dictoffset */ 7441 0, /* tp_dictoffset */
7428 super_init, /* tp_init */ 7442 super_init, /* tp_init */
7429 PyType_GenericAlloc, /* tp_alloc */ 7443 PyType_GenericAlloc, /* tp_alloc */
7430 PyType_GenericNew, /* tp_new */ 7444 PyType_GenericNew, /* tp_new */
7431 PyObject_GC_Del, /* tp_free */ 7445 PyObject_GC_Del, /* tp_free */
7432 }; 7446 };
OLDNEW
« Objects/enumobject.c ('K') | « Objects/enumobject.c ('k') | no next file » | no next file with comments »

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