gh-152409: Save the trace --file counts when --no-report is used - #152410
Conversation
The counts were only persisted at the end of CoverageResults.write_results(), which main() skips when --no-report is given, so --no-report --file silently discarded them. Move that step into CoverageResults.save_counts() (still called from write_results()) and call it on the --no-report branch too.
|
|
||
| self.save_counts() | ||
|
|
||
| def save_counts(self): |
There was a problem hiding this comment.
This becomes an undocumented public method of the documented public class.
Make it private.
There was a problem hiding this comment.
Alternatively, you can keep it public and document (with versionadded).
|
Done in 19c6975: renamed to |
serhiy-storchaka
left a comment
There was a problem hiding this comment.
LGTM, be we need an approve of @zooko, @gvanrossum, or @smontanaro which participiated in the original discussion.
LGTM, though given that my last involvement with the |
|
Thanks for looking at it, Skip. I didn't look at it, sorry. Hi there, you
guys, nice to see you again. :-)
…On Tue, Aug 18, 2026 at 6:22 PM Skip Montanaro ***@***.***> wrote:
*smontanaro* left a comment (python/cpython#152410)
<#152410 (comment)>
LGTM, be we need an approve of @zooko <https://github.com/zooko>,
@gvanrossum <https://github.com/gvanrossum>, or @smontanaro
<https://github.com/smontanaro> which participiated in the original
discussion.
LGTM, though given that my last involvement with the trace module was 25
years ago, I'm not sure my input means much. ;-)
—
Reply to this email directly, view it on GitHub
<#152410?email_source=notifications&email_token=AADSHPAL7EIZK2MM74A2DUT5KTXNJA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKMZTGU4TGMBRHE4KM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#issuecomment-5335930198>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADSHPBK4HV7ZK4KHAU6BY35KTXNJAVCNFSNUABEKJSXA33TNF2G64TZHM4DCNJZHA4TMMJ3JFZXG5LFHM2DONJYGQ3DQMBTGOQXMAQ>
.
Triage notifications, keep track of coding agent tasks and review pull
requests on the go with GitHub Mobile for iOS
<https://github.com/notifications/mobile/ios/AADSHPEUXMSO3EUYB7FDZX35KTXNJA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKMZTGU4TGMBRHE4KM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJKTGN5XXIZLSL5UW64Y>
and Android
<https://github.com/notifications/mobile/android/AADSHPGRD6MKSRXITUF3YND5KTXNJA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKMZTGU4TGMBRHE4KM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLTGN5XXIZLSL5QW4ZDSN5UWI>.
Download it today!
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
|
Hi @serhiy-storchaka, unfortunately, like the two others, I have no recollection of how this code was supposed to work, and don't feel competent to review it now. But I trust that between you and the OP you have enough understanding to do the right thing! |
|
Sorry to bother you for such insignificant issue. I just wanted to make sure that my understanding of the original intent was correct. |
python -m trace --count --no-report --file FILEnow saves the counts toFILE, so counts can be accumulated over several runs — which is what--fileand--no-reportare documented to support.The counts were pickled only at the end of
CoverageResults.write_results(), whichmain()skips when--no-reportis given, so
--no-report --filesilently discarded them. This extractsthat step into
CoverageResults.save_counts()(still called fromwrite_results()exactly as before) and also calls it on the--no-reportbranch.save_counts()only writes when--filewas given (it is a no-opotherwise), and a
--filerun without--no-reportalready wrote thefile for every mode, so the two paths are now consistent.