Exception Handling¶
-
HPy
HPyErr_SetFromErrnoWithFilename
(HPyContext *ctx, HPy h_type, const char *filename_fsencoded)¶
[source] Similar to
HPyErr_SetFromErrnoWithFilenameObjects()
but takes one filename (a C string) that will be decoded usingHPyUnicode_DecodeFSDefault()
.- Parameters
ctx – The execution context.
h_type – The exception type to raise.
filename_fsencoded – a filename; may be
NULL
- Returns
always returns
HPy_NULL
-
HPy
HPyErr_SetFromErrnoWithFilenameObjects
(HPyContext *ctx, HPy h_type, HPy filename1, HPy filename2)¶
[source] A convenience function to raise an exception when a C library function has returned an error and set the C variable
errno
. It constructs an instance of the provided exception typeh_type
by callingh_type(errno, strerror(errno), filename1, 0, filename2)
. The exception instance is then raised.- Parameters
ctx – The execution context.
h_type – The exception type to raise.
filename1 – A filename; may be
HPy_NULL
. In the case ofh_type
is theOSError
exception, this is used to define the filename attribute of the exception instance.filename2 – another filename argument; may be
HPy_NULL
- Returns
always returns
HPy_NULL
-
HPy
HPyErr_NewExceptionWithDoc
(HPyContext *ctx, const char *utf8_name, const char *utf8_doc, HPy base, HPy dict)¶
[source]