diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-10-08 13:36:20 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-10-09 13:04:30 +0100 |
commit | 95fdbf04a936b52903325ace2836477de656c1db (patch) | |
tree | 22763804437f5491df5cce338b6571f1f36e8e22 /bitbake/lib/bb | |
parent | da5998039b976c7a7ba7eaab04be332aaf719ba2 (diff) | |
download | poky-95fdbf04a936b52903325ace2836477de656c1db.tar.gz |
bitbake: COW: Fix hardcoded magic numbers and work with python 3.13
The COW tests started failing on python 3.13. Looks like it is time
to fix the FIXME and drop the magic numbers!
(Bitbake rev: 2e6608cec508b3b9bab3530f83e70665ff638182)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb')
-rw-r--r-- | bitbake/lib/bb/COW.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/bitbake/lib/bb/COW.py b/bitbake/lib/bb/COW.py index 76bc08a3ea..4af03c54ad 100644 --- a/bitbake/lib/bb/COW.py +++ b/bitbake/lib/bb/COW.py | |||
@@ -36,8 +36,9 @@ class COWDictMeta(COWMeta): | |||
36 | __marker__ = tuple() | 36 | __marker__ = tuple() |
37 | 37 | ||
38 | def __str__(cls): | 38 | def __str__(cls): |
39 | # FIXME: I have magic numbers! | 39 | ignored_keys = set(["__count__", "__doc__", "__module__", "__firstlineno__", "__static_attributes__"]) |
40 | return "<COWDict Level: %i Current Keys: %i>" % (cls.__count__, len(cls.__dict__) - 3) | 40 | keys = set(cls.__dict__.keys()) - ignored_keys |
41 | return "<COWDict Level: %i Current Keys: %i>" % (cls.__count__, len(keys)) | ||
41 | 42 | ||
42 | __repr__ = __str__ | 43 | __repr__ = __str__ |
43 | 44 | ||
@@ -161,8 +162,9 @@ class COWDictMeta(COWMeta): | |||
161 | 162 | ||
162 | class COWSetMeta(COWDictMeta): | 163 | class COWSetMeta(COWDictMeta): |
163 | def __str__(cls): | 164 | def __str__(cls): |
164 | # FIXME: I have magic numbers! | 165 | ignored_keys = set(["__count__", "__doc__", "__module__", "__firstlineno__", "__static_attributes__"]) |
165 | return "<COWSet Level: %i Current Keys: %i>" % (cls.__count__, len(cls.__dict__) - 3) | 166 | keys = set(cls.__dict__.keys()) - ignored_keys |
167 | return "<COWSet Level: %i Current Keys: %i>" % (cls.__count__, len(keys)) | ||
166 | 168 | ||
167 | __repr__ = __str__ | 169 | __repr__ = __str__ |
168 | 170 | ||