WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Conversation

@fangyi-zhou
Copy link
Contributor

@fangyi-zhou fangyi-zhou commented Dec 8, 2025

Summary

As per title, this diff addresses the last remaining issue in the
conformance test protocols_explicit.py by requiring declared classvar
members to be initialised for protocols.

The exception is that uninitialised class variables in interface files are not considered abstract. This exception is necessary to get around issues in typeshed.

Test Plan

python test.py

@meta-cla meta-cla bot added the cla signed label Dec 8, 2025
@yangdanny97 yangdanny97 self-assigned this Dec 9, 2025
@yangdanny97
Copy link
Contributor

We may need to special-case __hash__, or update typeshed to add a pyrefly: ignore (pref the former, Mypy only added the type ignore because the referenced change was in typeshed & mypy's behavior was pre-existing)

python/typeshed#2148

As per title, this diff addresses the last remaining issue in the
conformance test `protocols_explicit.py` by requiring declared classvar
members to be initialised for protocols.
@fangyi-zhou fangyi-zhou force-pushed the uninit-classvar-is-abstract branch from aec4db2 to 31b6e61 Compare December 9, 2025 23:09
@fangyi-zhou fangyi-zhou force-pushed the uninit-classvar-is-abstract branch from 31b6e61 to 212887d Compare December 9, 2025 23:11
@fangyi-zhou
Copy link
Contributor Author

Got another issue with typeshed:

I start to think we should not consider ClassVar declarations in .pyi files as abstract, does that sound reasonable?

@meta-codesync
Copy link

meta-codesync bot commented Dec 11, 2025

@yangdanny97 has imported this pull request. If you are a Meta employee, you can view this in D88902254.

@yangdanny97
Copy link
Contributor

I start to think we should not consider ClassVar declarations in .pyi files as abstract

How widespread is it?

I think it sounds reasonable to exclude ClassVars in stubs for now, especially if it's common.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants