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-46328: added sys.exception()#30514

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
iritkatriel merged 6 commits intopython:mainfromiritkatriel:bpo-46328-sys-exception
Jan 13, 2022

Conversation

iritkatriel
Copy link
Member

@iritkatrieliritkatriel commentedJan 10, 2022
edited by bedevere-bot
Loading

tiran reacted with hooray emoji
Copy link
Member

@vstinnervstinner left a comment

Choose a reason for hiding this comment

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

Please document the new function in Doc/whatsnew/3.11.rst.

@@ -2457,6 +2480,7 @@ Functions:\n\
\n\
displayhook() -- print an object to the screen, and save it in builtins._\n\
excepthook() -- print an exception and its traceback to sys.stderr\n\
exception() -- return the current exception (thread safe)\n\
Copy link
Member

Choose a reason for hiding this comment

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

What is this "(thread safe)" note? It's not mentioned anywhere else.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

The next line for exc_info mentions it's thread-safe, so I didn't want it to look like this isn't. But maybe I should remove it from both lines?

Copy link
Member

Choose a reason for hiding this comment

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

My concern is more that it's only in help(sys), but nowhere else. If it's thread safe and this information matters, it should be in the documentation as well. Maybe also in the function docstring.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I don’t know if it matters. This info is thread specific anyway, so you would assume this is thread safe (this is mentioned in the doc).

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Are the other functions in sys, like getrefcount, not thread safe?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I think it could be that the intention in the help line for exc_info was to say that it’s a thread-specific value, but it was worded incorrectly. I’d change both to say this instead of thread-safe.

Copy link
Member

Choose a reason for hiding this comment

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

Most functions implemented in C are thread-safe. I agree, remove the mention from both functions.

The exact behavior can be elaborated in the documentation, if needed.

Yeah, the current exception is per-thread.

Copy link
Member

@vstinnervstinner left a comment

Choose a reason for hiding this comment

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

LGTM. But I suggest to remove "(thread safe)" from sys docstring.

iritkatriel reacted with thumbs up emoji
@iritkatrieliritkatriel merged commitc590b58 intopython:mainJan 13, 2022
@vstinner
Copy link
Member

Nice@iritkatriel! That looks like an useful feature ;-) I dislikesys.exc_info() which smells like a legacy of Python 2 exceptions.

@iritkatrieliritkatriel deleted the bpo-46328-sys-exception branchJanuary 13, 2022 15:32
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@tirantirantiran left review comments

@vstinnervstinnervstinner approved these changes

@warsawwarsawAwaiting requested review from warsaw

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

Successfully merging this pull request may close these issues.

5 participants
@iritkatriel@vstinner@tiran@the-knights-who-say-ni@bedevere-bot

[8]ページ先頭

©2009-2025 Movatter.jp