Skip to content

Commit

Permalink
quick fix, setCfgMapping getattr check to hasattr
Browse files Browse the repository at this point in the history
with getattr(cfg, k, None) unexpected behavior when value to map is equivalent to False (0, None, False, empty object)
  • Loading branch information
jchen6727 authored Nov 9, 2023
1 parent 2f83e1a commit 571d9b4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion netpyne/specs/netParams.py
Original file line number Diff line number Diff line change
Expand Up @@ -846,5 +846,5 @@ def setNestedParam(self, paramLabel, paramVal):
def setCfgMapping(self, cfg):
if hasattr(self, 'mapping'):
for k, v in self.mapping.items():
if getattr(cfg, k, None):
if hasattr(cfg, k):
self.setNestedParam(v, getattr(cfg, k))

0 comments on commit 571d9b4

Please sign in to comment.