◐ Shell
clean mode source ↗

bpo-36829: Document test.support.catch_unraisable_exception() by vstinner · Pull Request #13554 · python/cpython

Choose a reason for hiding this comment

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

Might be worth suggesting gc.collect()

Choose a reason for hiding this comment

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

gc.collect() is not needed. Why do you want to force a GC collection?

Choose a reason for hiding this comment

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

It's not needed but it's often a good trigger of these sort of exceptions

Choose a reason for hiding this comment

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

Well, tests using the context manager expect an unraisable exception and fail if it's not the case.

Choose a reason for hiding this comment

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

Oh. By the way. I also had the idea of installing a custom sys.unraisablehook in regrtest and repeat all errors at exit. Maybe even make the test fail if at least one unraisable exception is logged.

Choose a reason for hiding this comment

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

Can you URL me to that commit?

Choose a reason for hiding this comment

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

It's not a commit but an idea :-) I didn't implement it.

Choose a reason for hiding this comment

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

Ok, :$ ping me when implemented!