File tree 6 files changed +8
-18
lines changed
mysql-connector-python/lib/mysql/connector
6 files changed +8
-18
lines changed Original file line number Diff line number Diff line change 12
12
======
13
13
14
14
- WL#16327: Remove Cursors Prepared Raw and Named Tuple
15
+ - BUG#37541353: (Contribution) Fix typing annotation of MySQLConnectionAbstract's close function
15
16
- BUG#37453587: Github links in PyPI project's pages do not work
16
17
- BUG#37418436: Arbitrary File Read in MySQL Python Client library
17
18
Original file line number Diff line number Diff line change 46
46
Any ,
47
47
BinaryIO ,
48
48
Callable ,
49
+ ClassVar ,
49
50
Deque ,
50
51
Dict ,
51
52
Generator ,
@@ -1494,7 +1495,7 @@ def _post_connection(self) -> None:
1494
1495
self ._execute_query (self ._init_command )
1495
1496
1496
1497
@abstractmethod
1497
- def disconnect (self ) -> None :
1498
+ def close (self ) -> None :
1498
1499
"""Disconnects from the MySQL server.
1499
1500
1500
1501
This method tries to send a `QUIT` command and close the socket. It raises
@@ -1507,7 +1508,7 @@ def disconnect(self) -> None:
1507
1508
use `shutdown()`.
1508
1509
"""
1509
1510
1510
- close : Callable [[], Any ] = disconnect
1511
+ disconnect : ClassVar [ Callable [["MySQLConnectionAbstract" ], None ]] = close
1511
1512
1512
1513
def connect (self , ** kwargs : Any ) -> None :
1513
1514
"""Connects to the MySQL server.
Original file line number Diff line number Diff line change 48
48
TYPE_CHECKING ,
49
49
Any ,
50
50
AsyncGenerator ,
51
+ Awaitable ,
51
52
BinaryIO ,
52
53
Callable ,
54
+ ClassVar ,
53
55
Deque ,
54
56
Dict ,
55
57
Generator ,
@@ -1445,7 +1447,7 @@ async def close(self) -> None:
1445
1447
no exceptions.
1446
1448
"""
1447
1449
1448
- disconnect : Callable [[], Any ] = close
1450
+ disconnect : ClassVar [ Callable [["MySQLConnectionAbstract" ], Awaitable [ None ]] ] = close
1449
1451
1450
1452
@abstractmethod
1451
1453
async def cursor (
Original file line number Diff line number Diff line change 47
47
Any ,
48
48
AsyncGenerator ,
49
49
BinaryIO ,
50
- Callable ,
51
50
Dict ,
52
51
List ,
53
52
Mapping ,
@@ -750,17 +749,6 @@ async def shutdown(self) -> None:
750
749
pass # Getting an exception would mean we are disconnected.
751
750
752
751
async def close (self ) -> None :
753
- """Close the connection.
754
-
755
- It closes any opened cursor associated to this connection, and closes the
756
- underling socket connection.
757
-
758
- `MySQLConnection.close()` is a synonymous for `MySQLConnection.disconnect()`
759
- method name and more commonly used.
760
-
761
- This method tries to send a `QUIT` command and close the socket. It raises
762
- no exceptions.
763
- """
764
752
with contextlib .suppress (Error ):
765
753
for cursor in tuple (self ._cursors ):
766
754
await cursor .close ()
@@ -773,7 +761,7 @@ async def close(self) -> None:
773
761
await self ._socket .close_connection ()
774
762
self ._socket = None
775
763
776
- disconnect : Callable [[], Any ] = close
764
+ disconnect = close
777
765
778
766
async def cursor (
779
767
self ,
Original file line number Diff line number Diff line change @@ -449,7 +449,6 @@ def shutdown(self) -> None:
449
449
pass # Getting an exception would mean we are disconnected.
450
450
451
451
def close (self ) -> None :
452
- """Disconnect from the MySQL server"""
453
452
if self ._span and self ._span .is_recording ():
454
453
# pylint: disable=possibly-used-before-assignment
455
454
record_exception_event (self ._span , sys .exc_info ()[1 ])
Original file line number Diff line number Diff line change @@ -377,7 +377,6 @@ def _open_connection(self) -> None:
377
377
warn_ciphersuites_deprecated (cipher , tls_version )
378
378
379
379
def close (self ) -> None :
380
- """Disconnect from the MySQL server"""
381
380
if self ._span and self ._span .is_recording ():
382
381
# pylint: disable=possibly-used-before-assignment
383
382
record_exception_event (self ._span , sys .exc_info ()[1 ])
You can’t perform that action at this time.
0 commit comments