summaryrefslogtreecommitdiff
path: root/mlir/lib/Bindings/Python/MainModule.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'mlir/lib/Bindings/Python/MainModule.cpp')
-rw-r--r--mlir/lib/Bindings/Python/MainModule.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/mlir/lib/Bindings/Python/MainModule.cpp b/mlir/lib/Bindings/Python/MainModule.cpp
index d7282b3d6f71..a14f09f77d2c 100644
--- a/mlir/lib/Bindings/Python/MainModule.cpp
+++ b/mlir/lib/Bindings/Python/MainModule.cpp
@@ -52,9 +52,14 @@ NB_MODULE(_mlir, m) {
[](PyGlobals &self, bool enabled) {
self.getTracebackLoc().setLocTracebacksEnabled(enabled);
})
+ .def("loc_tracebacks_frame_limit",
+ [](PyGlobals &self) {
+ return self.getTracebackLoc().locTracebackFramesLimit();
+ })
.def("set_loc_tracebacks_frame_limit",
- [](PyGlobals &self, int n) {
- self.getTracebackLoc().setLocTracebackFramesLimit(n);
+ [](PyGlobals &self, std::optional<int> n) {
+ self.getTracebackLoc().setLocTracebackFramesLimit(
+ n.value_or(PyGlobals::TracebackLoc::kMaxFrames));
})
.def("register_traceback_file_inclusion",
[](PyGlobals &self, const std::string &filename) {