RecompExternalPython for N64Recompiled 2.0.0
Loading...
Searching...
No Matches

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.

Detailed Description

Functions that operate on REPY_Handle values directly, rather than the Python objects they represent.

Function Documentation

◆ REPY_CopyHandle()

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.

Parameters
handle_no_releaseA handle for an object you need another handle to.
Returns
A new handle to the same object.

◆ REPY_GetSUH()

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.

Parameters
py_handle_no_releaseThe handle in question.
Returns
True if the handle is Single-Use. False otherwise.

◆ REPY_IsValidHandle()

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.

Parameters
py_handle_no_releaseThe handle in question.
Returns
True if the handle is valid. False otherwise.

◆ REPY_MakeSUH()

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:

REPY_bool REPY_CastBool(REPY_Handle object)
Casts a Python object to a C bool.
REPY_Handle REPY_CreateBool(REPY_bool value)
Returns a REPY_Handle for a Python bool object, based on a C bool.

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.

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 provid...

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.

Parameters
py_handle_no_releaseThe handle to make Single-Use.
Returns
The same handle as was passed in via py_handle_no_release..

◆ REPY_Release()

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.

Parameters
py_handleThe handle to release.

◆ REPY_SetSUH()

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.

Parameters
py_handle_no_releaseThe handle in question.
valueTrue will make the handle Single-Use. False will make it not Single-Use.