8000 Fix LOAD DATA LOCAL INFILE write EOF packet on closed connection. (#1… · PyMySQL/PyMySQL@bd3bd01 · GitHub
[go: up one dir, main page]

Skip to content

Commit bd3bd01

Browse files
authored
Fix LOAD DATA LOCAL INFILE write EOF packet on closed connection. (#1116)
Fix #989
1 parent bfbc6a5 commit bd3bd01

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@
1313
/pymysql/tests/databases.json
1414
__pycache__
1515
Pipfile.lock
16+
pdm.lock

pymysql/connections.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -1370,7 +1370,7 @@ def send_data(self):
13701370
"""Send data packets from the local file to the server"""
13711371
if not self.connection._sock:
13721372
raise err.InterfaceError(0, "")
1373-
conn = self.connection
1373+
conn: Connection = self.connection
13741374

13751375
try:
13761376
with open(self.filename, "rb") as open_file:
@@ -1388,5 +1388,6 @@ def send_data(self):
13881388
f"Can't find file '{self.filename}'",
13891389
)
13901390
finally:
1391-
# send the empty packet to signify we are done sending data
1392-
conn.write_packet(b"")
1391+
if not conn._closed:
1392+
# send the empty packet to signify we are done sending data
1393+
conn.write_packet(b"")

0 commit comments

Comments
 (0)
0