Skip to content

Commit 38ac00f

Browse files
README: Use the PyAwaitable prefixes
1 parent 7513ab6 commit 38ac00f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,19 +46,21 @@ if __name__ == "__main__":
4646
## Example
4747

4848
```c
49+
#define PYAWAITABLE_PYAPI
4950
#include <pyawaitable.h>
5051

5152
// Assuming that this is using METH_O
5253
static PyObject *
5354
hello(PyObject *self, PyObject *coro) {
5455
// Make our awaitable object
55-
PyObject *awaitable = pyawaitable_new();
56+
PyObject *awaitable = PyAwaitable_New();
5657

57-
if (!awaitable)
58+
if (awaitable == NULL) {
5859
return NULL;
60+
}
5961

6062
// Mark the coroutine for being awaited
61-
if (pyawaitable_await(awaitable, coro, NULL, NULL) < 0) {
63+
if (PyAwaitable_AddAwait(awaitable, coro, NULL, NULL) < 0) {
6264
Py_DECREF(awaitable);
6365
return NULL;
6466
}

0 commit comments

Comments
 (0)