Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

bpo-36829: Document test.support.catch_unraisable_exception()#13554

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
vstinner merged 1 commit intopython:masterfromvstinner:catch_unraisable2
May 24, 2019
Merged

bpo-36829: Document test.support.catch_unraisable_exception()#13554

vstinner merged 1 commit intopython:masterfromvstinner:catch_unraisable2
May 24, 2019

Conversation

vstinner
Copy link
Member

@vstinnervstinner commentedMay 24, 2019
edited by bedevere-bot
Loading

catch_unraisable_exception() now also removes its 'unraisable'
attribute at the context manager exit.

https://bugs.python.org/issue36829

@vstinner
Copy link
MemberAuthor

cc@tirkarthi@graingert

Usage::

with support.catch_unraisable_exception() as cm:
# code creating an "unraisable exception"
Copy link
Contributor

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()

Copy link
MemberAuthor

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?

Copy link
Contributor

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

Copy link
MemberAuthor

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 managerexpect an unraisable exception and fail if it's not the case.

Copy link
MemberAuthor

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.

Copy link
Contributor

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?

Copy link
MemberAuthor

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.

Copy link
Contributor

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!

@vstinner
Copy link
MemberAuthor

Oh. "del self.unraisable" was a good idea. I only used the context manager in a few places, but I already get it wrong in test_io :-) It's now fixed by this PR!

catch_unraisable_exception() now also removes its 'unraisable'attribute at the context manager exit.
@vstinner
Copy link
MemberAuthor

@tirkarthi@graingert: Would you mind to review the updated PR?

@vstinnervstinner merged commit6dbbe74 intopython:masterMay 24, 2019
@vstinner
Copy link
MemberAuthor

@graingert: Thanks for your very good feedback, it's very valuable!

@vstinnervstinner deleted the catch_unraisable2 branchMay 24, 2019 22:09
DinoV pushed a commit to DinoV/cpython that referenced this pull requestJan 14, 2020
…GH-13554)catch_unraisable_exception() now also removes its 'unraisable'attribute at the context manager exit.
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@tirkarthitirkarthitirkarthi left review comments

@graingertgraingertgraingert approved these changes

Assignees
No one assigned
Labels
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

5 participants
@vstinner@graingert@tirkarthi@the-knights-who-say-ni@bedevere-bot

[8]ページ先頭

©2009-2025 Movatter.jp