Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid repeatedly appending to yaml_implicit_resolvers #441

Merged
merged 1 commit into from Jan 13, 2021

Commits on Sep 18, 2020

  1. Avoid repeatedly appending to yaml_implicit_resolvers

    Repeated calls to `resolve` can experience performance degredation, if
    `add_implicit_resolver` has been called with `first=None` (to add an
    implicit resolver with an unspecified first character).
    
    For example, every time `foo` is encountered, the "wildcard implicit
    resolvers" (with `first=None`) will be appended to the list of implicit
    resolvers for strings starting with `f`, which will normally be the
    resolver for booleans. The list `yaml_implicit_resolvers['f']` will keep
    getting longer. The same behavior applies for any first-letter matches
    with existing implicit resolvers.
    
    This change avoids unintentionally mutating the lists in the class-level
    dict `yaml_implicit_resolvers` by looping through a temporary copy.
    
    Fixes: yaml#439
    psphicas committed Sep 18, 2020
    Copy the full SHA
    8138b37 View commit details
    Browse the repository at this point in the history