[Mlir-commits] [mlir] A few tweaks to the MLIR .pyi files (PR #110488)

Sergei Lebedev llvmlistbot at llvm.org
Mon Sep 30 11:49:44 PDT 2024


================
@@ -26,15 +25,15 @@ class AttributeType(Type):
   def isinstance(type: Type) -> bool: ...
 
   @staticmethod
-  def get(context: Optional[Context] = None) -> AttributeType: ...
+  def get(context: Context | None = None) -> AttributeType: ...
----------------
superbobry wrote:

It will break if the type checker enforces a specific Python version on type stubs. Not sure if that happens in practice.

Note also that this syntax is already used in [`ir.pyi`](https://github.com/llvm/llvm-project/blob/main/mlir/python/mlir/_mlir_libs/_mlir/ir.pyi).

https://github.com/llvm/llvm-project/pull/110488


More information about the Mlir-commits mailing list