Skip to content

Commit c8d6a7f

Browse files
serge-sans-pailleahal
authored andcommitted
Faster yaml loading using the native loader if available
1 parent d1dabab commit c8d6a7f

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,5 +58,6 @@ exclude = [ # TODO fix errors in these files
5858
"src/taskgraph/util/taskcluster.py",
5959
"src/taskgraph/util/vcs.py",
6060
"src/taskgraph/util/workertypes.py",
61+
"src/taskgraph/util/yaml.py",
6162
]
6263
reportIncompatibleMethodOverride = false

src/taskgraph/util/yaml.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,12 @@
44

55

66
import os
7+
import typing
78

8-
from yaml.loader import SafeLoader
9+
try:
10+
from yaml import CSafeLoader as SafeLoader
11+
except ImportError:
12+
from yaml import SafeLoader
913

1014

1115
class UnicodeLoader(SafeLoader):

0 commit comments

Comments
 (0)