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.
Created on 2013年03月04日 20:33 by jfortier, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| deeply-nested-plist.py | ronaldoussoren, 2013年04月15日 12:45 | |||
| issue-17353.txt | ronaldoussoren, 2013年04月15日 12:46 | review | ||
| issue-17353-tests.txt | mmilkin, 2013年04月17日 00:37 | review | ||
| Messages (13) | |||
|---|---|---|---|
| msg183496 - (view) | Author: Jacques Fortier (jfortier) | Date: 2013年03月04日 20:33 | |
To reproduce:
import plistlib
print plistlib.writePlistToString([[[[[[[[[{'test': plistlib.Data('aaaaaa')}]]]]]]]]])
Compare to:
print plistlib.writePlistToString([[[[[[[[{'test': Data('aaaaaa')}]]]]]]]])
It looks like the max line length calculation in the Data class is causing the output to be empty once you get nested far enough.
|
|||
| msg183497 - (view) | Author: Jacques Fortier (jfortier) | Date: 2013年03月04日 20:36 | |
My second print should have been:
print plistlib.writePlistToString([[[[[[[[{'test': plistlib.Data('aaaaaa')}]]]]]]]])
|
|||
| msg183509 - (view) | Author: Jacques Fortier (jfortier) | Date: 2013年03月05日 05:15 | |
Quick source inspection suggests this is present in the latest version. |
|||
| msg183525 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2013年03月05日 13:34 | |
We should limit the indentation to be less than the maximal line length. |
|||
| msg186929 - (view) | Author: Mike Milkin (mmilkin) * | Date: 2013年04月14日 17:07 | |
Looks like plistlib.writePlistToString is no loger in the plistlib. |
|||
| msg186941 - (view) | Author: Ezio Melotti (ezio.melotti) * (Python committer) | Date: 2013年04月14日 18:06 | |
On 3.x it's called writePlistToBytes, and it seems to have the same issue. |
|||
| msg186944 - (view) | Author: Mike Milkin (mmilkin) * | Date: 2013年04月14日 18:57 | |
Yep you are correct.
>>>
plistlib.readPlistFromBytes(plistlib.writePlistToBytes([[[[[[[[{'test': plistlib.Data(b'aaaaaa')}]]]]]]]]))
[[[[[[[[{'test': Data(b'aaaaaa')}]]]]]]]]
>>> plistlib.readPlistFromBytes(plistlib.writePlistToBytes([[[[[[[[[{'test': plistlib.Data(b'aaaaaa')}]]]]]]]]]))
[[[[[[[[[{'test': Data(b'')}]]]]]]]]]
I presume we want to raise a ValueError if the indentation is more than the maximal line length.
|
|||
| msg186967 - (view) | Author: Ezio Melotti (ezio.melotti) * (Python committer) | Date: 2013年04月15日 03:26 | |
If possible it would be better to still generate a valid output, possibly by limiting the indentation or removing it after a certain point. However I don't know if there are any restrictions that should be followed while generating a plist (What happens if the line is too long? Is the indentation required?). |
|||
| msg186981 - (view) | Author: Ronald Oussoren (ronaldoussoren) * (Python committer) | Date: 2013年04月15日 12:45 | |
I agree that plistlib shouldn't raise an exception for data that can represented as a valid plist file. I've checked that the Cocoa class for generating plist files will happily create a plist file when the data is nested 100 levels deep. In that case NSData values generate lines of 12 characters long. An unrelated issue: PlistWriter.writeValue should treat bytes instances the same as Data instances in Python 3. That would be a (small) feature enhencement, and hence can only be done for Python 3.4. |
|||
| msg186982 - (view) | Author: Ronald Oussoren (ronaldoussoren) * (Python committer) | Date: 2013年04月15日 12:46 | |
The attach patch should fix the issue (but there needs to be a unittest as well). |
|||
| msg187127 - (view) | Author: Mike Milkin (mmilkin) * | Date: 2013年04月17日 00:37 | |
Adding tests. |
|||
| msg187153 - (view) | Author: Ronald Oussoren (ronaldoussoren) * (Python committer) | Date: 2013年04月17日 10:45 | |
The tests look good, thanks for writing them. |
|||
| msg187629 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2013年04月23日 11:50 | |
New changeset a389700fbc74 by Ronald Oussoren in branch '2.7': Ensure that plistlib doesn't corrupt deeply nested datastructures http://hg.python.org/cpython/rev/a389700fbc74 New changeset 6a8cb4875ac6 by Ronald Oussoren in branch '3.3': Ensure that plistlib doesn't corrupt deeply nested datastructures http://hg.python.org/cpython/rev/6a8cb4875ac6 New changeset e0c0bcd60033 by Ronald Oussoren in branch 'default': (3.3->default) Ensure that plistlib doesn't corrupt deeply nested datastructures http://hg.python.org/cpython/rev/e0c0bcd60033 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:42 | admin | set | github: 61555 |
| 2013年04月23日 11:51:27 | ronaldoussoren | set | status: open -> closed resolution: fixed |
| 2013年04月23日 11:50:53 | python-dev | set | nosy:
+ python-dev messages: + msg187629 |
| 2013年04月17日 10:45:22 | ronaldoussoren | set | messages: + msg187153 |
| 2013年04月17日 00:37:02 | mmilkin | set | files:
+ issue-17353-tests.txt messages: + msg187127 |
| 2013年04月15日 12:46:24 | ronaldoussoren | set | files:
+ issue-17353.txt messages: + msg186982 |
| 2013年04月15日 12:45:19 | ronaldoussoren | set | files:
+ deeply-nested-plist.py messages: + msg186981 |
| 2013年04月15日 03:26:44 | ezio.melotti | set | messages: + msg186967 |
| 2013年04月14日 18:57:31 | mmilkin | set | messages: + msg186944 |
| 2013年04月14日 18:06:12 | ezio.melotti | set | messages:
+ msg186941 versions: - Python 3.2 |
| 2013年04月14日 17:07:13 | mmilkin | set | nosy:
+ mmilkin messages: + msg186929 |
| 2013年03月11日 20:05:22 | ezio.melotti | set | keywords:
+ easy nosy: + ezio.melotti |
| 2013年03月05日 13:34:04 | serhiy.storchaka | set | assignee: ronaldoussoren type: behavior components: + macOS versions: + Python 3.2, Python 3.3, - Python 3.5 nosy: + serhiy.storchaka, ronaldoussoren messages: + msg183525 stage: needs patch |
| 2013年03月05日 05:15:17 | jfortier | set | messages:
+ msg183509 versions: + Python 3.4, Python 3.5 |
| 2013年03月04日 20:36:20 | jfortier | set | messages: + msg183497 |
| 2013年03月04日 20:33:35 | jfortier | create | |