Skip to content

[PyMySQL] Fix issue with import constants attributes #14393

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

Merged
merged 2 commits into from
Jul 10, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions stubs/PyMySQL/@tests/stubtest_allowlist.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# DictCursorMixin changes method types of inherited classes, but doesn't contain much at runtime
pymysql.cursors.DictCursorMixin.__iter__
pymysql.cursors.DictCursorMixin.fetch[a-z]*

# Not present in stubs, see Issue #14392:
pymysql.__all__
pymysql.constants
11 changes: 5 additions & 6 deletions stubs/PyMySQL/pymysql/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ from _typeshed import ReadableBuffer
from collections.abc import Iterable
from typing import Final, SupportsBytes, SupportsIndex

from . import connections, constants, converters, cursors
from .connections import Connection as Connection
from . import connections as connections, converters as converters, cursors as cursors
from .constants import FIELD_TYPE as FIELD_TYPE
from .err import (
DatabaseError as DatabaseError,
Expand Down Expand Up @@ -58,9 +57,9 @@ def thread_safe() -> bool: ...

NULL: str

# pymysql/__init__.py says "Connect = connect = Connection = connections.Connection"
Connect = Connection
connect = Connection
Connect = connections.Connection
connect = connections.Connection
Connection = connections.Connection

__all__ = [
"BINARY",
Expand Down Expand Up @@ -96,7 +95,7 @@ __all__ = [
"apilevel",
"connect",
"connections",
"constants",
"constants", # noqa: F822
"converters",
"cursors",
"get_client_info",
Expand Down
Loading