summaryrefslogtreecommitdiff
path: root/pint/registry_helpers.py
diff options
context:
space:
mode:
authorMark Mikofski <mark.mikofski@sunpowercorp.com>2016-04-19 11:25:38 -0700
committerHernan Grecco <hernan.grecco@gmail.com>2016-08-01 18:57:11 -0300
commit4c943d8289d0943d349a69656a0cd264ae273531 (patch)
tree6974c422dfece2183df378b20a3a31a880231215 /pint/registry_helpers.py
parentcf3ab7b533f5cb851f4533932e4910ac281bf76b (diff)
downloadpint-4c943d8289d0943d349a69656a0cd264ae273531.tar.gz
patch to append None for extra results
Diffstat (limited to 'pint/registry_helpers.py')
-rw-r--r--pint/registry_helpers.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/pint/registry_helpers.py b/pint/registry_helpers.py
index 38f6b73..548fd65 100644
--- a/pint/registry_helpers.py
+++ b/pint/registry_helpers.py
@@ -168,9 +168,12 @@ def wraps(ureg, ret, args, strict=True):
result = func(*new_values, **kw)
+ # if more results than return units, append None so extra results are not tuncated
+ extra_results = (None, ) * (len(result) - len(ret))
+
if container:
out_units = (_replace_units(r, values_by_name) if is_ref else r
- for (r, is_ref) in ret)
+ for (r, is_ref) in ret + extra_results)
return ret.__class__(res if unit is None else ureg.Quantity(res, unit)
for unit, res in zip(out_units, result))