homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author belopolsky
Recipients arigo, belopolsky, christian.heimes, dalke, loewis, rhettinger, tds333
Date 2008年02月23日.23:22:36
SpamBayes Score 0.010943393
Marked as misclassified No
Message-id <1203808957.13.0.838512077061.issue1367711@psf.upfronthosting.co.za>
In-reply-to
Content
I would say dict's failure to call overloaded __setitem__ from 
setdefault is a dict implementation problem which should be either 
fixed, or clearly documented as warning to anyone who wants to derive 
from dict.
A fix would be trivial:
===================================================================
--- Objects/dictobject.c (revision 61014)
+++ Objects/dictobject.c (working copy)
@@ -1861,7 +1861,7 @@
 val = ep->me_value;
 if (val == NULL) {
 val = failobj;
- if (PyDict_SetItem((PyObject*)mp, key, failobj))
+ if (PyObject_SetItem(mp, key, failobj))
 val = NULL;
 }
 Py_XINCREF(val);
but I have no clue what performance or other implications would be.
Maybe something like this could be considered for Py3k - reviewing dict 
implementation to make it usable as DictMixin. I'll write a complete 
patch if there is positive reaction.
History
Date User Action Args
2008年02月23日 23:22:37belopolskysetspambayes_score: 0.0109434 -> 0.010943393
recipients: + belopolsky, loewis, arigo, rhettinger, dalke, tds333, christian.heimes
2008年02月23日 23:22:37belopolskysetspambayes_score: 0.0109434 -> 0.0109434
messageid: <1203808957.13.0.838512077061.issue1367711@psf.upfronthosting.co.za>
2008年02月23日 23:22:36belopolskylinkissue1367711 messages
2008年02月23日 23:22:36belopolskycreate

AltStyle によって変換されたページ (->オリジナル) /