homepage

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.

classification
Title: plistlib has no graceful way of handing None values
Type: enhancement Stage:
Components: Library (Lib) Versions: Python 3.4
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: ronaldoussoren Nosy List: Behdad.Esfahbod, Matt.Hansen, bobveznat, jvr, ned.deily, ronaldoussoren, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2011年02月02日 19:10 by bobveznat, last changed 2022年04月11日 14:57 by admin.

Files
File name Uploaded Description Edit
plistlib.patch bobveznat, 2011年02月02日 19:10 Patch adding ignoreNone parameter
Messages (4)
msg127750 - (view) Author: Bob Van Zant (bobveznat) Date: 2011年02月02日 19:10
The Apple plist format does not support None or Null values in its output. A Null value in plist is denoted by the absence of the key in the data structure.
The python plist writer generates a TypeError when a None value is encoded. This issue is to track dealing with None values.
A suggestion is to have a flag on the various plist write functions and methods that will allow ignoring None values.
No changes are required to the plist reader.
msg189911 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2013年05月24日 14:07
At first I didn't like the proposal, but when I looked at the JSON module I noticed it has similar functionality for ignoring keys that cannot be represented in a JSON file.
I'll look into this after merging #14455.
The JSON library has two other options that might be useful for the plistlib library: sort_keys (sort the keys in the serialization of of dicts) and default(obj), which is a function for transforming values that cannot be represented natively.
msg228560 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014年10月05日 11:56
Note that binary plist format supports None.
msg241873 - (view) Author: Behdad Esfahbod (Behdad.Esfahbod) Date: 2015年04月23日 18:28
plistlib's internal implementation already supports sort_keys and skipkeys, those just are not wired to load() and loads().
History
Date User Action Args
2022年04月11日 14:57:12adminsetgithub: 55310
2015年04月23日 18:28:08Behdad.Esfahbodsetnosy: + Behdad.Esfahbod
messages: + msg241873
2014年12月03日 19:40:44Matt.Hansensetnosy: + Matt.Hansen
2014年10月05日 11:56:41serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg228560
2013年05月24日 14:07:39ronaldoussorensetversions: + Python 3.4, - Python 2.7
nosy: + ned.deily

messages: + msg189911

assignee: ronaldoussoren
2011年02月04日 17:43:31eric.araujosetnosy: + jvr, ronaldoussoren
2011年02月02日 19:10:51bobveznatcreate

AltStyle によって変換されたページ (->オリジナル) /