mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-07 03:45:42 +00:00
If repr() of a component failed we would crash. Not part of the build.
This commit is contained in:
parent
7e5aa4ce76
commit
ff2741adce
@ -89,7 +89,14 @@ PyG_Base::PyG_Base(PyObject *instance, const nsIID &iid)
|
||||
// If XPCOM reference count logging is enabled, then allow us to give the Python class.
|
||||
PyObject *realInstance = PyObject_GetAttrString(instance, "_obj_");
|
||||
PyObject *r = PyObject_Repr(realInstance);
|
||||
const char *szRepr = PyString_AsString(r);
|
||||
const char *szRepr;
|
||||
if (r==NULL) {
|
||||
PyXPCOM_LogError("Getting the __repr__ of the object failed");
|
||||
PyErr_Clear();
|
||||
szRepr = "(repr failed!)";
|
||||
}
|
||||
else
|
||||
szRepr = PyString_AsString(r);
|
||||
if (szRepr==NULL) szRepr = "";
|
||||
int reprOffset = *szRepr=='<' ? 1 : 0;
|
||||
static const char *reprPrefix = "component:";
|
||||
|
Loading…
Reference in New Issue
Block a user