Skip to content

Commit 64459a4

Browse files
author
taras
committed
Don't increase refcount in run_in_context since cython does it for us
1 parent 54ac4f5 commit 64459a4

File tree

1 file changed

+0
-10
lines changed

1 file changed

+0
-10
lines changed

uvloop/loop.pyx

-10
Original file line numberDiff line numberDiff line change
@@ -92,36 +92,26 @@ cdef inline socket_dec_io_ref(sock):
9292

9393

9494
cdef inline run_in_context(context, method):
95-
# This method is internally used to workaround a reference issue that in
96-
# certain circumstances, inlined context.run() will not hold a reference to
97-
# the given method instance, which - if deallocated - will cause segfault.
98-
# See also: edgedb/edgedb#2222
9995
Context_Enter(context)
100-
Py_INCREF(method)
10196
try:
10297
return method()
10398
finally:
104-
Py_DECREF(method)
10599
Context_Exit(context)
106100

107101

108102
cdef inline run_in_context1(context, method, arg):
109103
Context_Enter(context)
110-
Py_INCREF(method)
111104
try:
112105
return method(arg)
113106
finally:
114-
Py_DECREF(method)
115107
Context_Exit(context)
116108

117109

118110
cdef inline run_in_context2(context, method, arg1, arg2):
119111
Context_Enter(context)
120-
Py_INCREF(method)
121112
try:
122113
return method(arg1, arg2)
123114
finally:
124-
Py_DECREF(method)
125115
Context_Exit(context)
126116

127117

0 commit comments

Comments
 (0)