Feature Requests item #1654367, was opened at 2007-02-07 17:12 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1654367&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: Python Interpreter Core Group: Python 2.6 Status: Open Resolution: None Priority: 5 Private: No Submitted By: Fabio Zadrozny (fabioz) Assigned to: Nobody/Anonymous (nobody) Summary: [PATCH] Debuggers need a way to change the locals of a frame Initial Comment: Debuggers need a way to change the local variables in a given frame... currently, this works only if this change is done in the topmost frame (and under certain circumstances), but it should work for any frame. Initial discussion at: http://mail.python.org/pipermail/python-dev/2007-February/070884.html Apparently, the problem is the order in which PyFrame_LocalsToFast / PyFrame_FastToLocals is called. The proposed solution to this is having a savelocals() method in the frame object and have it reflect the changes in its returned dict into its locals. It will simply enable users to call PyFrame_LocalsToFast externally after a change, to be sure that it will not be changed (and it must be done before another call to PyFrame_LocalsToFast -- which I don't see as a large problem, because it is of restrict use -- mainly for debuggers). --------- frameobject.c Patch part 1: ----------------- static PyObject * PyFrame_SaveLocals(PyFrameObject *f) { PyFrame_LocalsToFast(f, 0); Py_INCREF(Py_None); return Py_None; } static PyMethodDef frame_methodlist[] = { {"savelocals", (PyCFunction)PyFrame_SaveLocals, METH_NOARGS, "After a change in f_locals, this method should be called to save the changes internally." }, {NULL} /* Sentinel */ }; ---------- frameobject.c Patch part 2: --------------- Add to PyTypeObject PyFrame_Type: frame_methodlist,/* tp_methods */ ------------------ end patch ------------------------- I'm sorry that this is not in an actual patch format... but as I didn't get it from the cvs, it is easier for me to explain it (as it is a rather small patch). Attached is a test-case for this patch. Thanks, Fabio ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1654367&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com