Movatterモバイル変換


[0]ホーム

URL:


Wayback Machine
1 capture
22 Sep 2024
AugSEPOct
Previous capture22Next capture
202320242025
success
fail
COLLECTED BY
TIMESTAMPS
loading
The Wayback Machine - https://web.archive.org/web/20240922134223/https://github.com/python/cpython/pull/3374
Skip to content

Navigation Menu

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

bpo-31338#3374

Merged
warsaw merged 8 commits intopython:masterfromwarsaw:bpo-31338
Sep 15, 2017
Merged

bpo-31338#3374

warsaw merged 8 commits intopython:masterfromwarsaw:bpo-31338
Sep 15, 2017

Conversation

warsaw
Copy link
Member

@warsawwarsaw commentedSep 6, 2017
edited by bedevere-bot
Loading

Over inhttp://bugs.python.org/issue31338 the idea to implement a macro calledPy_UNREACHABLE() was proposed. This would be used in cases where you'd be tempted to use anassert(0) orabort(), i.e. for code paths you do not expect will ever be reached.

UsingPy_UNREACHABLE() has a few advantages:

  • Consistency; it's easy to search for such code paths;
  • The intent is clear;
  • Being a macro, we adjust this on a per-compiler basis in case we need to make it more friendly (although the default implementation makes gcc, clang, and MSVC happy).
  • We can define it differently for other use cases, such as adding a common debugging entry point, or printing__FILE__ and__LINE__, etc.

I've changed the examples described inbpo-31338, but may not have gotten them all.

For now, this is defined strictly asabort() which is the simplest thing that make the common compilers happy.

I've also added some documentation aboutPy_UNREACHABLE() and a few other macros inpymacros.h.

https://bugs.python.org/issue31338

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.

@warsaw
Copy link
MemberAuthor

Thanks@Haypo !

@warsawwarsaw merged commitb2e5794 intopython:masterSep 15, 2017
@warsawwarsaw deleted the bpo-31338 branchSeptember 15, 2017 01:13
@encukou
Copy link
Member

ThePy_UNREACHABLE() doc entry is missingversionadded, see#4337

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@vstinnervstinnervstinner approved these changes

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

Successfully merging this pull request may close these issues.

6 participants
@warsaw@encukou@vstinner@Mariatta@the-knights-who-say-ni@bedevere-bot

[8]ページ先頭

©2009-2025 Movatter.jp