mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
Issue #21888: plistlib's load() and loads() now work if the fmt parameter is
specified.
This commit is contained in:
parent
64a1207280
commit
8966759b03
3 changed files with 11 additions and 5 deletions
|
@ -984,18 +984,16 @@ def load(fp, *, fmt=None, use_builtin_types=True, dict_type=dict):
|
|||
fp.seek(0)
|
||||
for info in _FORMATS.values():
|
||||
if info['detect'](header):
|
||||
p = info['parser'](
|
||||
use_builtin_types=use_builtin_types,
|
||||
dict_type=dict_type,
|
||||
)
|
||||
P = info['parser']
|
||||
break
|
||||
|
||||
else:
|
||||
raise InvalidFileException()
|
||||
|
||||
else:
|
||||
p = _FORMATS[fmt]['parser'](use_builtin_types=use_builtin_types)
|
||||
P = _FORMATS[fmt]['parser']
|
||||
|
||||
p = P(use_builtin_types=use_builtin_types, dict_type=dict_type)
|
||||
return p.parse(fp)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue