This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Check fall-through in _codecs_iso2022.c
Type: compile error Stage: resolved
Components: Build Versions: Python 3.7, Python 3.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: serhiy.storchaka, skrah, vstinner
Priority: normal Keywords:

Created on 2017-08-25 12:21 by skrah, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 3206 merged skrah, 2017-08-25 16:09
PR 3518 merged vstinner, 2017-09-12 17:39
Messages (5)
msg300834 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2017-08-25 12:21
The last fall-through warning is in _codecs_iso2022.c. IMO the
current code is equivalent to this, but I'm no codecs expert at
all:


diff --git a/Modules/cjkcodecs/_codecs_iso2022.c b/Modules/cjkcodecs/_codecs_iso2022.c
index 1ce4218f30..abf214880f 100644
--- a/Modules/cjkcodecs/_codecs_iso2022.c
+++ b/Modules/cjkcodecs/_codecs_iso2022.c
@@ -807,15 +807,9 @@ jisx0213_encoder(const Py_UCS4 *data, Py_ssize_t *length, void *config)
     case 2: /* second character of unicode pair */
         coded = find_pairencmap((ucs2_t)data[0], (ucs2_t)data[1],
                                 jisx0213_pair_encmap, JISX0213_ENCPAIRS);
-        if (coded == DBCINV) {
-            *length = 1;
-            coded = find_pairencmap((ucs2_t)data[0], 0,
-                      jisx0213_pair_encmap, JISX0213_ENCPAIRS);
-            if (coded == DBCINV)
-                return MAP_UNMAPPABLE;
-        }
-        else
+        if (coded != DBCINV) {
             return coded;
+        /* fall through */
 
     case -1: /* flush unterminated */
         *length = 1;
msg300836 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-08-25 13:10
This looks equivalent to me.
msg300844 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2017-08-25 16:31
New changeset 138753c1b96b5e06a5c5d409fa4cae5e2fe1108b by Stefan Krah in branch 'master':
bpo-31275: Small refactoring to silence a fall-through warning. (#3206)
https://github.com/python/cpython/commit/138753c1b96b5e06a5c5d409fa4cae5e2fe1108b
msg300846 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2017-08-25 16:32
Thanks, Serhiy!
msg302004 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-09-12 23:09
New changeset c0e77364ca29df6cfb311e79892955c92bd8e595 by Victor Stinner in branch '3.6':
[3.6] bpo-30923: Silence fall-through warnings included in -Wextra since gcc-7.0 (#3518)
https://github.com/python/cpython/commit/c0e77364ca29df6cfb311e79892955c92bd8e595
History
Date User Action Args
2022-04-11 14:58:51adminsetgithub: 75458
2017-09-12 23:15:33vstinnersetversions: + Python 3.6
2017-09-12 23:09:46vstinnersetmessages: + msg302004
2017-09-12 17:39:15vstinnersetpull_requests: + pull_request3514
2017-08-25 16:32:52skrahsetstatus: open -> closed

components: + Build
versions: + Python 3.7
messages: + msg300846
type: compile error
resolution: fixed
stage: resolved
2017-08-25 16:31:26skrahsetmessages: + msg300844
2017-08-25 16:09:26skrahsetpull_requests: + pull_request3243
2017-08-25 13:10:33serhiy.storchakasetmessages: + msg300836
2017-08-25 12:21:15skrahcreate