Skip to content

Commit ceaec37

Browse files
Update emit.py
1 parent 2c86a00 commit ceaec37

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

mypyc/codegen/emit.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,14 +206,14 @@ def object_annotation(self, obj: object, line: str) -> str:
206206
line_width = self._indent + len(line)
207207

208208
# temporarily override pprint._safe_key
209-
default_safe_key = pprint._safe_key
210-
pprint._safe_key = _mypyc_safe_key
209+
default_safe_key = pprint._safe_key # type: ignore [attr-defined]
210+
pprint._safe_key = _mypyc_safe_key # type: ignore [attr-defined]
211211

212212
# pretty print the object
213213
formatted = pprint.pformat(obj, compact=True, width=max(90 - line_width, 20))
214214

215215
# replace the _safe_key
216-
pprint._safe_key = default_safe_key
216+
pprint._safe_key = default_safe_key # type: ignore [attr-defined]
217217

218218
if any(x in formatted for x in ("/*", "*/", "\0")):
219219
return ""
@@ -1238,7 +1238,7 @@ def c_array_initializer(components: list[str], *, indented: bool = False) -> str
12381238
return "{\n " + ",\n ".join(res) + "\n" + indent + "}"
12391239

12401240

1241-
class _mypyc_safe_key(pprint._safe_key):
1241+
def _mypyc_safe_key(pprint._safe_key): # type: ignore [attr-defined, misc]
12421242
"""A custom sort key implementation for pprint that makes the output deterministic
12431243
for all literal types supported by mypyc.
12441244

0 commit comments

Comments
 (0)