[PATCH 1/2] Metadata: specify __slots__

7 views
Skip to first unread message

Rob Browning

unread,
Aug 20, 2022, 2:14:59 PM8/20/22
to bup-...@googlegroups.com
We're likely to have a lot of these, so might as well save the memory.

Signed-off-by: Rob Browning <r...@defaultvalue.org>
Tested-by: Rob Browning <r...@defaultvalue.org>
---

Pushed.

lib/bup/metadata.py | 3 +++
1 file changed, 3 insertions(+)

diff --git a/lib/bup/metadata.py b/lib/bup/metadata.py
index 83f04f77..7e8329cd 100644
--- a/lib/bup/metadata.py
+++ b/lib/bup/metadata.py
@@ -711,6 +711,9 @@ class Metadata:
raise

def __init__(self):
+ __slots__ = ('mode', 'uid', 'atime', 'mtime', 'ctime',
+ 'path', 'size', 'symlink_target', 'hardlink_target',
+ 'linux_attr', 'linux_xattr', 'posix1e_acl')
self.mode = self.uid = self.gid = self.user = self.group = None
self.atime = self.mtime = self.ctime = None
# optional members
--
2.30.2

Zachary Dremann

unread,
Jun 2, 2023, 11:44:49 PM6/2/23
to bup-list

This looks like just an unused local variable, as far as I can tell. Shouldn't this be in the class itself, not in the __init__ method?

Rob Browning

unread,
Nov 26, 2023, 9:45:46 PM11/26/23
to Zachary Dremann, bup-list
Zachary Dremann <dre...@gmail.com> writes:

> This looks like just an unused local variable, as far as I can tell.
> Shouldn't this be in the class itself, not in the __init__ method?

Yep. Thanks much.

https://github.com/bup/bup/commit/963a3d94692ecacf24cd49c38e939f7f756e7600

...and thanks to Johannes Berg for reminding me you'd already pointed
this out.

--
Rob Browning
rlb @defaultvalue.org and @debian.org
GPG as of 2011-07-10 E6A9 DA3C C9FD 1FF8 C676 D2C4 C0F0 39E9 ED1B 597A
GPG as of 2002-11-03 14DD 432F AE39 534D B592 F9A0 25C8 D377 8C7E 73A4
Reply all
Reply to author
Forward
0 new messages