From c53f87c5f9ca63119152f41dcebfb175d4df2cef Mon Sep 17 00:00:00 2001 From: Justus Winter Date: Mon, 11 Jul 2016 12:29:17 +0200 Subject: [PATCH] python: Make result wrapping backwards compatible. * lang/python/pyme/results.py (Result.__init__): Skip missing fields. Signed-off-by: Justus Winter --- lang/python/pyme/results.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lang/python/pyme/results.py b/lang/python/pyme/results.py index e6e89689..aa9b38e6 100644 --- a/lang/python/pyme/results.py +++ b/lang/python/pyme/results.py @@ -46,13 +46,12 @@ class Result(object): } def __init__(self, fragile): for key, func in self._type.items(): - setattr(self, key, func(getattr(fragile, key))) + if hasattr(fragile, key): + setattr(self, key, func(getattr(fragile, key))) for key, func in self._map.items(): - setattr(self, key, list(map(func, getattr(fragile, key)))) - - for key, func in self._map.items(): - setattr(self, key, list(map(func, getattr(fragile, key)))) + if hasattr(fragile, key): + setattr(self, key, list(map(func, getattr(fragile, key)))) for key in dir(fragile): if key.startswith('_') or key in self._blacklist: