Skip to content

Commit aed73d2

Browse files
authored
[MLIR][Python] hide globals in ir.py (#162339)
We're shadowing the Python builtin function `globals` in `ir.py` and therefore anywhere someone does `from mlir.ir import *`. So hide it.
1 parent 750a361 commit aed73d2

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

mlir/python/mlir/ir.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from ._mlir_libs._mlir import (
1313
register_type_caster,
1414
register_value_caster,
15-
globals,
15+
globals as _globals,
1616
)
1717
from ._mlir_libs import (
1818
get_dialect_registry,
@@ -32,17 +32,17 @@ def loc_tracebacks(*, max_depth: int | None = None) -> Iterable[None]:
3232
max_depth: Maximum number of frames to include in the location.
3333
If None, the default limit is used.
3434
"""
35-
old_enabled = globals.loc_tracebacks_enabled()
36-
old_limit = globals.loc_tracebacks_frame_limit()
35+
old_enabled = _globals.loc_tracebacks_enabled()
36+
old_limit = _globals.loc_tracebacks_frame_limit()
3737
try:
38-
globals.set_loc_tracebacks_frame_limit(max_depth)
38+
_globals.set_loc_tracebacks_frame_limit(max_depth)
3939
if not old_enabled:
40-
globals.set_loc_tracebacks_enabled(True)
40+
_globals.set_loc_tracebacks_enabled(True)
4141
yield
4242
finally:
4343
if not old_enabled:
44-
globals.set_loc_tracebacks_enabled(False)
45-
globals.set_loc_tracebacks_frame_limit(old_limit)
44+
_globals.set_loc_tracebacks_enabled(False)
45+
_globals.set_loc_tracebacks_frame_limit(old_limit)
4646

4747

4848
# Convenience decorator for registering user-friendly Attribute builders.

0 commit comments

Comments
 (0)