import configparser
import time
for N in (10000, 20000, 30000, 40000):
cfg = (
"[section]" +
"\n" + "x" + " " * N + "y" + "\n"
)
parser = configparser.RawConfigParser()
s = time.perf_counter()
try: parser.read_string(cfg)
except: pass
t = time.perf_counter() - s
print(f"{N} {t}")
10000 0.5478692570177373
20000 2.175520057004178
30000 4.97204191898345
40000 8.673784376995172
Bug report
Bug description:
Found by OSS Fuzz in #461069020.
The below reproducer:
reveals the quadratic behaviour:
CPython versions tested on:
CPython main branch
Operating systems tested on:
No response
Linked PRs