From 96ad0585d2aad1c5aec9048746add7eb7b3fe802 Mon Sep 17 00:00:00 2001 From: Charalampos Stratakis Date: Thu, 14 Mar 2019 16:40:13 +0100 Subject: [PATCH 1/2] bpo-36292: Mark unreachable code as such in integer bitwise operations --- Objects/longobject.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Objects/longobject.c b/Objects/longobject.c index 1e3445c64a6a2b..a9c6101335b759 100644 --- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -4637,8 +4637,8 @@ long_bitwise(PyLongObject *a, size_z = negb ? size_b : size_a; break; default: - PyErr_BadArgument(); - return NULL; + /* Unreachable code */ + Py_UNREACHABLE(); } /* We allow an extra digit if z is negative, to make sure that @@ -4665,8 +4665,8 @@ long_bitwise(PyLongObject *a, z->ob_digit[i] = a->ob_digit[i] ^ b->ob_digit[i]; break; default: - PyErr_BadArgument(); - return NULL; + /* Unreachable code */ + Py_UNREACHABLE(); } /* Copy any remaining digits of a, inverting if necessary. */ From fd7200fdcc7329bceed38760067204401f30c501 Mon Sep 17 00:00:00 2001 From: Charalampos Stratakis Date: Mon, 18 Mar 2019 17:29:26 +0100 Subject: [PATCH 2/2] Remove redundant comments --- Objects/longobject.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/Objects/longobject.c b/Objects/longobject.c index a9c6101335b759..da697a784faad0 100644 --- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -4637,7 +4637,6 @@ long_bitwise(PyLongObject *a, size_z = negb ? size_b : size_a; break; default: - /* Unreachable code */ Py_UNREACHABLE(); } @@ -4665,7 +4664,6 @@ long_bitwise(PyLongObject *a, z->ob_digit[i] = a->ob_digit[i] ^ b->ob_digit[i]; break; default: - /* Unreachable code */ Py_UNREACHABLE(); }