Patches item #1433928, was opened at 2006-02-17 19:19 Message generated for change (Comment added) made by gvanrossum You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1433928&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Core (C code) Group: Python 2.5 Status: Open Resolution: None Priority: 1 Submitted By: Guido van Rossum (gvanrossum) Assigned to: Guido van Rossum (gvanrossum) Summary: add on_missing() and default_factory to dict Initial Comment: See the thread starting at http://mail.python.org/pipermail/python-dev/2006-February/061261.html This still needs unit tests and docs. ---------------------------------------------------------------------- >Comment By: Guido van Rossum (gvanrossum) Date: 2006-02-19 14:00 Message: Logged In: YES user_id=6380 Sorry, forgot the upload. Here it is. ---------------------------------------------------------------------- Comment By: Guido van Rossum (gvanrossum) Date: 2006-02-19 13:57 Message: Logged In: YES user_id=6380 Aha. I'll have to try that. In the mean time, here's a new patch: - PyDict_GetItem is no longer involved - added {NULL} to PyMemberDef array - set ma_default_factory to NULL in both constructors Still no unit tests or docs. I have some misgivings about the API -- perhaps this should be a subclass. ---------------------------------------------------------------------- Comment By: Georg Brandl (birkenfeld) Date: 2006-02-19 10:39 Message: Logged In: YES user_id=1188172 Okay. I configured with "--with-pydebug" all the time, and then comes the segfault. Without "--with-pydebug", everything seems fine. ---------------------------------------------------------------------- Comment By: Guido van Rossum (gvanrossum) Date: 2006-02-19 10:28 Message: Logged In: YES user_id=6380 Are you sure you did a "make clean"? Because the dictobject struct lay-out is changed you may have to do that. If the problem persists, try adding setting ma_default_factory to NULL explicitly in dict_new (like it's already done in PyDict_New) and see if that makes a difference. BTW the change to PyDict_GetItem must be removed -- it's not a good idea. ---------------------------------------------------------------------- Comment By: Georg Brandl (birkenfeld) Date: 2006-02-18 05:39 Message: Logged In: YES user_id=1188172 Observations: * Doesn't the PyMemberDef need a sentinel? * Is PyObject_CallObject() faster than PyEval_CallFunction() with no arguments present? * The current patch gives me a segfault at interpreter exit because there is a dict object whose ma_default_factory was not initialized to NULL. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1433928&group_id=5470 _______________________________________________ Patches mailing list [email protected] http://mail.python.org/mailman/listinfo/patches
