New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sqlalchemy.utils.langhelpers.TypingOnly
too rigidly prevents special dunders from appearing
#11334
Comments
sqlalchemy.utils.langhelpers.TypingOnly
__static_attributes__
in sqlalchemy.utils.langhelpers.TypingOnly
__static_attributes__
in sqlalchemy.utils.langhelpers.TypingOnly
sqlalchemy.utils.langhelpers.TypingOnly
too rigidly prevents special dunders from appearing
I think TypingOnly should be changed as follows: diff --git a/lib/sqlalchemy/util/langhelpers.py b/lib/sqlalchemy/util/langhelpers.py
index fe3bd1684..87b3e486c 100644
--- a/lib/sqlalchemy/util/langhelpers.py
+++ b/lib/sqlalchemy/util/langhelpers.py
@@ -1967,13 +1967,7 @@ class TypingOnly:
def __init_subclass__(cls) -> None:
if TypingOnly in cls.__bases__:
remaining = set(cls.__dict__).difference(
- {
- "__module__",
- "__doc__",
- "__slots__",
- "__orig_bases__",
- "__annotations__",
- }
+ {name for name in cls.__dict__ if re.match("^__.+__$", name)}
)
if remaining:
raise AssertionError(
I see you have a PR, let's do it like that. I dont think we should be hardcoding all the dunders here. |
Gotcha, that's better! |
Edgar Ramírez-Mondragón has proposed a fix for this issue in the main branch: Ignore all dunders when checking attributes in |
1 similar comment
Edgar Ramírez-Mondragón has proposed a fix for this issue in the main branch: Ignore all dunders when checking attributes in |
Edgar Ramírez-Mondragón has proposed a fix for this issue in the rel_2_0 branch: Ignore all dunders when checking attributes in |
…elpers.TypingOnly` Fixed an internal class that was testing for unexpected attributes to work correctly under upcoming Python 3.13. Pull request courtesy Edgar Ramírez-Mondragón. Fixes: #11334 Closes: #11335 Pull-request: #11335 Pull-request-sha: babd703 Change-Id: Ia2e7392c9403e25266c7d30b987b577f49d008c0 (cherry picked from commit eb118e2)
Describe the bug
An exception is raised on Python 3.13:
Let me know if this is too premature, specially since greenlet (a current dependency, but I think it'll be dropped for 2.1?) does not currently build on Python 3.13. Otherwise I can submit a quick PR to fix this.
Optional link from https://docs.sqlalchemy.org which documents the behavior that is expected
No response
SQLAlchemy Version in Use
main
DBAPI (i.e. the database driver)
pysqlite
Database Vendor and Major Version
SQLite
Python Version
3.13
Operating system
Linux
To Reproduce
Error
Additional context
The text was updated successfully, but these errors were encountered: