msg187406 - (view) |
Author: Ned Batchelder (nedbat) *  |
Date: 2013-04-20 03:36 |
Looking into this Stack Overflow question: http://stackoverflow.com/questions/16115027/pythons-sys-settrace-wont-create-c-call-events Reading the code in c_eval.c and friends, it looks like "c_call" events are never passed to the trace function, only to the profile function. The docs are wrong and should be fixed. The setprofile docs simply point to settrace for details, so the text needs to accommodate both functions' needs. |
|
|
msg228143 - (view) |
Author: Mark Lawrence (BreamoreBoy) * |
Date: 2014-10-02 00:21 |
@Ned can you provide a patch for this? |
|
|
msg309797 - (view) |
Author: Xiang Zhang (xiang.zhang) *  |
Date: 2018-01-11 09:10 |
Is there any reason not to respond to "c_call" events in trace function? |
|
|
msg310383 - (view) |
Author: Guido van Rossum (gvanrossum) *  |
Date: 2018-01-21 21:01 |
The reason not to pass C calls to the tracing function is that tracing exists to support pdb and other debuggers, and pdb only cares about tracing through Python code. So the docs should be updated. |
|
|
msg310393 - (view) |
Author: Xiang Zhang (xiang.zhang) *  |
Date: 2018-01-22 03:06 |
Hi Guido. Looking at the implementation, it seems pdb ignores c_call not by relying on the interpreter, but bdb takes no action when encountering C events. Yeah, even bdb wrongly expects C events will be triggered for settrace. [1] And what if some debuggers want not only to trace Python events but also C events, then it has to mix the power of trace and profile but can't only rely on trace. [1] https://github.com/python/cpython/blob/master/Lib/bdb.py#L59 |
|
|
msg310396 - (view) |
Author: Guido van Rossum (gvanrossum) *  |
Date: 2018-01-22 06:03 |
Too bad, it's been like this since the feature was first created. It would most likely break other code that uses the tracing hooks, so you'd have to propose it as a new feature. |
|
|
msg310587 - (view) |
Author: Xiang Zhang (xiang.zhang) *  |
Date: 2018-01-24 12:57 |
New changeset 131fd7f96c619bc7eaea956e45c6337175f4b27f by Xiang Zhang (Pablo Galindo) in branch 'master': bpo-17799: Explain real behaviour of sys.settrace and sys.setprofile (#4056) https://github.com/python/cpython/commit/131fd7f96c619bc7eaea956e45c6337175f4b27f |
|
|
msg310598 - (view) |
Author: Xiang Zhang (xiang.zhang) *  |
Date: 2018-01-24 14:44 |
New changeset fd844efa9c31e1f00e04b07940875b9dacff3d77 by Xiang Zhang in branch '3.6': bpo-17799: Explain real behaviour of sys.settrace and sys.setprofile (GH-4056) (#5298) https://github.com/python/cpython/commit/fd844efa9c31e1f00e04b07940875b9dacff3d77 |
|
|
msg310599 - (view) |
Author: Xiang Zhang (xiang.zhang) *  |
Date: 2018-01-24 14:53 |
New changeset e64a47b37d0c592fd162b2f51e79ecfd046b45ec by Xiang Zhang in branch '2.7': bpo-17799: Explain real behaviour of sys.settrace and sys.setprofile (GH-4056). (#5299) https://github.com/python/cpython/commit/e64a47b37d0c592fd162b2f51e79ecfd046b45ec |
|
|