Mojo function
check_and_get_arg
check_and_get_arg[T: AnyType](func_name: StringSlice[StaticConstantOrigin], py_args: PythonObject, index: Int) -> UnsafePointer[T]
Get the argument at the given index and downcast it to a given Mojo type.
Parameters:
- βT (
AnyType): The Mojo type to downcast the argument to.
Args:
- βfunc_name (
StringSlice): The name of the function referenced in the error message if the downcast fails. - βpy_args (
PythonObject): The Python tuple object containing the arguments. - βindex (
Int): The index of the argument.
Returns:
UnsafePointer: A pointer to the Mojo value contained in the argument.
Raises:
If the argument cannot be downcast to the given type.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!