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

Side by Side Diff: Objects/typeobject.c

Issue 25958: Implicit ABCs have no means of "anti-registration"
Patch Set: Created 3 years, 6 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
« no previous file with comments | « 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 5838 matching lines...) Expand 10 before | Expand all | Expand 10 after
5849 } 5849 }
5850 5850
5851 static int 5851 static int
5852 slot_sq_contains(PyObject *self, PyObject *value) 5852 slot_sq_contains(PyObject *self, PyObject *value)
5853 { 5853 {
5854 PyObject *func, *res, *args; 5854 PyObject *func, *res, *args;
5855 int result = -1; 5855 int result = -1;
5856 _Py_IDENTIFIER(__contains__); 5856 _Py_IDENTIFIER(__contains__);
5857 5857
5858 func = lookup_maybe(self, &PyId___contains__); 5858 func = lookup_maybe(self, &PyId___contains__);
5859 if (func == Py_None) {
5860 Py_DECREF(func);
5861 PyErr_Format(PyExc_TypeError,
5862 "'%.200s' object is not a container",
5863 Py_TYPE(self)->tp_name);
5864 return -1;
5865 }
5859 if (func != NULL) { 5866 if (func != NULL) {
5860 args = PyTuple_Pack(1, value); 5867 args = PyTuple_Pack(1, value);
5861 if (args == NULL) 5868 if (args == NULL)
5862 res = NULL; 5869 res = NULL;
5863 else { 5870 else {
5864 res = PyObject_Call(func, args, NULL); 5871 res = PyObject_Call(func, args, NULL);
5865 Py_DECREF(args); 5872 Py_DECREF(args);
5866 } 5873 }
5867 Py_DECREF(func); 5874 Py_DECREF(func);
5868 if (res != NULL) { 5875 if (res != NULL) {
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
6234 return res; 6241 return res;
6235 } 6242 }
6236 6243
6237 static PyObject * 6244 static PyObject *
6238 slot_tp_iter(PyObject *self) 6245 slot_tp_iter(PyObject *self)
6239 { 6246 {
6240 PyObject *func, *res; 6247 PyObject *func, *res;
6241 _Py_IDENTIFIER(__iter__); 6248 _Py_IDENTIFIER(__iter__);
6242 6249
6243 func = lookup_method(self, &PyId___iter__); 6250 func = lookup_method(self, &PyId___iter__);
6251 if (func == Py_None) {
6252 Py_DECREF(func);
6253 PyErr_Format(PyExc_TypeError,
6254 "'%.200s' object is not iterable",
6255 Py_TYPE(self)->tp_name);
6256 return NULL;
6257 }
6244 if (func != NULL) { 6258 if (func != NULL) {
6245 PyObject *args; 6259 PyObject *args;
6246 args = res = PyTuple_New(0); 6260 args = res = PyTuple_New(0);
6247 if (args != NULL) { 6261 if (args != NULL) {
6248 res = PyObject_Call(func, args, NULL); 6262 res = PyObject_Call(func, args, NULL);
6249 Py_DECREF(args); 6263 Py_DECREF(args);
6250 } 6264 }
6251 Py_DECREF(func); 6265 Py_DECREF(func);
6252 return res; 6266 return res;
6253 } 6267 }
(...skipping 1256 matching lines...) Expand 10 before | Expand all | Expand 10 after
7510 0, /* tp_base */ 7524 0, /* tp_base */
7511 0, /* tp_dict */ 7525 0, /* tp_dict */
7512 super_descr_get, /* tp_descr_get */ 7526 super_descr_get, /* tp_descr_get */
7513 0, /* tp_descr_set */ 7527 0, /* tp_descr_set */
7514 0, /* tp_dictoffset */ 7528 0, /* tp_dictoffset */
7515 super_init, /* tp_init */ 7529 super_init, /* tp_init */
7516 PyType_GenericAlloc, /* tp_alloc */ 7530 PyType_GenericAlloc, /* tp_alloc */
7517 PyType_GenericNew, /* tp_new */ 7531 PyType_GenericNew, /* tp_new */
7518 PyObject_GC_Del, /* tp_free */ 7532 PyObject_GC_Del, /* tp_free */
7519 }; 7533 };
OLDNEW
« no previous file with comments | « Objects/enumobject.c ('k') | no next file » | no next file with comments »

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