Moved case transformation before initialization check

This commit is contained in:
Andrew Murray 2021-02-05 20:28:34 +11:00
parent 0c1675a143
commit 587e073dac

View File

@ -2922,10 +2922,11 @@ def open(fp, mode="r", formats=None):
def _open_core(fp, filename, prefix, formats):
for i in formats:
i = i.upper()
if i not in OPEN:
init()
try:
factory, accept = OPEN[i.upper()]
factory, accept = OPEN[i]
result = not accept or accept(prefix)
if type(result) in [str, bytes]:
accept_warnings.append(result)