]> granicus.if.org Git - python/commitdiff
Fix couple of dead code paths (GH-7418)
authorDavid Carlier <dcarlier@afilias.info>
Fri, 17 May 2019 23:46:22 +0000 (23:46 +0000)
committerCheryl Sabella <cheryl.sabella@gmail.com>
Fri, 17 May 2019 23:46:22 +0000 (19:46 -0400)
Objects/bytesobject.c
Objects/stringlib/fastsearch.h
Python/ast.c
Python/compile.c

index ebbdb7c3c1642886fa958b7cdd7aac2dc576e246..41453b2d14e9d9b68f1a35d946a78570eed258ce 100644 (file)
@@ -1617,12 +1617,10 @@ bytes_richcompare(PyBytesObject *a, PyBytesObject *b, int op)
         case Py_GE:
             /* a string is equal to itself */
             Py_RETURN_TRUE;
-            break;
         case Py_NE:
         case Py_LT:
         case Py_GT:
             Py_RETURN_FALSE;
-            break;
         default:
             PyErr_BadArgument();
             return NULL;
index a8a51d577f3f7ce70b68f83a8fc5ab2089541955..46fcf356d0d0f57dbb9eb30901588442dd0ebfde 100644 (file)
@@ -192,7 +192,6 @@ FASTSEARCH(const STRINGLIB_CHAR* s, Py_ssize_t n,
                 }
             return count;
         }
-        return -1;
     }
 
     mlast = m - 1;
index 03da4e7f7f9affe0ba3d9b4a9bbf7d08d8a3a268..abc8d89c8a381c474745565d9f0f5f91e83aa07f 100644 (file)
@@ -2971,7 +2971,6 @@ ast_for_expr(struct compiling *c, const node *n)
                 return Compare(expression, ops, cmps, LINENO(n), n->n_col_offset,
                                n->n_end_lineno, n->n_end_col_offset, c->c_arena);
             }
-            break;
 
         case star_expr:
             return ast_for_starred(c, n);
@@ -3618,7 +3617,6 @@ alias_for_import_name(struct compiling *c, const node *n, int store)
                     return NULL;
                 return a;
             }
-            break;
         case dotted_name:
             if (NCH(n) == 1) {
                 node *name_node = CHILD(n, 0);
@@ -3669,7 +3667,6 @@ alias_for_import_name(struct compiling *c, const node *n, int store)
                 }
                 return alias(str, NULL, c->c_arena);
             }
-            break;
         case STAR:
             str = PyUnicode_InternFromString("*");
             if (!str)
index 2a086a509f4595cdfc611a07013fa777483e6f23..b20548c777246c16fc827556540f5ebff8d3f8ca 100644 (file)
@@ -4868,7 +4868,6 @@ compiler_visit_expr1(struct compiler *c, expr_ty e)
             return compiler_error(c,
                 "can't use starred expression here");
         }
-        break;
     case Name_kind:
         return compiler_nameop(c, e->v.Name.id, e->v.Name.ctx);
     /* child nodes of List and Tuple will have expr_context set */