[Python-Dev] PyDict_SetItem hook

John Ehresman jpe at wingware.com
Thu Apr 2 01:29:20 CEST 2009


I've written a proof of concept patch to add a hook to PyDict_SetItem at 
 http://bugs.python.org/issue5654 My motivation is to enable 
watchpoints in a python debugger that are called when an attribute or 
global changes. I know that this won't cover function locals and 
objects with slots (as Martin pointed out).
We talked about this at the sprints and a few issues came up:
* Is this worth it for debugger watchpoint support? This is a feature 
that probably wouldn't be used regularly but is extremely useful in some 
situations.
* Would it be better to create a namespace dict subclass of dict, use it 
for modules, classes, & instances, and only allow watches of the 
subclass instances?
* To what extent should non-debugger code use the hook? At one end of 
the spectrum, the hook could be made readily available for non-debug use 
and at the other end, it could be documented as being debug only, 
disabled in python -O, & not exposed in the stdlib to python code.
John


More information about the Python-Dev mailing list

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