classification
Title: Dead code in Modules/pyexpat.c
Type: Stage: needs patch
Components: Extension Modules Versions: Python 3.1, Python 3.2
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: akuchling, bbrazil, benjamin.peterson, christian.heimes, fdrake, georg.brandl, pitrou
Priority: low Keywords: easy, patch

Created on 2010-07-18 13:44 by pitrou, last changed 2010-08-08 16:55 by benjamin.peterson. This issue is now closed.

Files
File name Uploaded Description Edit
xmlparse_ParseFile-dead-code.patch bbrazil, 2010-08-08 15:59
Messages (5)
msg110646 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-07-18 13:44
There's some dead code in xmlparse_ParseFile() in Modules/pyexpat.c: the file pointer "fp" is always NULL, and as such the following code can never get entered into:

        if (fp) {
            bytes_read = fread(buf, sizeof(char), BUF_SIZE, fp);
            if (bytes_read < 0) {
                PyErr_SetFromErrno(PyExc_IOError);
                return NULL;
            }
        }

There might be similar situations in other methods.
msg112549 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2010-08-02 21:00
"fp" can probably be just removed?
msg113275 - (view) Author: Brian Brazil (bbrazil) * Date: 2010-08-08 15:59
The attached patch removes the dead code, regrtest is happy.
msg113278 - (view) Author: Fred L. Drake, Jr. (fdrake) (Python committer) Date: 2010-08-08 16:19
This patch looks good to me.
msg113282 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2010-08-08 16:55
r83834
History
Date User Action Args
2010-08-08 16:55:29benjamin.petersonsetstatus: open -> closed

nosy: + benjamin.peterson
messages: + msg113282

resolution: fixed
2010-08-08 16:19:47fdrakesetmessages: + msg113278
2010-08-08 15:59:13bbrazilsetfiles: + xmlparse_ParseFile-dead-code.patch

nosy: + bbrazil
messages: + msg113275

keywords: + patch
2010-08-03 11:29:54pitrousetkeywords: + easy
2010-08-02 21:02:44fdrakesetnosy: + fdrake
2010-08-02 21:00:19georg.brandlsetnosy: + georg.brandl
messages: + msg112549
2010-07-18 13:44:23pitroucreate