Skip to content

Commit b931aab

Browse files
author
James William Pye
committed
Comments.
1 parent 06f3589 commit b931aab

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

postgresql/copyman.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -614,15 +614,16 @@ def __exit__(self, typ, val, tb):
614614
# faults. However, exit should *not* be called in those cases.
615615
##
616616
elif typ is None:
617-
# Success.
617+
# Success?
618618
self.xact.messages = self.xact.CopyDoneSequence
619+
# If not, this will blow up.
619620
self.statement.database._pq_complete()
620621
# Find the complete message for command and count.
621622
for x in self.xact.messages_received():
622623
if getattr(x, 'type', None) == Complete.type:
623624
self._complete_message = x
624625
elif issubclass(typ, Exception):
625-
# Likely raises.
626+
# Likely raises. CopyManager should trap.
626627
self.statement.database._pq_complete()
627628

628629
return super().__exit__(typ, val, tb)
@@ -702,7 +703,7 @@ def __exit__(self, typ, val, tb):
702703
# for when the receivers are not on a message boundary.
703704
##
704705
if typ is not None and not issubclass(typ, Exception):
705-
# Don't recover on interrupts.
706+
# Don't bother, it's an interrupt or sufficient resources.
706707
return
707708

708709
profail = None
@@ -741,7 +742,7 @@ def __exit__(self, typ, val, tb):
741742
if typ or exit_faults or profail:
742743
raise CopyFail(self,
743744
"could not complete the COPY operation",
744-
receiver_faults = exit_faults,
745+
receiver_faults = exit_faults or None,
745746
producer_fault = profail
746747
)
747748

0 commit comments

Comments
 (0)