You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Stubtest thinks a property alias isn't read-only in stubs #19509
I was using #6700 to track support for aliasing property. But even after #19297 (I just tested against mypy on master), stubtest gives the following error (example using pika):
error: pika.adapters.blocking_connection.BlockingConnection.exchange_exchange_bindings is read-only at runtime but not in the stub
Stub: in file E:\Users\Avasam\Documents\Git\typeshed\stubs\pika\pika\adapters\blocking_connection.pyi:88
def (self: pika.adapters.blocking_connection.BlockingConnection) -> builtins.bool
Runtime:
<property object at 0x000001E022E79B70>
To Reproduce
# RuntimeclassBlockingConnection:
@propertydefexchange_exchange_bindings_supported(self):
returnTrueexchange_exchange_bindings=exchange_exchange_bindings_supported# StubclassBlockingConnection:
@propertydefexchange_exchange_bindings_supported(self) ->bool: ...
# error: exchange_exchange_bindings is read-only at runtime but not in the stubexchange_exchange_bindings=exchange_exchange_bindings_supported
Expected Behavior
There should be no stubtest error for valid property aliases.
Actual Behavior
(see error above)
Your Environment
Mypy version used: 1.18.0+dev.a56adc82f7dd747f400bb9267ec32b73d22de64e
Mypy command-line flags: (copied from the stubtest run) python.exe -m mypy.stubtest --mypy-config-file C:\Users\Avasam\AppData\Local\Temp\tmp5lugkyw4 --custom-typeshed-dir . pika --allowlist stubs\pika\@tests\stubtest_allowlist.txt
Mypy configuration options from mypy.ini (and other config files):
My bad, I forgot typeshed's stubtest test re-installs mypy in an isolated environment. So it wasn't enough to just update mypy locally, I had to tweak tests to also point to the repo.
Activity
stubtest property alias (python/mypy#19509)
hamdanal commentedon Aug 2, 2025
#19297 actually fixes this issue. Opened #19567 to add a test.
Add stubtest test for property aliases (#19567)
Avasam commentedon Aug 2, 2025
My bad, I forgot typeshed's stubtest test re-installs mypy in an isolated environment. So it wasn't enough to just update mypy locally, I had to tweak tests to also point to the repo.
But thanks for adding a test here !