• Jeremy Hylton's avatar
    Simplify and fix error handling for most cases. · 9d620d01
    Jeremy Hylton authored
    Many functions used a local variable called return_error, which was
    initialized to zero.  If an error occurred, it was set to true.  Most
    of the code paths checked were only executed if return_error was
    false.  goto is clearer.
    
    The code also seemed to be written under the curious assumption that
    calling Py_DECREF() on a local variable would assign the variable to
    NULL.  As a result, more of the error-exit code paths returned an
    object that had a reference count of zero instead of just returning
    NULL.  Fixed the code to explicitly assign NULL after the DECREF.
    
    A bit more reformatting, but not much.
    
    XXX Need a much better test suite for zlib, since it the current tests
    don't exercise any of this broken code.
    9d620d01
zlibmodule.c 27.4 KB