Page MenuHomePhabricator

if possible, object_from_instance should display an error message if you didn't import the right module
Open, WishlistPublic


When using object_from_instance for an elementary object you must
import elementary. if it is an edje object, import edje, etc.
If you forgot to import, it returns 0.
I think It would be nice to have an error message in this case.

indefini created this task.Oct 18 2017, 4:13 PM

The function object_from_instance() is rising a:

ValueError("Eo object at %#x of type %s does not have a mapping!")

in the case you described.

I think this is the correct way in CPython to handle failures: if you receive 0 it means an exception has been rised and you need to check the exception in C code.

DaveMDS lowered the priority of this task from TODO to Pending on user input.Feb 1 2018, 11:18 AM

How about adding a comment/documentation on object_from_instance, that says something like
"if it returns null, check if an error occured with PyErr_Occured/PyErr_Print (for example)"
Maybe that could help new people.

indefini raised the priority of this task from Pending on user input to Wishlist.Feb 14 2018, 8:03 PM