Skip to content

12230 Stop including the location of where an exception was caught in Failure#12232

Merged
itamarst merged 14 commits intotrunkfrom
12230-stop-including-location-exception-was-caught-in-failure
Aug 6, 2024
Merged

12230 Stop including the location of where an exception was caught in Failure#12232
itamarst merged 14 commits intotrunkfrom
12230-stop-including-location-exception-was-caught-in-failure

Conversation

@itamarst
Copy link
Contributor

@itamarst itamarst commented Jul 5, 2024

Scope and purpose

Fixes #12230

See the issue for motivation, and a potential argument against accepting this PR.

The performance impact somewhat overlaps with #12231 but they both contribute if both are applied.

@itamarst itamarst linked an issue Jul 5, 2024 that may be closed by this pull request
@codspeed-hq
Copy link

codspeed-hq bot commented Jul 5, 2024

CodSpeed Performance Report

Merging #12232 will improve performances by 91.13%

Comparing 12230-stop-including-location-exception-was-caught-in-failure (5dab097) with trunk (57dc216)

Summary

⚡ 1 improvements
✅ 19 untouched benchmarks

Benchmarks breakdown

Benchmark trunk 12230-stop-including-location-exception-was-caught-in-failure Change
test_deferred_errback_chain 337 µs 176.3 µs +91.13%

@itamarst
Copy link
Contributor Author

itamarst commented Jul 5, 2024

The performance regression in the await benchmark appears to be noise, I can't reproduce it locally (but can reproduce some level of noisiness). And it doesn't use Failure...

@itamarst itamarst marked this pull request as ready for review July 5, 2024 14:42
@chevah-robot chevah-robot requested a review from a team July 5, 2024 14:42
Copy link
Member

@adiroiban adiroiban left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this. I read the discussion from #12230

It looks to me, but I would link this to the Deferred.debug flag.

I have never used capureVars in my applications and I don't know why the caputreVars functionality is usedful ...

Maybe captureVars is super important.

I hope @glyph will have some time to review this

My suggestion is to link this to the Deferred.debug flag and not with captureVars

del d["__builtins__"]
localz = localz.items()
globalz = globalz.items()
while captureVars and f:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we have this linked to debug ?

I did a quick search for caputeVars in src/twisted and I can see that caputeVars is only used in src/twisted/internet/defer.py and always linked to Deferred.debug

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because captureVars is set by Deferred.debug, that's implicitly what's going on here already.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. It looks like the captureVars argument is kind of a private argument, designed to support Deferred.debug.

All good.

@adiroiban adiroiban requested a review from a team July 6, 2024 09:14
Copy link
Member

@adiroiban adiroiban left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on the discussion from #12230 it looks like Glyph is also happy with removing this functionalty.

I think that this PR looks good.

I don't think there is a need for any backward compatibitly policy, as I don't think that the content of the traceback is part of our public API.

Thanks for working on this!

@itamarst
Copy link
Contributor Author

The current code includes the stack optionally; the discussion in the issue suggests that removing it altogether is acceptable, so I'm going to update this to do that.

@itamarst
Copy link
Contributor Author

OK, the code just removes the stack altogether, which is different so another review might be nice.

Copy link
Member

@adiroiban adiroiban left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the cleanup.

I think that as part of this PR we should deprecate it.

That is:

  • Remove it from the documentation, or document that it's deprecated.
  • Raise deprecation warning when used.
  • Add minimal tests for deprecation warnings.

Let me know if you need help with the testing.

Thanks again.

@eevelweezel
Copy link
Contributor

eevelweezel commented Jul 16, 2024

I haven't specifically tested, but this change would probably resolve some of the outstanding questions for #12092. If we don't need to include the additional traceback, then the changes it makes to the expected test output are fine.

Copy link
Member

@adiroiban adiroiban left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change looks good. Thanks.

I think that we need to use the incremental NEXT marker for version deprectation.

I have added it as needs changes, to prevent an accidental merge.

I am not sure if we will have an 24.8.0 release :)

Co-authored-by: Adi Roiban <adiroiban@gmail.com>
@itamarst
Copy link
Contributor Author

itamarst commented Aug 6, 2024

So sounds like I can merge once tests passed, given change to NEXT?

Copy link
Member

@adiroiban adiroiban left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update. This can be merged.

@itamarst itamarst merged commit 227f9d0 into trunk Aug 6, 2024
@itamarst itamarst deleted the 12230-stop-including-location-exception-was-caught-in-failure branch August 6, 2024 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stop including location exception was caught in Failure

6 participants