summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2024-10-08 13:36:20 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2026-03-16 10:23:04 +0000
commit37539a15558ec4b486ee78faaad525565170a698 (patch)
tree83b023a94b4466f9b9f08520aeb5da943d67c273
parent04ae2d93de5370e495b5c3ae2f2d5748f05c7360 (diff)
downloadpoky-37539a15558ec4b486ee78faaad525565170a698.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: a0a5ce49f28d886b1dac173842642e69517b44e3) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 2e6608cec508b3b9bab3530f83e70665ff638182) [YC: This fixes the bb.tests.cow.COWTestCase.testOriginalTestSuite bitbake-selftest on the newly added fedora-41 workers] Signed-off-by: Yoann Congal <yoann.congal@smile.fr> Signed-off-by: Paul Barker <paul@pbarker.dev> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--bitbake/lib/bb/COW.py10
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
162class COWSetMeta(COWDictMeta): 163class 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