Skip to content

configparser: quadratic time in ParsingError.combine() when many lines fail to parse #148370

Closed

Description

@StanFromIreland

Bug report

Bug description:

Found by OSS Fuzz in #501627726.

A simplified reproducer:

import time
import configparser

for N in (5000, 10000, 20000, 40000):
    s = '[*]\n' + '=\n' * N
    p = configparser.ConfigParser(strict=False)
    t0 = time.perf_counter()
    try:
        p.read_string(s)
    except configparser.ParsingError:
        pass
    print(f'{N}: {time.perf_counter() - t0}s')

produces:

5000: 0.5495022920076735s
10000: 2.0415573030040832s
20000: 7.589155077002943s
40000: 30.856201829999918s

CPython versions tested on:

CPython main branch

Operating systems tested on:

No response

Linked PRs

Activity

  1. added
    type-bugAn unexpected behavior, bug, or error
    stdlibStandard Library Python modules in the Lib/ directory
    on Apr 11, 2026
  2. adityakrmishra commented on Apr 12, 2026

    @adityakrmishra
  3. picnixz commented on Apr 12, 2026

    @picnixz
  4. self-assigned this
    on Apr 12, 2026
  5. picnixz commented on Apr 12, 2026

    @picnixz
  6. added a commit that references this issue on Apr 12, 2026
  7. removed their assignment
    on Apr 12, 2026
  8. added a commit that references this issue on Apr 13, 2026
  9. added 2 commits that reference this issue on Apr 13, 2026
  10. added 2 commits that reference this issue on Apr 13, 2026
  11. added a commit that references this issue on Apr 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions