python: Fix Param initialization issue in Python 3
When initializing a param with a SimObject NULL pointer, convert()
checks if the 'ptype' attribute has been created and whether the value
is NULL. In that case, it assumes that the object is being
initizalized as a part of SimObject initialization and defers the
conversion. This check is implemented using hasattr() which in turn is
implemented using the __getattr__ implementation that asserts because
all SimObjects haven't been initialized yet.
Implement the check using a lookup in the object's dictionary instead
to prevent the SimObject lookup.
Signed-off-by: Andreas Sandberg <firstname.lastname@example.org>
Reviewed-by: Nikos Nikoleris <email@example.com>
1 file changed