Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-38205: Py_UNREACHABLE() calls Py_FatalError() #16290

Merged
merged 1 commit into from Sep 20, 2019

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Sep 19, 2019

@vstinner
Copy link
Member Author

vstinner commented Sep 19, 2019

Example from:
#16280 (comment)

vstinner@apu$ ./python bug.py
Fatal Python error: We've reached an unreachable state. Anything is possible.
The limits were in our heads all along. Follow your dreams.
https://xkcd.com/2200
Python runtime state: initialized

Current thread 0x00007f5dc4f6d740 (most recent call first):
  File "/home/vstinner/python/master/bug.py", line 8 in func
  File "/home/vstinner/python/master/bug.py", line 11 in main
  File "/home/vstinner/python/master/bug.py", line 13 in <module>
Aborted (core dumped)

With RANDALL_WAS_HERE macro defined:

$ ./python bug.py
Fatal Python error: If you're seeing this, the code is in what I thought was
an unreachable state.

I could give you advice for what to do, but honestly, why
should you trust me?  I clearly screwed this up.  I'm writing
a message that should never appear, yet I know it will
probably appear someday.

On a deep level, I know I'm not up to this task.
I'm so sorry.
https://xkcd.com/2200
Python runtime state: initialized

Current thread 0x00007f7a71348740 (most recent call first):
  File "/home/vstinner/python/master/bug.py", line 8 in func
  File "/home/vstinner/python/master/bug.py", line 11 in main
  File "/home/vstinner/python/master/bug.py", line 13 in <module>
Aborted (core dumped)

@vstinner
Copy link
Member Author

vstinner commented Sep 19, 2019

cc @zware @serhiy-storchaka

zware
zware approved these changes Sep 19, 2019
@vstinner
Copy link
Member Author

vstinner commented Sep 19, 2019

I will wait for @serhiy-storchaka approval, since he was the one to disagree with my first attempt:
https://bugs.python.org/issue38205#msg352782

@serhiy-storchaka
Copy link
Member

serhiy-storchaka commented Sep 19, 2019

Thank you.

@animalize
Copy link
Contributor

animalize commented Sep 20, 2019

The assembly code generated by this PR will push the string OFFSET at the call sites, the assembly code will longer a bit.
If you care about this, you can use a macro points to a non-inline function.

@vstinner vstinner merged commit b154258 into python:master Sep 20, 2019
@vstinner vstinner deleted the unreachable2 branch Sep 20, 2019
@vstinner
Copy link
Member Author

vstinner commented Sep 20, 2019

"The assembly code generated by this PR will push the string OFFSET at the call sites, the assembly code will longer a bit. If you care about this, you can use a macro points to a non-inline function."

I don't care about emitted machine code :-)

vstinner added a commit that referenced this pull request Sep 20, 2019
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.

None yet

7 participants