Skip to content

Commit 6073ea5

Browse files
committed
chore: rename c func
1 parent 9fdf740 commit 6073ea5

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

mypyc/codegen/emitmodule.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -959,7 +959,7 @@ def generate_module_def(self, emitter: Emitter, module_name: str, module: Module
959959
if fn.decl.is_async and fn.class_name is None:
960960
emitter.emit_line(f'PyObject *func = PyObject_GetAttrString({module_static}, "{fn.decl.name}");')
961961
emitter.emit_line("if (!func) goto fail;")
962-
emitter.emit_line("if (!CPyPatchAsyncCode(func)) { Py_DECREF(func); goto fail; }")
962+
emitter.emit_line("if (!CPyFunc_SetCoroFlag(func)) { Py_DECREF(func); goto fail; }")
963963
emitter.emit_line("Py_DECREF(func);")
964964

965965
self.generate_top_level_call(module, emitter)

mypyc/lib-rt/pythonsupport.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ CPyLong_AsSsize_tAndOverflow_(PyObject *vv, int *overflow)
104104

105105

106106
// CPy support for async functions: patch code object to include CO_COROUTINE
107-
PyObject* CPyPatchAsyncCode(PyObject* func) {
107+
PyObject* CPyFunc_SetCoroFlag(PyObject* func) {
108108
PyObject* code = PyObject_GetAttrString(func, "__code__");
109109
if (!code) {
110110
return NULL;

mypyc/lib-rt/pythonsupport.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,5 +474,8 @@ CPyCoro_GetAwaitableIter(PyObject *o)
474474
return NULL;
475475
}
476476

477+
static PyObject *
478+
CPyFunc_SetCoroFlag(PyObject* func)
479+
477480

478481
#endif

0 commit comments

Comments
 (0)