]> arthur.barton.de Git - bup.git/commitdiff
PackWriter_remote: init remote_closed in __new__, not __init__
authorRob Browning <rlb@defaultvalue.org>
Tue, 28 Jun 2022 21:34:57 +0000 (16:34 -0500)
committerRob Browning <rlb@defaultvalue.org>
Sun, 14 Aug 2022 19:07:15 +0000 (14:07 -0500)
So that it's always set during __del__.  Otherwise it might not exist
if (for example) __new__ or the superclass methods throw an exception
before we get to __init__.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
lib/bup/client.py

index 0942be0ca9c4c25398487292ff8c01f02041927a..5873a8f33d32b8c4996c9dd624fbc38a496270ef 100644 (file)
@@ -509,6 +509,11 @@ class Client:
 # FIXME: disentangle this (stop inheriting) from PackWriter
 class PackWriter_Remote(git.PackWriter):
 
+    def __new__(cls, *args, **kwargs):
+        result = super().__new__(cls)
+        result.remote_closed = True  # supports __del__
+        return result
+
     def __init__(self, conn, objcache_maker, suggest_packs,
                  onopen, onclose,
                  ensure_busy,