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: plistlib error handling
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.3
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: ajaksu2, eric.araujo, ezio.melotti, georg.brandl, jackjansen, jvr, mher, ned.deily, ronaldoussoren
Priority: normal Keywords: easy, patch

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

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 msg110335.
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.

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.
Date User Action Args
2022-04-10 16:10:05adminsetgithub: 38892
2011-04-11 04:41:47ned.deilysetstatus: open -> closed
resolution: wont fix
messages: + msg133499

stage: resolved
2011-04-11 04:12:11ezio.melottisetassignee: jvr ->

messages: + msg133498
nosy: + ezio.melotti
2011-01-12 15:31:51mhersetnosy: jackjansen, georg.brandl, jvr, ronaldoussoren, ajaksu2, ned.deily, eric.araujo, mher
messages: + msg126105
2011-01-12 12:38:29eric.araujosetnosy: + ned.deily, mher, georg.brandl, ronaldoussoren
2011-01-12 12:37:45eric.araujosetstatus: closed -> open
versions: + Python 3.3, - Python 3.2
nosy: + eric.araujo, - BreamoreBoy
messages: + msg126088

resolution: wont fix -> (no value)
stage: patch review -> (no value)
2010-08-18 17:24:20BreamoreBoysetstatus: open -> closed
resolution: wont fix
messages: + msg114253
2010-07-14 22:26:49BreamoreBoysetnosy: + BreamoreBoy

messages: + msg110335
versions: + Python 3.2, - Python 2.7
2009-04-22 17:17:05ajaksu2setkeywords: + easy
2009-02-14 12:48:48ajaksu2linkissue985064 dependencies
2009-02-14 12:48:38ajaksu2setdependencies: - plistlib error handling
2009-02-14 12:48:38ajaksu2unlinkissue775321 dependencies
2009-02-12 00:36:54ajaksu2setdependencies: + plistlib error handling
stage: patch review
2009-02-12 00:36:54ajaksu2linkissue775321 dependencies
2009-02-09 21:50:43ajaksu2setfiles: + plistlib_garbage.diff
versions: + Python 2.7
nosy: + ajaksu2
messages: + msg81502
components: + Library (Lib), - None
keywords: + patch
type: enhancement
2003-07-21 22:06:16jackjansencreate