|
33 | 33 | Optional, |
34 | 34 | Set, |
35 | 35 | TYPE_CHECKING, |
36 | | - Tuple, |
37 | 36 | Union, |
38 | 37 | ) |
39 | 38 |
|
@@ -392,8 +391,8 @@ def __init__( |
392 | 391 | # Guarded by its own lock — cancel can race execute teardown. |
393 | 392 | self._sync_cancellers: Dict[int, Any] = {} |
394 | 393 | self._sync_cancellers_lock = threading.RLock() |
395 | | - # Retain the mutable owner until its transfer completes; dropping it cancels the result. |
396 | | - self._volume_handles: Dict[str, Tuple[Any, Any]] = {} |
| 394 | + # Volume transfers remain cancellable after synchronous SQL execution returns. |
| 395 | + self._volume_handles: Dict[str, Any] = {} |
397 | 396 |
|
398 | 397 | # ── Session lifecycle ────────────────────────────────────────── |
399 | 398 |
|
@@ -639,8 +638,7 @@ def execute_command( |
639 | 638 | if executed.is_volume_operation: |
640 | 639 | with self._sync_cancellers_lock: |
641 | 640 | self._volume_handles[command_id.guid] = ( |
642 | | - stmt, |
643 | | - self._sync_cancellers.get(id(cursor)), |
| 641 | + self._sync_cancellers.get(id(cursor)) |
644 | 642 | ) |
645 | 643 | # Execute succeeded: the kernel now owns the statement |
646 | 644 | # lifecycle. It auto-closes the server statement when the |
@@ -722,8 +720,7 @@ def finish_volume_operation(self, command_id: CommandId) -> None: |
722 | 720 |
|
723 | 721 | def cancel_command(self, command_id: CommandId) -> None: |
724 | 722 | with self._sync_cancellers_lock: |
725 | | - volume = self._volume_handles.get(command_id.guid) |
726 | | - handle = volume[1] if volume is not None else None |
| 723 | + handle = self._volume_handles.get(command_id.guid) |
727 | 724 | if handle is None: |
728 | 725 | with self._async_handles_lock: |
729 | 726 | handle = self._async_handles.get(command_id.guid) |
|
0 commit comments