Functions that operate on REPY_Handle values directly, rather than the Python objects they represent. More...
Functions | |
| void | REPY_Release (REPY_Handle py_handle) |
| Releases a REPY_Handle, removing the reference to the Python object and rendering this handle invalid. | |
| REPY_Handle | REPY_MakeSUH (REPY_Handle py_handle_no_release) |
| Convienience function that marks a REPY_Handle as Single-Use and then returns the value of the provided handle. | |
| REPY_bool | REPY_IsValidHandle (REPY_Handle py_handle_no_release) |
| Returns whether the a handle value is mapped to a Python object. | |
| REPY_bool | REPY_GetSUH (REPY_Handle py_handle_no_release) |
| Gets whether or not a REPY_Handle is Single-Use. | |
| void | REPY_SetSUH (REPY_Handle py_handle_no_release, REPY_bool value) |
| Sets whether or not a REPY_Handle is Single-Use. | |
| REPY_Handle | REPY_CopyHandle (REPY_Handle handle_no_release) |
| Creates a new handle to the same Python object as another handle. | |
Functions that operate on REPY_Handle values directly, rather than the Python objects they represent.
| REPY_Handle REPY_CopyHandle | ( | REPY_Handle | handle_no_release | ) |
Creates a new handle to the same Python object as another handle.
Note that, unlike the other functions in this category, this function WILL release Single-Use handles. In the future, a _no_release version of this function may be added.
| handle_no_release | A handle for an object you need another handle to. |
| REPY_bool REPY_GetSUH | ( | REPY_Handle | py_handle_no_release | ) |
Gets whether or not a REPY_Handle is Single-Use.
This function is special in that it will not release a Single-Use REPY_Handle handle.
| py_handle_no_release | The handle in question. |
| REPY_bool REPY_IsValidHandle | ( | REPY_Handle | py_handle_no_release | ) |
Returns whether the a handle value is mapped to a Python object.
A handle of 0 (REPY_NO_OBJECT) will always return false.
This function is special in that it will not release a Single-Use REPY_Handle handle.
| py_handle_no_release | The handle in question. |
| REPY_Handle REPY_MakeSUH | ( | REPY_Handle | py_handle_no_release | ) |
Convienience function that marks a REPY_Handle as Single-Use and then returns the value of the provided handle.
This function primarily exists to allow you to nest calls to API functions without causing memory/resource leaks. Consider the following code:
This is will result in the REPY_Handle created by REPY_CreateBool not getting released. and since the handle was never captured in a variable, We can't make a call to release it. In effect, this is a memory leak.
By marking the REPY_Handle from REPY_CreateBool as Single-Use, it will be released as soon as REPY_CastBool is done with it. Thus, no memory leak.
| py_handle_no_release | The handle to make Single-Use. |
| void REPY_Release | ( | REPY_Handle | py_handle | ) |
Releases a REPY_Handle, removing the reference to the Python object and rendering this handle invalid.
It is safe to use this function with a Single-Use handle, since it will not try to release the handle twice.
| py_handle | The handle to release. |
| void REPY_SetSUH | ( | REPY_Handle | py_handle_no_release, |
| REPY_bool | value ) |
Sets whether or not a REPY_Handle is Single-Use.
This function is special in that it will not release a Single-Use REPY_Handle handle.
| py_handle_no_release | The handle in question. |
| value | True will make the handle Single-Use. False will make it not Single-Use. |