Issue 775321: plistlib error handling (original) (raw)

Created on 2003-07-21 22:06 by jackjansen, last changed 2022-04-10 16:10 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
plistlib_garbage.diff ajaksu2,2009-02-09 21:50 Catch XML parser exception and raise with a (hopefully) friendly message (patch against trunk)
Messages (8)
msg60358 - (view) Author: Jack Jansen (jackjansen) * (Python committer) Date: 2003-07-21 22:06
If you pass a garbage file to plistlib you can get all sorts of unexpected exceptions, for instance from the XML parser. This makes it hard to catch these errors, it would be better if plistlib caught the errors and raised a new one.
msg81502 - (view) Author: Daniel Diniz (ajaksu2) * (Python triager) Date: 2009-02-09 21:50
Here's a very simple patch, is this the only path for errors from garbage? I think docs are needed too: if apps catching ExpatError explicitly, will break. Not sure if this should actually change, as I don't use plistlib. I havve nothing against closing this RFE as won't fix :)
msg110335 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2010-07-14 22:26
If anything is to be done the patch needs updating. I'd be inclined to close this as "won't fix" unless someone can come up with a really compelling reason to implement it.
msg114253 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2010-08-18 17:24
Closing as no reply to .
msg126088 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-01-12 12:37
I think this was closed prematurely. I would like a core dev to assess this issue and reject or validate it.
msg126105 - (view) Author: Mher Movsisyan (mher) Date: 2011-01-12 15:31
I don't see compelling reasons to wrap ExpatError in ValueError. ExpatError contains extra diagnostic information such as line and column numbers.
msg133498 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2011-04-11 04:12
Note that this behavior is documented[0]: """ The XML data is parsed using the Expat parser from xml.parsers.expat – see its documentation for possible exceptions on ill-formed XML. Unknown elements will simply be ignored by the plist parser. """ Since this is documented and expat only has an exception type (xml.parsers.expat.ExpatError) I don't think is necessary to do anything here. Unless you think that the doc should be rephrased, this can be closed again. [0]: http://docs.python.org/library/plistlib.html#plistlib.readPlist
msg133499 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2011-04-11 04:41
I agree. If it were important to make plistlib error handling more useful, using a different parser would be the way to go, I think. In any case, Apple has deprecated the use of XML plists and moved to a binary plist format that plistlib does not recognize or handle.
History
Date User Action Args
2022-04-10 16:10:05 admin set github: 38892
2011-04-11 04:41:47 ned.deily set status: open -> closedresolution: wont fixmessages: + stage: resolved
2011-04-11 04:12:11 ezio.melotti set assignee: jvr -> messages: + nosy: + ezio.melotti
2011-01-12 15:31:51 mher set nosy:jackjansen, georg.brandl, jvr, ronaldoussoren, ajaksu2, ned.deily, eric.araujo, mhermessages: +
2011-01-12 12:38:29 eric.araujo set nosy: + ned.deily, mher, georg.brandl, ronaldoussoren
2011-01-12 12:37:45 eric.araujo set status: closed -> openversions: + Python 3.3, - Python 3.2nosy: + eric.araujo, - BreamoreBoymessages: + resolution: wont fix -> (no value)stage: patch review -> (no value)
2010-08-18 17:24:20 BreamoreBoy set status: open -> closedresolution: wont fixmessages: +
2010-07-14 22:26:49 BreamoreBoy set nosy: + BreamoreBoymessages: + versions: + Python 3.2, - Python 2.7
2009-04-22 17:17:05 ajaksu2 set keywords: + easy
2009-02-14 12:48:48 ajaksu2 link issue985064 dependencies
2009-02-14 12:48:38 ajaksu2 set dependencies: - plistlib error handling
2009-02-14 12:48:38 ajaksu2 unlink issue775321 dependencies
2009-02-12 00:36:54 ajaksu2 set dependencies: + plistlib error handlingstage: patch review
2009-02-12 00:36:54 ajaksu2 link issue775321 dependencies
2009-02-09 21:50:43 ajaksu2 set files: + plistlib_garbage.diffversions: + Python 2.7nosy: + ajaksu2messages: + components: + Library (Lib), - Nonekeywords: + patchtype: enhancement
2003-07-21 22:06:16 jackjansen create