[issue17799] settrace docs are wrong about "c_call" events
New submission from Ned Batchelder: Looking into this Stack Overflow question: http://stackoverflow.com/questions/16115027/pythons-sys-settrace-wont-create... 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. ---------- assignee: docs@python components: Documentation messages: 187406 nosy: docs@python, nedbat priority: low severity: normal status: open title: settrace docs are wrong about "c_call" events versions: Python 2.7, Python 3.3 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue17799> _______________________________________
Mark Lawrence added the comment: @Ned can you provide a patch for this? ---------- nosy: +BreamoreBoy type: -> behavior versions: +Python 3.4, Python 3.5 -Python 3.3 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue17799> _______________________________________
Changes by Maries Ionel Cristian <ionel.mc@gmail.com>: ---------- nosy: +ionel.mc _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue17799> _______________________________________
Change by raylu <lurayl@gmail.com>: ---------- nosy: +raylu _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue17799> _______________________________________
Change by Pablo Galindo Salgado <pablogsal@gmail.com>: ---------- keywords: +patch pull_requests: +4025 stage: -> patch review _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue17799> _______________________________________
Xiang Zhang <angwerzx@126.com> added the comment: Is there any reason not to respond to "c_call" events in trace function? ---------- nosy: +xiang.zhang _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue17799> _______________________________________
Change by Mark Lawrence <breamoreboy@gmail.com>: ---------- nosy: -BreamoreBoy _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue17799> _______________________________________
Guido van Rossum <guido@python.org> added the comment: 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. ---------- nosy: +gvanrossum _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue17799> _______________________________________
Xiang Zhang <angwerzx@126.com> added the comment: 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 ---------- versions: +Python 3.6, Python 3.7 -Python 3.4, Python 3.5 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue17799> _______________________________________
Guido van Rossum <guido@python.org> added the comment: 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. ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue17799> _______________________________________
Xiang Zhang <angwerzx@126.com> added the comment: 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/131fd7f96c619bc7eaea956e45c6337175f... ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue17799> _______________________________________
Change by Xiang Zhang <angwerzx@126.com>: ---------- pull_requests: +5145 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue17799> _______________________________________
Change by Xiang Zhang <angwerzx@126.com>: ---------- pull_requests: +5146 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue17799> _______________________________________
Xiang Zhang <angwerzx@126.com> added the comment: 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/fd844efa9c31e1f00e04b07940875b9dacf... ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue17799> _______________________________________
Xiang Zhang <angwerzx@126.com> added the comment: 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/e64a47b37d0c592fd162b2f51e79ecfd046... ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue17799> _______________________________________
Change by Xiang Zhang <angwerzx@126.com>: ---------- resolution: -> fixed stage: patch review -> resolved status: open -> closed _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue17799> _______________________________________
participants (7)
-
Guido van Rossum
-
Maries Ionel Cristian
-
Mark Lawrence
-
Ned Batchelder
-
Pablo Galindo Salgado
-
raylu
-
Xiang Zhang