mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 19:08:55 -04:00
handle Python exceptions properly in get_context()
This commit is contained in:
parent
ee3adf5723
commit
3c65b5171b
@ -31,7 +31,14 @@
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
PyObject* EXT_CONST_METHOD(RocketRegion,
|
PyObject* EXT_CONST_METHOD(RocketRegion,
|
||||||
get_context) {
|
get_context) {
|
||||||
|
python::object py_context;
|
||||||
|
|
||||||
|
try {
|
||||||
Rocket::Core::Context* context = _ext_this->get_context();
|
Rocket::Core::Context* context = _ext_this->get_context();
|
||||||
python::object py_context = Rocket::Core::Python::Utilities::MakeObject(context);
|
py_context = Rocket::Core::Python::Utilities::MakeObject(context);
|
||||||
|
} catch (const python::error_already_set& e) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
return py_context.ptr();
|
return py_context.ptr();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user