Message120006
Some comments about the patch:
- this seems to be some dead code:
if (nattrs <= 1) {
if (!PyArg_UnpackTuple(args, "attrgetter", 1, 1, &attr))
return NULL;
- you can't call PyUnicode_GET_SIZE or PyUnicode_AS_UNICODE before you have called PyUnicode_Check. If the object is not an unicode object, it triggers an assertion in debug mode:
python: ./Modules/operator.c:404: attrgetter_new: Assertion `((((((PyObject*)(item))->ob_type))->tp_flags & ((1L<<28))) != 0)' failed.
- you should also call PyUnicode_InternInPlace() on the last dotless name (after the for loop)
- this comment looks false:
/* attrgetter_new code should ensure we never come here */
- in dotted_getattr, when attr is a tuple, you leak references to intermediate objects (because you don't decref obj before doing "newobj = obj")
Other than that, looks quite worthwhile. |
|
Date |
User |
Action |
Args |
2010-10-30 18:11:06 | pitrou | set | recipients:
+ pitrou, rhettinger, terry.reedy, tzot, alex |
2010-10-30 18:11:05 | pitrou | set | messageid: <1288462265.89.0.0378422153394.issue10160@psf.upfronthosting.co.za> |
2010-10-30 18:11:04 | pitrou | link | issue10160 messages |
2010-10-30 18:11:04 | pitrou | create | |
|