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

Side by Side Diff: Objects/descrobject.c

Issue 29259: Add tp_fastcall to PyTypeObject: support FASTCALL calling convention for all callable objects
Patch Set: Created 2 years, 12 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/classobject.c ('k') | Objects/funcobject.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* Descriptors -- a new, flexible way to describe attributes */ 1 /* Descriptors -- a new, flexible way to describe attributes */
2 2
3 #include "Python.h" 3 #include "Python.h"
4 #include "structmember.h" /* Why is this not included in Python.h? */ 4 #include "structmember.h" /* Why is this not included in Python.h? */
5 5
6 static void 6 static void
7 descr_dealloc(PyDescrObject *descr) 7 descr_dealloc(PyDescrObject *descr)
8 { 8 {
9 _PyObject_GC_UNTRACK(descr); 9 _PyObject_GC_UNTRACK(descr);
10 Py_XDECREF(descr->d_type); 10 Py_XDECREF(descr->d_type);
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 return descr->d_getset->set(obj, value, 203 return descr->d_getset->set(obj, value,
204 descr->d_getset->closure); 204 descr->d_getset->closure);
205 PyErr_Format(PyExc_AttributeError, 205 PyErr_Format(PyExc_AttributeError,
206 "attribute '%V' of '%.100s' objects is not writable", 206 "attribute '%V' of '%.100s' objects is not writable",
207 descr_name((PyDescrObject *)descr), "?", 207 descr_name((PyDescrObject *)descr), "?",
208 PyDescr_TYPE(descr)->tp_name); 208 PyDescr_TYPE(descr)->tp_name);
209 return -1; 209 return -1;
210 } 210 }
211 211
212 static PyObject * 212 static PyObject *
213 methoddescr_call(PyMethodDescrObject *descr, PyObject *args, PyObject *kwargs) 213 methoddescr_call(PyMethodDescrObject *descr, PyObject **args, Py_ssize_t nargs,
214 PyObject *kwnames)
214 { 215 {
215 Py_ssize_t nargs;
216 PyObject *self, *result; 216 PyObject *self, *result;
217 217
218 /* Make sure that the first argument is acceptable as 'self' */ 218 /* Make sure that the first argument is acceptable as 'self' */
219 assert(PyTuple_Check(args));
220 nargs = PyTuple_GET_SIZE(args);
221 if (nargs < 1) { 219 if (nargs < 1) {
222 PyErr_Format(PyExc_TypeError, 220 PyErr_Format(PyExc_TypeError,
223 "descriptor '%V' of '%.100s' " 221 "descriptor '%V' of '%.100s' "
224 "object needs an argument", 222 "object needs an argument",
225 descr_name((PyDescrObject *)descr), "?", 223 descr_name((PyDescrObject *)descr), "?",
226 PyDescr_TYPE(descr)->tp_name); 224 PyDescr_TYPE(descr)->tp_name);
227 return NULL; 225 return NULL;
228 } 226 }
229 self = PyTuple_GET_ITEM(args, 0); 227 self = args[0];
230 if (!_PyObject_RealIsSubclass((PyObject *)Py_TYPE(self), 228 if (!_PyObject_RealIsSubclass((PyObject *)Py_TYPE(self),
231 (PyObject *)PyDescr_TYPE(descr))) { 229 (PyObject *)PyDescr_TYPE(descr))) {
232 PyErr_Format(PyExc_TypeError, 230 PyErr_Format(PyExc_TypeError,
233 "descriptor '%V' " 231 "descriptor '%V' "
234 "requires a '%.100s' object " 232 "requires a '%.100s' object "
235 "but received a '%.100s'", 233 "but received a '%.100s'",
236 descr_name((PyDescrObject *)descr), "?", 234 descr_name((PyDescrObject *)descr), "?",
237 PyDescr_TYPE(descr)->tp_name, 235 PyDescr_TYPE(descr)->tp_name,
238 self->ob_type->tp_name); 236 self->ob_type->tp_name);
239 return NULL; 237 return NULL;
240 } 238 }
241 239
242 result = _PyMethodDef_RawFastCallDict(descr->d_method, self, 240 result = _PyMethodDef_RawFastCallKeywords(descr->d_method, self,
243 &PyTuple_GET_ITEM(args, 1), nargs - 1, 241 args + 1, nargs - 1,
244 kwargs); 242 kwnames);
245 result = _Py_CheckFunctionResult((PyObject *)descr, result, NULL); 243 result = _Py_CheckFunctionResult((PyObject *)descr, result, NULL);
246 return result; 244 return result;
247 } 245 }
248 246
249 static PyObject * 247 static PyObject *
250 classmethoddescr_call(PyMethodDescrObject *descr, PyObject *args, 248 classmethoddescr_call(PyMethodDescrObject *descr, PyObject **args,
251 PyObject *kwds) 249 Py_ssize_t nargs, PyObject *kwnames)
252 { 250 {
253 Py_ssize_t argc; 251 PyObject *self, *func, *result;
254 PyObject *self, *func, *result, **stack;
255 252
256 /* Make sure that the first argument is acceptable as 'self' */ 253 /* Make sure that the first argument is acceptable as 'self' */
257 assert(PyTuple_Check(args)); 254 if (nargs < 1) {
258 argc = PyTuple_GET_SIZE(args);
259 if (argc < 1) {
260 PyErr_Format(PyExc_TypeError, 255 PyErr_Format(PyExc_TypeError,
261 "descriptor '%V' of '%.100s' " 256 "descriptor '%V' of '%.100s' "
262 "object needs an argument", 257 "object needs an argument",
263 descr_name((PyDescrObject *)descr), "?", 258 descr_name((PyDescrObject *)descr), "?",
264 PyDescr_TYPE(descr)->tp_name); 259 PyDescr_TYPE(descr)->tp_name);
265 return NULL; 260 return NULL;
266 } 261 }
267 self = PyTuple_GET_ITEM(args, 0); 262 self = args[0];
268 if (!PyType_Check(self)) { 263 if (!PyType_Check(self)) {
269 PyErr_Format(PyExc_TypeError, 264 PyErr_Format(PyExc_TypeError,
270 "descriptor '%V' requires a type " 265 "descriptor '%V' requires a type "
271 "but received a '%.100s'", 266 "but received a '%.100s'",
272 descr_name((PyDescrObject *)descr), "?", 267 descr_name((PyDescrObject *)descr), "?",
273 PyDescr_TYPE(descr)->tp_name, 268 PyDescr_TYPE(descr)->tp_name,
274 self->ob_type->tp_name); 269 self->ob_type->tp_name);
275 return NULL; 270 return NULL;
276 } 271 }
277 if (!PyType_IsSubtype((PyTypeObject *)self, PyDescr_TYPE(descr))) { 272 if (!PyType_IsSubtype((PyTypeObject *)self, PyDescr_TYPE(descr))) {
278 PyErr_Format(PyExc_TypeError, 273 PyErr_Format(PyExc_TypeError,
279 "descriptor '%V' " 274 "descriptor '%V' "
280 "requires a subtype of '%.100s' " 275 "requires a subtype of '%.100s' "
281 "but received '%.100s", 276 "but received '%.100s",
282 descr_name((PyDescrObject *)descr), "?", 277 descr_name((PyDescrObject *)descr), "?",
283 PyDescr_TYPE(descr)->tp_name, 278 PyDescr_TYPE(descr)->tp_name,
284 self->ob_type->tp_name); 279 self->ob_type->tp_name);
285 return NULL; 280 return NULL;
286 } 281 }
287 282
288 func = PyCFunction_NewEx(descr->d_method, self, NULL); 283 func = PyCFunction_NewEx(descr->d_method, self, NULL);
289 if (func == NULL) 284 if (func == NULL)
290 return NULL; 285 return NULL;
291 stack = &PyTuple_GET_ITEM(args, 1); 286 result = _PyObject_FastCallKeywords(func, args + 1, nargs - 1, kwnames);
292 result = _PyObject_FastCallDict(func, stack, argc - 1, kwds);
293 Py_DECREF(func); 287 Py_DECREF(func);
294 return result; 288 return result;
295 } 289 }
296 290
297 static PyObject * 291 static PyObject *
298 wrapperdescr_call(PyWrapperDescrObject *descr, PyObject *args, PyObject *kwds) 292 wrapperdescr_call(PyMethodDescrObject *descr, PyObject **args, Py_ssize_t nargs,
293 PyObject *kwnames)
299 { 294 {
300 Py_ssize_t argc; 295 PyObject *self, *func, *result;
301 PyObject *self, *func, *result, **stack;
302 296
303 /* Make sure that the first argument is acceptable as 'self' */ 297 /* Make sure that the first argument is acceptable as 'self' */
304 assert(PyTuple_Check(args)); 298 if (nargs < 1) {
305 argc = PyTuple_GET_SIZE(args);
306 if (argc < 1) {
307 PyErr_Format(PyExc_TypeError, 299 PyErr_Format(PyExc_TypeError,
308 "descriptor '%V' of '%.100s' " 300 "descriptor '%V' of '%.100s' "
309 "object needs an argument", 301 "object needs an argument",
310 descr_name((PyDescrObject *)descr), "?", 302 descr_name((PyDescrObject *)descr), "?",
311 PyDescr_TYPE(descr)->tp_name); 303 PyDescr_TYPE(descr)->tp_name);
312 return NULL; 304 return NULL;
313 } 305 }
314 self = PyTuple_GET_ITEM(args, 0); 306 self = args[0];
315 if (!_PyObject_RealIsSubclass((PyObject *)Py_TYPE(self), 307 if (!_PyObject_RealIsSubclass((PyObject *)Py_TYPE(self),
316 (PyObject *)PyDescr_TYPE(descr))) { 308 (PyObject *)PyDescr_TYPE(descr))) {
317 PyErr_Format(PyExc_TypeError, 309 PyErr_Format(PyExc_TypeError,
318 "descriptor '%V' " 310 "descriptor '%V' "
319 "requires a '%.100s' object " 311 "requires a '%.100s' object "
320 "but received a '%.100s'", 312 "but received a '%.100s'",
321 descr_name((PyDescrObject *)descr), "?", 313 descr_name((PyDescrObject *)descr), "?",
322 PyDescr_TYPE(descr)->tp_name, 314 PyDescr_TYPE(descr)->tp_name,
323 self->ob_type->tp_name); 315 self->ob_type->tp_name);
324 return NULL; 316 return NULL;
325 } 317 }
326 318
327 func = PyWrapper_New((PyObject *)descr, self); 319 func = PyWrapper_New((PyObject *)descr, self);
328 if (func == NULL) 320 if (func == NULL)
329 return NULL; 321 return NULL;
330 322
331 stack = &PyTuple_GET_ITEM(args, 1); 323 result = _PyObject_FastCallKeywords(func, args + 1, nargs - 1, kwnames);
332 result = _PyObject_FastCallDict(func, stack, argc - 1, kwds);
333 Py_DECREF(func); 324 Py_DECREF(func);
334 return result; 325 return result;
335 } 326 }
336 327
337 static PyObject * 328 static PyObject *
338 method_get_doc(PyMethodDescrObject *descr, void *closure) 329 method_get_doc(PyMethodDescrObject *descr, void *closure)
339 { 330 {
340 return _PyType_GetDocFromInternalDoc(descr->d_method->ml_name, descr->d_meth od->ml_doc); 331 return _PyType_GetDocFromInternalDoc(descr->d_method->ml_name, descr->d_meth od->ml_doc);
341 } 332 }
342 333
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 (destructor)descr_dealloc, /* tp_dealloc */ 473 (destructor)descr_dealloc, /* tp_dealloc */
483 0, /* tp_print */ 474 0, /* tp_print */
484 0, /* tp_getattr */ 475 0, /* tp_getattr */
485 0, /* tp_setattr */ 476 0, /* tp_setattr */
486 0, /* tp_reserved */ 477 0, /* tp_reserved */
487 (reprfunc)method_repr, /* tp_repr */ 478 (reprfunc)method_repr, /* tp_repr */
488 0, /* tp_as_number */ 479 0, /* tp_as_number */
489 0, /* tp_as_sequence */ 480 0, /* tp_as_sequence */
490 0, /* tp_as_mapping */ 481 0, /* tp_as_mapping */
491 0, /* tp_hash */ 482 0, /* tp_hash */
492 (ternaryfunc)methoddescr_call, /* tp_call */ 483 0, /* tp_call */
493 0, /* tp_str */ 484 0, /* tp_str */
494 PyObject_GenericGetAttr, /* tp_getattro */ 485 PyObject_GenericGetAttr, /* tp_getattro */
495 0, /* tp_setattro */ 486 0, /* tp_setattro */
496 0, /* tp_as_buffer */ 487 0, /* tp_as_buffer */
497 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */ 488 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */
498 0, /* tp_doc */ 489 0, /* tp_doc */
499 descr_traverse, /* tp_traverse */ 490 descr_traverse, /* tp_traverse */
500 0, /* tp_clear */ 491 0, /* tp_clear */
501 0, /* tp_richcompare */ 492 0, /* tp_richcompare */
502 0, /* tp_weaklistoffset */ 493 0, /* tp_weaklistoffset */
503 0, /* tp_iter */ 494 0, /* tp_iter */
504 0, /* tp_iternext */ 495 0, /* tp_iternext */
505 descr_methods, /* tp_methods */ 496 descr_methods, /* tp_methods */
506 descr_members, /* tp_members */ 497 descr_members, /* tp_members */
507 method_getset, /* tp_getset */ 498 method_getset, /* tp_getset */
508 0, /* tp_base */ 499 0, /* tp_base */
509 0, /* tp_dict */ 500 0, /* tp_dict */
510 (descrgetfunc)method_get, /* tp_descr_get */ 501 (descrgetfunc)method_get, /* tp_descr_get */
511 0, /* tp_descr_set */ 502
503 .tp_fastcall = (fastternaryfunc)methoddescr_call,
512 }; 504 };
513 505
514 /* This is for METH_CLASS in C, not for "f = classmethod(f)" in Python! */ 506 /* This is for METH_CLASS in C, not for "f = classmethod(f)" in Python! */
515 PyTypeObject PyClassMethodDescr_Type = { 507 PyTypeObject PyClassMethodDescr_Type = {
516 PyVarObject_HEAD_INIT(&PyType_Type, 0) 508 PyVarObject_HEAD_INIT(&PyType_Type, 0)
517 "classmethod_descriptor", 509 "classmethod_descriptor",
518 sizeof(PyMethodDescrObject), 510 sizeof(PyMethodDescrObject),
519 0, 511 0,
520 (destructor)descr_dealloc, /* tp_dealloc */ 512 (destructor)descr_dealloc, /* tp_dealloc */
521 0, /* tp_print */ 513 0, /* tp_print */
522 0, /* tp_getattr */ 514 0, /* tp_getattr */
523 0, /* tp_setattr */ 515 0, /* tp_setattr */
524 0, /* tp_reserved */ 516 0, /* tp_reserved */
525 (reprfunc)method_repr, /* tp_repr */ 517 (reprfunc)method_repr, /* tp_repr */
526 0, /* tp_as_number */ 518 0, /* tp_as_number */
527 0, /* tp_as_sequence */ 519 0, /* tp_as_sequence */
528 0, /* tp_as_mapping */ 520 0, /* tp_as_mapping */
529 0, /* tp_hash */ 521 0, /* tp_hash */
530 (ternaryfunc)classmethoddescr_call, /* tp_call */ 522 0, /* tp_call */
531 0, /* tp_str */ 523 0, /* tp_str */
532 PyObject_GenericGetAttr, /* tp_getattro */ 524 PyObject_GenericGetAttr, /* tp_getattro */
533 0, /* tp_setattro */ 525 0, /* tp_setattro */
534 0, /* tp_as_buffer */ 526 0, /* tp_as_buffer */
535 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */ 527 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC
528 | Py_TPFLAGS_HAVE_FASTCALL, /* tp_flags */
inada.naoki 2017/01/20 05:23:39 PyMethodDescr_Type didn't change tp_flags. Consist
haypo 2017/01/20 09:08:40 Oh, I forgot to revert this change after I added F
536 0, /* tp_doc */ 529 0, /* tp_doc */
537 descr_traverse, /* tp_traverse */ 530 descr_traverse, /* tp_traverse */
538 0, /* tp_clear */ 531 0, /* tp_clear */
539 0, /* tp_richcompare */ 532 0, /* tp_richcompare */
540 0, /* tp_weaklistoffset */ 533 0, /* tp_weaklistoffset */
541 0, /* tp_iter */ 534 0, /* tp_iter */
542 0, /* tp_iternext */ 535 0, /* tp_iternext */
543 descr_methods, /* tp_methods */ 536 descr_methods, /* tp_methods */
544 descr_members, /* tp_members */ 537 descr_members, /* tp_members */
545 method_getset, /* tp_getset */ 538 method_getset, /* tp_getset */
546 0, /* tp_base */ 539 0, /* tp_base */
547 0, /* tp_dict */ 540 0, /* tp_dict */
548 (descrgetfunc)classmethod_get, /* tp_descr_get */ 541 (descrgetfunc)classmethod_get, /* tp_descr_get */
549 0, /* tp_descr_set */ 542
543 .tp_fastcall = (fastternaryfunc)classmethoddescr_call,
550 }; 544 };
551 545
552 PyTypeObject PyMemberDescr_Type = { 546 PyTypeObject PyMemberDescr_Type = {
553 PyVarObject_HEAD_INIT(&PyType_Type, 0) 547 PyVarObject_HEAD_INIT(&PyType_Type, 0)
554 "member_descriptor", 548 "member_descriptor",
555 sizeof(PyMemberDescrObject), 549 sizeof(PyMemberDescrObject),
556 0, 550 0,
557 (destructor)descr_dealloc, /* tp_dealloc */ 551 (destructor)descr_dealloc, /* tp_dealloc */
558 0, /* tp_print */ 552 0, /* tp_print */
559 0, /* tp_getattr */ 553 0, /* tp_getattr */
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 (destructor)descr_dealloc, /* tp_dealloc */ 625 (destructor)descr_dealloc, /* tp_dealloc */
632 0, /* tp_print */ 626 0, /* tp_print */
633 0, /* tp_getattr */ 627 0, /* tp_getattr */
634 0, /* tp_setattr */ 628 0, /* tp_setattr */
635 0, /* tp_reserved */ 629 0, /* tp_reserved */
636 (reprfunc)wrapperdescr_repr, /* tp_repr */ 630 (reprfunc)wrapperdescr_repr, /* tp_repr */
637 0, /* tp_as_number */ 631 0, /* tp_as_number */
638 0, /* tp_as_sequence */ 632 0, /* tp_as_sequence */
639 0, /* tp_as_mapping */ 633 0, /* tp_as_mapping */
640 0, /* tp_hash */ 634 0, /* tp_hash */
641 (ternaryfunc)wrapperdescr_call, /* tp_call */ 635 0, /* tp_call */
642 0, /* tp_str */ 636 0, /* tp_str */
643 PyObject_GenericGetAttr, /* tp_getattro */ 637 PyObject_GenericGetAttr, /* tp_getattro */
644 0, /* tp_setattro */ 638 0, /* tp_setattro */
645 0, /* tp_as_buffer */ 639 0, /* tp_as_buffer */
646 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */ 640 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */
647 0, /* tp_doc */ 641 0, /* tp_doc */
648 descr_traverse, /* tp_traverse */ 642 descr_traverse, /* tp_traverse */
649 0, /* tp_clear */ 643 0, /* tp_clear */
650 0, /* tp_richcompare */ 644 0, /* tp_richcompare */
651 0, /* tp_weaklistoffset */ 645 0, /* tp_weaklistoffset */
652 0, /* tp_iter */ 646 0, /* tp_iter */
653 0, /* tp_iternext */ 647 0, /* tp_iternext */
654 descr_methods, /* tp_methods */ 648 descr_methods, /* tp_methods */
655 descr_members, /* tp_members */ 649 descr_members, /* tp_members */
656 wrapperdescr_getset, /* tp_getset */ 650 wrapperdescr_getset, /* tp_getset */
657 0, /* tp_base */ 651 0, /* tp_base */
658 0, /* tp_dict */ 652 0, /* tp_dict */
659 (descrgetfunc)wrapperdescr_get, /* tp_descr_get */ 653 (descrgetfunc)wrapperdescr_get, /* tp_descr_get */
660 0, /* tp_descr_set */ 654
655 .tp_fastcall = (fastternaryfunc)wrapperdescr_call,
661 }; 656 };
662 657
663 static PyDescrObject * 658 static PyDescrObject *
664 descr_new(PyTypeObject *descrtype, PyTypeObject *type, const char *name) 659 descr_new(PyTypeObject *descrtype, PyTypeObject *type, const char *name)
665 { 660 {
666 PyDescrObject *descr; 661 PyDescrObject *descr;
667 662
668 descr = (PyDescrObject *)PyType_GenericAlloc(descrtype, 0); 663 descr = (PyDescrObject *)PyType_GenericAlloc(descrtype, 0);
669 if (descr != NULL) { 664 if (descr != NULL) {
670 Py_XINCREF(type); 665 Py_XINCREF(type);
(...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after
1350 Py_XDECREF(gs->prop_get); 1345 Py_XDECREF(gs->prop_get);
1351 Py_XDECREF(gs->prop_set); 1346 Py_XDECREF(gs->prop_set);
1352 Py_XDECREF(gs->prop_del); 1347 Py_XDECREF(gs->prop_del);
1353 Py_XDECREF(gs->prop_doc); 1348 Py_XDECREF(gs->prop_doc);
1354 self->ob_type->tp_free(self); 1349 self->ob_type->tp_free(self);
1355 } 1350 }
1356 1351
1357 static PyObject * 1352 static PyObject *
1358 property_descr_get(PyObject *self, PyObject *obj, PyObject *type) 1353 property_descr_get(PyObject *self, PyObject *obj, PyObject *type)
1359 { 1354 {
1360 static PyObject * volatile cached_args = NULL;
1361 PyObject *args;
1362 PyObject *ret;
1363 propertyobject *gs = (propertyobject *)self; 1355 propertyobject *gs = (propertyobject *)self;
1356 PyObject *args[1];
1364 1357
1365 if (obj == NULL || obj == Py_None) { 1358 if (obj == NULL || obj == Py_None) {
1366 Py_INCREF(self); 1359 Py_INCREF(self);
1367 return self; 1360 return self;
1368 } 1361 }
1369 if (gs->prop_get == NULL) { 1362 if (gs->prop_get == NULL) {
1370 PyErr_SetString(PyExc_AttributeError, "unreadable attribute"); 1363 PyErr_SetString(PyExc_AttributeError, "unreadable attribute");
1371 return NULL; 1364 return NULL;
1372 } 1365 }
1373 args = cached_args; 1366
1374 cached_args = NULL; 1367 args[0] = obj;
1375 if (!args) { 1368 return _PyObject_FastCall(gs->prop_get, args, 1);
1376 args = PyTuple_New(1);
1377 if (!args)
1378 return NULL;
1379 _PyObject_GC_UNTRACK(args);
1380 }
1381 Py_INCREF(obj);
1382 PyTuple_SET_ITEM(args, 0, obj);
1383 ret = PyObject_Call(gs->prop_get, args, NULL);
1384 if (cached_args == NULL && Py_REFCNT(args) == 1) {
1385 assert(Py_SIZE(args) == 1);
1386 assert(PyTuple_GET_ITEM(args, 0) == obj);
1387 cached_args = args;
1388 Py_DECREF(obj);
1389 }
1390 else {
1391 assert(Py_REFCNT(args) >= 1);
1392 _PyObject_GC_TRACK(args);
1393 Py_DECREF(args);
1394 }
1395 return ret;
1396 } 1369 }
1397 1370
1398 static int 1371 static int
1399 property_descr_set(PyObject *self, PyObject *obj, PyObject *value) 1372 property_descr_set(PyObject *self, PyObject *obj, PyObject *value)
1400 { 1373 {
1401 propertyobject *gs = (propertyobject *)self; 1374 propertyobject *gs = (propertyobject *)self;
1402 PyObject *func, *res; 1375 PyObject *func, *res;
1403 1376
1404 if (value == NULL) 1377 if (value == NULL)
1405 func = gs->prop_del; 1378 func = gs->prop_del;
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
1637 0, /* tp_base */ 1610 0, /* tp_base */
1638 0, /* tp_dict */ 1611 0, /* tp_dict */
1639 property_descr_get, /* tp_descr_get */ 1612 property_descr_get, /* tp_descr_get */
1640 property_descr_set, /* tp_descr_set */ 1613 property_descr_set, /* tp_descr_set */
1641 0, /* tp_dictoffset */ 1614 0, /* tp_dictoffset */
1642 property_init, /* tp_init */ 1615 property_init, /* tp_init */
1643 PyType_GenericAlloc, /* tp_alloc */ 1616 PyType_GenericAlloc, /* tp_alloc */
1644 PyType_GenericNew, /* tp_new */ 1617 PyType_GenericNew, /* tp_new */
1645 PyObject_GC_Del, /* tp_free */ 1618 PyObject_GC_Del, /* tp_free */
1646 }; 1619 };
OLDNEW
« no previous file with comments | « Objects/classobject.c ('k') | Objects/funcobject.c » ('j') | no next file with comments »

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