[Mlir-commits] [mlir] A few tweaks to the MLIR .pyi files (PR #110488)
Maksim Levental
llvmlistbot at llvm.org
Mon Sep 30 18:02:16 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: ...
----------------
makslevental wrote:
> It will break if the type checker enforces a specific Python version on type stubs.
That's not correct - it will raise a `TypeError` in just vanilla python:
```python
$ conda create -n throwaway python=3.8
$ conda activate throwaway
(throwaway) $ python -c "def fun(a: int | float): pass"
Traceback (most recent call last):
File "<string>", line 1, in <module>
TypeError: unsupported operand type(s) for |: 'type' and 'type'
```
https://github.com/llvm/llvm-project/pull/110488
More information about the Mlir-commits
mailing list