[python-committers] Py_UNREACHABLE

Barry Warsaw barry at python.org
Fri Sep 15 14:59:38 EDT 2017


I landed bpo-31338 / PR #3374 which adds a Py_UNREACHABLE() macro to master, along with some additional documentation in the C API describing this and a few other common macros.  If you’re writing or reviewing C changes that include unreachable code paths, please use this macro for consistency, instead of other approaches like assert() (which can be compiled out) and `return NULL`, etc.

As part of the PR, I changed a bunch of existing instances in the code:

https://github.com/python/cpython/pull/3374/files

If you find any cases I’ve missed, feel free to submit a PR and I will happily review it.  I think this makes our code more consistent and ultimately safer.

(Thanks Victor for the PR review!)

Cheers,
-Barry

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Message signed with OpenPGP
URL: <http://mail.python.org/pipermail/python-committers/attachments/20170915/8b1de252/attachment.sig>


More information about the python-committers mailing list