- Notifications
You must be signed in to change notification settings - Fork538
Commitfc914d5
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 animplicit resolver with an unspecified first character).For example, every time `foo` is encountered, the "wildcard implicitresolvers" (with `first=None`) will be appended to the list of implicitresolvers for strings starting with `f`, which will normally be theresolver for booleans. The list `yaml_implicit_resolvers['f']` will keepgetting longer. The same behavior applies for any first-letter matcheswith existing implicit resolvers.This change avoids unintentionally mutating the lists in the class-leveldict `yaml_implicit_resolvers` by looping through a temporary copy.Fixes:#4391 parenta001f27 commitfc914d5
2 files changed
+4
-4
lines changedLines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
146 | 146 |
| |
147 | 147 |
| |
148 | 148 |
| |
149 |
| - | |
150 |
| - | |
| 149 | + | |
| 150 | + | |
151 | 151 |
| |
152 | 152 |
| |
153 | 153 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
146 | 146 |
| |
147 | 147 |
| |
148 | 148 |
| |
149 |
| - | |
150 |
| - | |
| 149 | + | |
| 150 | + | |
151 | 151 |
| |
152 | 152 |
| |
153 | 153 |
| |
|
0 commit comments
Comments
(0)