[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 

___
___
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 Ronald Oussoren


Ronald Oussoren  added the comment:

I don't think this is a bug. The value's in the plutil output are correct, and 
marked up with the correct type in both cases. 

The difference between 0.1 and 0.10001 is the usual problem with 
floating point representation (see the python.org FAQ).  Plutil uses a 
different algorithm for printing float's than Python, but both evaluate to the 
same binary representation for the float value.

--

___
Python tracker 

___
___
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 Serhiy Storchaka


Serhiy Storchaka  added the comment:

This looks like a plutil issue.

--
nosy: +ronaldoussoren, serhiy.storchaka

___
Python tracker 

___
___
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 Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +ned.deily

___
Python tracker 

___
___
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 

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