Message321128
This isn't a real reference bug, but rather a bug in total refs accountability. It seems that I missed the fact that we track refs to the keys table with a DK_INCREF macro.
The new `clone_combined_dict` uses `memcpy` to clone the keys table (along with its `dk_refcnt` field, but it doesn't register the fact that we have a new keys table after copying. The bug can be solved with the following diff:
diff --git a/Objects/dictobject.c b/Objects/dictobject.c
index 7a1bcebec6..3ac6a54415 100644
--- a/Objects/dictobject.c
+++ b/Objects/dictobject.c
@@ -656,6 +656,7 @@ clone_combined_dict(PyDictObject *orig)
/* Maintain tracking. */
_PyObject_GC_TRACK(new);
}
+ _Py_INC_REFTOTAL;
return (PyObject *)new;
}
I don't think this is a critical-level bug that needs an emergency 3.7.1 release, but I'll submit a PR right now. Would appreciate if you guys can review it. |
|
Date |
User |
Action |
Args |
2018-07-05 19:43:52 | yselivanov | set | recipients:
+ yselivanov, pitrou, vstinner, kayhayen, serhiy.storchaka, pablogsal |
2018-07-05 19:43:52 | yselivanov | set | messageid: <1530819832.91.0.56676864532.issue34042@psf.upfronthosting.co.za> |
2018-07-05 19:43:52 | yselivanov | link | issue34042 messages |
2018-07-05 19:43:52 | yselivanov | create | |
|