mirror of
https://github.com/python/cpython.git
synced 2025-08-22 09:45:06 +00:00
bpo-31338 (#3374)
* Add Py_UNREACHABLE() as an alias to abort(). * Use Py_UNREACHABLE() instead of assert(0) * Convert more unreachable code to use Py_UNREACHABLE() * Document Py_UNREACHABLE() and a few other macros.
This commit is contained in:
parent
d384a81f55
commit
b2e5794870
22 changed files with 128 additions and 111 deletions
|
@ -351,8 +351,7 @@ calc_padding(Py_ssize_t nchars, Py_ssize_t width, Py_UCS4 align,
|
|||
*n_lpadding = 0;
|
||||
else {
|
||||
/* We should never have an unspecified alignment. */
|
||||
*n_lpadding = 0;
|
||||
assert(0);
|
||||
Py_UNREACHABLE();
|
||||
}
|
||||
|
||||
*n_rpadding = *n_total - nchars - *n_lpadding;
|
||||
|
@ -569,9 +568,7 @@ calc_number_widths(NumberFieldWidths *spec, Py_ssize_t n_prefix,
|
|||
break;
|
||||
default:
|
||||
/* Shouldn't get here, but treat it as '>' */
|
||||
spec->n_lpadding = n_padding;
|
||||
assert(0);
|
||||
break;
|
||||
Py_UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue