Raymond Hettinger <raymond.hettin...@gmail.com> added the comment:

One thing that could be done is to have an optional warning in the mutating 
concrete C API functions that gets triggered whenever the input doesn't have an 
exact type match.  That will let people discover incorrect uses.

We could also scour our own stdlib code to see if there are any cases where 
there needs to be an alternate code patch for subclasses of builtin types.

I did a scan for PyList_SetItem and found that we were already pretty good 
about only using it when the target was known to be an exact list. Though those 
results were good, I'm not hopeful for a similar result with PyDict_SetItem.

In the mean time this bug will preclude a C version of OrderedDict from being a 
dict subclass.  That's unfortunate because it means that the C version can't be 
a drop-in replacement for the existing pure python OrderedDict.

----------

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

Reply via email to