[issue14455] plistlib unable to read json and binary plist files

Ronald Oussoren report at bugs.python.org
Thu Dec 19 10:48:54 CET 2013


Ronald Oussoren added the comment:

I'm working on an update for your patch that addresses these comments:

* I don't like supporting 128 bit integers because Apple's public APIs
  don't support those values. That is, the value 'kCFNumberSInt128Type'
  is not in a public header for the OSX 10.9 SDK.

* The test_int method that you introduced tests conversions to and from XML,
  and doesn't test the problem with negative values in binary plists.

* I don't understand why test_int converts a value to a binary plist twice,
  that is the 'data2 = plistlib.dumps(pl2)' bit.

* I'm adding negative integers to the _create method as well, with the 
  corresponding changes to the binary TESTDATA dictionary.

* I don't understand your comment about the writePlistToBytes documentation,
  there was no versionchanged in the documentation.  The version changed 
  for dump was wrong, that should be versionadded (and the other new functions
  should have a versionadded as well)

* I agree that this change should be mentioned in What's New.

* I agree that _write_object should raise TypeError

BTW. What about out-of-range integer values? Those currently raise struct.error, I'd prefer to raise TypeError instead because the use of the
struct module should be an implementation detail.

And a final question: integers with '2 ** 63 <= value < 2 ** 64' (e.g. values that are in the range of uint64_t but not in the range of int64_t) can be written to a binary plist, but will be read back as a negative value (which is the same behavior as in Apple's code). Should we warn about this in the documentation?

I'll post an updated patch later today.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14455>
_______________________________________


More information about the Python-bugs-list mailing list