[all-commits] [llvm/llvm-project] 421bc7: [MLIR] [Python] Fixed a few issues in the type ann...

Sergei Lebedev via All-commits all-commits at lists.llvm.org
Sun Mar 8 06:22:26 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 421bc73cffe783fd82903d3d335ac238376b4682
      https://github.com/llvm/llvm-project/commit/421bc73cffe783fd82903d3d335ac238376b4682
  Author: Sergei Lebedev <185856+superbobry at users.noreply.github.com>
  Date:   2026-03-08 (Sun, 08 Mar 2026)

  Changed paths:
    M mlir/cmake/modules/AddMLIRPython.cmake
    M mlir/include/mlir/Bindings/Python/IRAttributes.h
    M mlir/include/mlir/Bindings/Python/IRCore.h
    M mlir/lib/Bindings/Python/IRAttributes.cpp
    M mlir/lib/Bindings/Python/IRCore.cpp
    M mlir/python/mlir/ir.py

  Log Message:
  -----------
  [MLIR] [Python] Fixed a few issues in the type annotations (#183021)

* Removed an explicit `nb::sig` for `static_typeid`. The inferred type
would
work just fine, and unqualified `TypeID`, which was there previously,
only
  really works for core types in the `ir` submodule.
* `DefaultingPyMlir*` helpers also produce qualified types, e.g.
  `_mlir.ir.Location` instead of bare `Location`.
* `ir.*.__enter__` now returns a concrete type instead of `object`, e.g.
  `ir.Context.__enter__` returns `Context`.
* `loc_tracebacks` uses `Generator` as the return type, since this is
what
  `contextmanager` expects in typeshed.
* Changed static methods on subclasses of `DenseElementsAttribute` to
return
  that concrete subclass, instead of `DenseElementsAttribute`.

---------

Co-authored-by: Maksim Levental <maksim.levental at gmail.com>



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list