Message283204
Ignore my previous comment, PyDict_GET_SIZE-3.patch LGTM.
> I don't think the changes in _datetimemodule.c and typeobject.c change the behavior.
Oh wait, it seems like I misunderstood the new code.
Modules/_datetimemodule.c:
dictptr = _PyObject_GetDictPtr(self);
- if (dictptr && *dictptr && PyDict_Size(*dictptr)) {
+ if (dictptr && *dictptr &&
+ (!PyDict_Check(*dictptr) || PyDict_GET_SIZE(*dictptr))) {
state = *dictptr;
If *dictptr is set and is not a dict, the test is true for the old and new code. Hum, I misunderstood the new code: I understood that (!PyDict_Check(*dictptr) || PyDict_GET_SIZE(*dictptr)) is false is *dictptr is not a dict, but it's true.
Hum, the only difference is that the old code raises an exception (SystemError), the new code doesn't raise an exception.
Since I'm not able to create an object with a __dict__ attribute which is not a dict, I don't really case of the small behaviour change. |
|
Date |
User |
Action |
Args |
2016-12-14 16:08:41 | vstinner | set | recipients:
+ vstinner, rhettinger, methane, serhiy.storchaka |
2016-12-14 16:08:41 | vstinner | set | messageid: <1481731721.37.0.860145955607.issue28959@psf.upfronthosting.co.za> |
2016-12-14 16:08:41 | vstinner | link | issue28959 messages |
2016-12-14 16:08:41 | vstinner | create | |
|