[issue24040] plistlib assumes dict_type is descendent of dict

Ronald Oussoren report at bugs.python.org
Mon Apr 27 13:02:07 CEST 2015


Ronald Oussoren added the comment:

To react to myself: checking for self.dict_type might break users that pass in a callable:

   x = plistlib.load(fp, dict_type=lambda:{})

As Behdad memtioned testing that the type isn't list would be better:

   if not isinstance(..., list):


That attached patch adds a testcase and removes replaces the test for type({}) for something better. 

Note: it also replaces ``type([])`` with ``list``, the latter is cleaner.

----------
Added file: http://bugs.python.org/file39215/issue-24040.txt

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


More information about the Python-bugs-list mailing list