Skip to content

Commit 071acf1

Browse files
authored
Merge pull request #1035 from compas-dev/fix-colordict
Unused defaultdict is considered empty
2 parents e0548d9 + 0a462cb commit 071acf1

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2525
* Fixed removing of collections for `compas_plotters`.
2626
* Fixed bug in `compas.robots.Configuration`.
2727
* Rebuild part index after deserialization in `Assembly`.
28+
* Fixed bug in `compas.artists.colordict.ColorDict`.
2829

2930
### Removed
3031

src/compas/artists/colordict.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,10 @@ def __get__(self, obj, otype=None):
7979
8080
"""
8181
default = getattr(obj, self.default_name)
82-
return getattr(obj, self.private_name) or defaultdict(lambda: default)
82+
d = getattr(obj, self.private_name)
83+
if d is not None:
84+
return d
85+
return defaultdict(lambda: default)
8386

8487
def __set__(self, obj, value):
8588
"""Set a new value for the descriptor.

0 commit comments

Comments
 (0)