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.

Title: Dead code in Modules/pyexpat.c
Type: Stage: needs patch
Components: Extension Modules Versions: Python 3.1, Python 3.2
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 2022-04-11 14:57 by admin. This issue is now closed.

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) {
                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 Drake (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
Date User Action Args
2022-04-11 14:57:03adminsetgithub: 53538
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