Merge pull request #5037 from radarhere/formats

init() if one of the formats is unrecognised
This commit is contained in:
Hugo van Kemenade 2020-11-11 13:33:39 +02:00 committed by GitHub
commit 0bb6a19cbf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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)