[issue38777] plist handling of real data type

2019-11-12 Thread David Nicolson


David Nicolson  added the comment:

It looks like it's just inconsistency in plutil that is causing the confusion.

/usr/libexec/PlistBuddy -c Print test.plist
Dict {
FloatExample2 = 0.10
FloatExample3 = 100.00
FloatExample = 0.00
}

cat test.plist | plutil -convert xml1 -o - -- -

http://www.apple.com/DTDs/PropertyList-1.0.dtd";>


FloatExample
0.0
FloatExample2
0.10001
FloatExample3
100



--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue38777>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38777] plist handling of real data type

2019-11-12 Thread David Nicolson


New submission from David Nicolson :

Converting float values stored as strings with the real data type can result in 
an integer value or a rounding error.

import plistlib

xml = """
http://www.apple.com/DTDs/PropertyList-1.0.dtd";>


FloatExample
100.0
FloatExample2
0.1


"""

pl = plistlib.loads(str.encode(xml), fmt=plistlib.FMT_XML)
with open('test.plist', 'wb') as fp:
  plistlib.dump(pl, fp, fmt=plistlib.FMT_BINARY)

cat test.plist | plutil -convert xml1 -o - -- -

http://www.apple.com/DTDs/PropertyList-1.0.dtd";>


FloatExample
100
FloatExample2
0.10001



This might be related to the following issue:

https://bugs.python.org/issue14896

--
messages: 356440
nosy: David Nicolson
priority: normal
severity: normal
status: open
title: plist handling of real data type
type: behavior
versions: Python 3.8

___
Python tracker 
<https://bugs.python.org/issue38777>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com