Skip to content

cannot connect: no attribute '_auth_plugin_name' #86

@t184256

Description

@t184256

Cannot use asyncmy to connect to a specific server, while aiomysql works.

$ /usr/bin/python3 -m asyncio
...
>>> import aiomysql
>>> c = await aiomysql.connect(...)  # works fine
>>> import asyncmy
>>> c = await asyncmy.connect(...)
Traceback (most recent call last):
  File "/usr/lib64/python3.12/concurrent/futures/_base.py", line 456, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.12/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "<console>", line 1, in <module>
  File "asyncmy/connection.pyx", line 1343, in _connect
  File "asyncmy/connection.pyx", line 594, in connect
  File "asyncmy/connection.pyx", line 572, in asyncmy.connection.Connection.connect
  File "asyncmy/connection.pyx", line 787, in _request_authentication
AttributeError: 'Connection' object has no attribute '_auth_plugin_name'. Did you mean: '_auth_plugin_map'?

Code inspection suggests that _request_authentication uses _auth_plugin_name unconditionally:

if self._auth_plugin_name == "":

... while it's only set if a certain condition is met:

if self.server_capabilities & PLUGIN_AUTH and len(data) >= i:

Should it have some default pre-set?

Version: python3-asyncmy-0.2.9-1.fc39.x86_64
Server reports itself as MariaDB, Server version: 5.1.73-log Source distribution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions