[all-commits] [llvm/llvm-project] 240a9c: [MLIR][Python] Allow `Attribute` to denote unconst...

Twice via All-commits all-commits at lists.llvm.org
Fri Sep 25 19:54:21 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 240a9cb75dd9210cae8e987700d0ef6537b723cb
      https://github.com/llvm/llvm-project/commit/240a9cb75dd9210cae8e987700d0ef6537b723cb
  Author: Twice <twice at apache.org>
  Date:   2026-09-26 (Sat, 26 Sep 2026)

  Changed paths:
    M mlir/python/mlir/dialects/ext.py
    M mlir/test/python/dialects/ext.py

  Log Message:
  -----------
  [MLIR][Python] Allow `Attribute` to denote unconstrained attributes in Python-defined ops (#224679)

Operation definitions support attribute constraints such as
`IntegerAttr`, `StringAttr`, and `IntegerAttr | StringAttr`, but
currently reject `Attribute` itself.

This change allows `Attribute` to denote an unconstrained attribute,
accepting both built-in and Python-defined attributes:

```python
class MyOp(MyDialect.Operation, name="my_op"):
    arg: Operand
    attr: Attribute
    res: Result
```

This complements the unconstrained `Operand` and `Result` annotations
introduced in #220216. The annotation also works with `attribute()`
field specifiers, including `kw_only` and `default_factory`.

Assisted-by: Codex / GPT6



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