init() if one of the formats is unrecognised

This commit is contained in:
Andrew Murray 2020-11-11 21:05:57 +11:00
parent 2d6e51e26c
commit 7e2015c75f

View File

@ -2905,6 +2905,8 @@ def open(fp, mode="r", formats=None):
def _open_core(fp, filename, prefix, formats):
for i in formats:
if i not in OPEN:
init()
try:
factory, accept = OPEN[i]
result = not accept or accept(prefix)