Skip to content

bpo-38631: Add _Py_NO_RETURN to functions calling Py_FatalError()#18278

Merged
vstinner merged 1 commit intopython:masterfrom
vstinner:noreturn
Jan 30, 2020
Merged

bpo-38631: Add _Py_NO_RETURN to functions calling Py_FatalError()#18278
vstinner merged 1 commit intopython:masterfrom
vstinner:noreturn

Conversation

@vstinner
Copy link
Member

@vstinner vstinner commented Jan 30, 2020

@vstinner
Copy link
Member Author

About clang "code will never be executed [-Wunreachable-code]" warning: I compiled Python using clang -O3. There is one warning, but it's unrelated to this change:

./Modules/timemodule.c:113:13: warning: code will never be executed [-Wunreachable-code]

I tested clang version 9.0.0 (Fedora 9.0.0-1.fc31).

Add _Py_NO_RETURN to functions calling Py_FatalError():

* _PyObject_AssertFailed()
* dummy_dealloc()
* faulthandler_fatal_error_thread()
* none_dealloc()
* notimplemented_dealloc()
@vstinner
Copy link
Member Author

Note: marking _PyObject_AssertFailed() with _Py_NO_RETURN idea comes from a GCC 10 regression bug report: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93384#c17

@vstinner vstinner merged commit 2a4903f into python:master Jan 30, 2020
@vstinner vstinner deleted the noreturn branch January 30, 2020 12:09
shihai1991 pushed a commit to shihai1991/cpython that referenced this pull request Jan 31, 2020
…thonGH-18278)

Add _Py_NO_RETURN to functions calling Py_FatalError():

* _PyObject_AssertFailed()
* dummy_dealloc()
* faulthandler_fatal_error_thread()
* none_dealloc()
* notimplemented_dealloc()
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.

3 participants