mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 03:20:18 +00:00
...
This commit is contained in:
parent
cd5e2f8138
commit
8720c22c8a
@ -5,3 +5,15 @@ order: 10
|
|||||||
---
|
---
|
||||||
|
|
||||||
TBA
|
TBA
|
||||||
|
|
||||||
|
|
||||||
|
### `PY_RAISE` macro
|
||||||
|
|
||||||
|
Mark a function that can raise an exception on failure.
|
||||||
|
|
||||||
|
+ If the function returns `bool`, then `false` means an exception is raised.
|
||||||
|
+ If the function returns `int`, then `-1` means an exception is raised.
|
||||||
|
|
||||||
|
### `PY_RETURN` macro
|
||||||
|
|
||||||
|
Mark a function that can store a value in `py_retval()` on success.
|
@ -34,11 +34,7 @@ typedef struct c11_sv {
|
|||||||
int size;
|
int size;
|
||||||
} c11_sv;
|
} c11_sv;
|
||||||
|
|
||||||
/// Mark a function that can raise an exception.
|
|
||||||
/// + If the function returns `bool`, then `false` means an exception is raised.
|
|
||||||
/// + If the function returns `int`, then `-1` means an exception is raised.
|
|
||||||
#define PY_RAISE
|
#define PY_RAISE
|
||||||
/// Mark a function that returns a value by `py_retval()` on success.
|
|
||||||
#define PY_RETURN
|
#define PY_RETURN
|
||||||
|
|
||||||
/// A generic reference to a python object.
|
/// A generic reference to a python object.
|
||||||
|
@ -19,9 +19,9 @@ class Function:
|
|||||||
def badges(self):
|
def badges(self):
|
||||||
res = []
|
res = []
|
||||||
if self.is_py_raise:
|
if self.is_py_raise:
|
||||||
res.append('[!badge text="raise" variant="danger"]')
|
res.append('[!badge text="raise" variant="danger"](../introduction/#py_raise-macro)')
|
||||||
if self.is_py_return:
|
if self.is_py_return:
|
||||||
res.append('[!badge text="return"]')
|
res.append('[!badge text="return"](../introduction/#py_return-macro)')
|
||||||
return ' '.join(res)
|
return ' '.join(res)
|
||||||
|
|
||||||
def markdown(self):
|
def markdown(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user