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