From: Rob Browning Date: Tue, 28 Jun 2022 21:34:57 +0000 (-0500) Subject: PackWriter_remote: init remote_closed in __new__, not __init__ X-Git-Url: https://arthur.ath.cx/gitweb/?a=commitdiff_plain;h=85ffd63f8318b0c1fb39b097a68bc90748c2dfcc;p=bup.git PackWriter_remote: init remote_closed in __new__, not __init__ 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 Tested-by: Rob Browning --- diff --git a/lib/bup/client.py b/lib/bup/client.py index 0942be0..5873a8f 100644 --- a/lib/bup/client.py +++ b/lib/bup/client.py @@ -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,