]> granicus.if.org Git - python/commitdiff
Remove a redundant string length check and variable assignment.
authorBrett Cannon <bcannon@gmail.com>
Tue, 4 May 2010 00:30:17 +0000 (00:30 +0000)
committerBrett Cannon <bcannon@gmail.com>
Tue, 4 May 2010 00:30:17 +0000 (00:30 +0000)
Found with Clang's static analyzer.

Modules/cPickle.c

index d89e8109e87504ea1be4d70d904aac90fd37f978..79eebcaa256909aab3adfff75e97ee5e1b6894cd 100644 (file)
@@ -864,7 +864,7 @@ whichmodule(PyObject *global, PyObject *global_name)
                *global_name_attr = 0, *name = 0;
 
        module = PyObject_GetAttrString(global, "__module__");
-       if (module) 
+       if (module)
                return module;
        if (PyErr_ExceptionMatches(PyExc_AttributeError))
                PyErr_Clear();
@@ -903,7 +903,6 @@ whichmodule(PyObject *global, PyObject *global_name)
           like this rule. jlf
        */
        if (!j) {
-               j=1;
                name=__main___str;
        }
 
@@ -1235,9 +1234,6 @@ save_string(Picklerobject *self, PyObject *args, int doput)
                int i;
                char c_str[5];
 
-               if ((size = PyString_Size(args)) < 0)
-                       return -1;
-
                if (size < 256) {
                        c_str[0] = SHORT_BINSTRING;
                        c_str[1] = size;