Serhiy Storchaka added the comment:

The change to dict_equal() LGTM. It doesn't add an overhead.

For dictiter_iternextitem() I propose other change. It doesn't add an overhead.

There are bugs in the patch for _PyDict_FromKeys().

The change to dictitems_contains() adds an overhead, but it is small and seems 
unavoidable.

I wondering whether it is worth to use PySequence_Tuple() instead of 
PySequence_Fast() in PyDict_MergeFromSeq2(). This would add a cost of creating 
new tuple if items are not tuples, but save increfing/decrefing the key and the 
value in common case.

I have doubts about insertdict(). Additional incref duplicates increfs in 
dict_merge(). Is it worth to move it outside of insertdict()?

I have doubts about _PyDict_FromKeys(). It seems to me that it is safe to use 
_PyDict_Next() in a loop that mutates the dict (not checked _PySet_Next()). 
With guarded insertdict() additional check is not needed (and it doesn't help 
against clearing the dict inside insertdict()).

In updated patch fixed some bugs and used different solution for 
dictiter_iternextitem().

----------
Added file: http://bugs.python.org/file45550/27945-dict-segv-py37-2.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue27945>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to