This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Tracing: c_return doesn't report the result
Type: enhancement Stage: patch review
Components: C API Versions: Python 3.11, Python 3.10
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Mark.Shannon, smurfix
Priority: normal Keywords: patch

Created on 2022-02-17 18:08 by smurfix, last changed 2022-04-11 14:59 by admin.

Pull Requests
URL Status Linked Edit
PR 31393 open smurfix, 2022-02-17 20:11
Messages (4)
msg413421 - (view) Author: Matthias Urlichs (smurfix) * Date: 2022-02-17 18:08
When tracing/profiling, the "return" event reports the value returned by the exiting function.

However, this does not work for C functions. The profiler's "c_return" hook is called with the same C function object as "c_call". This unnecessarily complicates debugging and should be fixed.

https://stackoverflow.com/questions/61067303/get-return-value-of-python-builtin-functions-while-tracing
msg413444 - (view) Author: Matthias Urlichs (smurfix) * Date: 2022-02-17 19:13
Likewise for c_exception, which should report the exception thruple -- and even has an XXX comment reminding us to fix that (ceval.c 4542).
msg413454 - (view) Author: Matthias Urlichs (smurfix) * Date: 2022-02-17 20:25
Added a github PR. Unfortunately it breaks the cprofile testcase, which apparently relies on the old argument value (for no good reason IMHO).

I don't know how the profiler works internally. If somebody who does could have a look at it and/or its testcase I'd be grateful.
msg414522 - (view) Author: Mark Shannon (Mark.Shannon) * (Python committer) Date: 2022-03-04 12:30
This is an API change.

I agree that the API is not what it should be, but we can't change it without breaking an unknown amount of 3rd party code that uses it.
History
Date User Action Args
2022-04-11 14:59:56adminsetgithub: 90937
2022-03-04 12:30:19Mark.Shannonsetnosy: + Mark.Shannon
messages: + msg414522
2022-02-17 20:25:33smurfixsetmessages: + msg413454
2022-02-17 20:11:00smurfixsetkeywords: + patch
stage: patch review
pull_requests: + pull_request29537
2022-02-17 19:13:51smurfixsetmessages: + msg413444
2022-02-17 18:08:22smurfixcreate