| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 486f82d commit 1d73fc4
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -24,7 +24,6 @@ cdef class UVHandle: | |||
| 24 | 24 | ||
| 25 | 25 | cdef _warn_unclosed(self) | |
| 26 | 26 | ||
| 27 | - cdef _dealloc_impl(self) | ||
| 28 | 27 | cdef _free(self) | |
| 29 | 28 | cdef _close(self) | |
| 30 | 29 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -26,9 +26,6 @@ cdef class UVHandle: | |||
| 26 | 26 | self.__class__.__name__)) | |
| 27 | 27 | ||
| 28 | 28 | def __dealloc__(self): | |
| 29 | - self._dealloc_impl() | ||
| 30 | - | ||
| 31 | - cdef _dealloc_impl(self): | ||
| 32 | 29 | if UVLOOP_DEBUG: | |
| 33 | 30 | if self._loop is not None: | |
| 34 | 31 | self._loop._debug_handles_current.subtract([ | |
@@ -40,9 +37,6 @@ cdef class UVHandle: | |||
| 40 | 37 | .format(self.__class__.__name__)) | |
| 41 | 38 | ||
| 42 | 39 | if self._handle is NULL: | |
| 43 | - if UVLOOP_DEBUG: | ||
| 44 | - if self._has_handle == 0: | ||
| 45 | - self._loop._debug_uv_handles_freed += 1 | ||
| 46 | 40 | return | |
| 47 | 41 | ||
| 48 | 42 | # -> When we're at this point, something is wrong <- | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -190,7 +190,7 @@ cdef class UVProcess(UVHandle): | |||
| 190 | 190 | 'UVProcess._close_after_spawn called after uv_spawn') | |
| 191 | 191 | self._fds_to_close.add(fd) | |
| 192 | 192 | ||
| 193 | - cdef _dealloc_impl(self): | ||
| 193 | + def __dealloc__(self): | ||
| 194 | 194 | if self.uv_opt_env is not NULL: | |
| 195 | 195 | PyMem_RawFree(self.uv_opt_env) | |
| 196 | 196 | self.uv_opt_env = NULL | |
@@ -199,8 +199,6 @@ cdef class UVProcess(UVHandle): | |||
| 199 | 199 | PyMem_RawFree(self.uv_opt_args) | |
| 200 | 200 | self.uv_opt_args = NULL | |
| 201 | 201 | ||
| 202 | - UVHandle._dealloc_impl(self) | ||
| 203 | - | ||
| 204 | 202 | cdef char** __to_cstring_array(self, list arr): | |
| 205 | 203 | cdef: | |
| 206 | 204 | int i | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -100,18 +100,14 @@ cdef class UDPTransport(UVBaseTransport): | |||
| 100 | 100 | udp._init(loop, sock, r_addr) | |
| 101 | 101 | return udp | |
| 102 | 102 | ||
| 103 | - cdef _dealloc_impl(self): | ||
| 103 | + def __dealloc__(self): | ||
| 104 | + if UVLOOP_DEBUG: | ||
| 105 | + self._loop._debug_uv_handles_freed += 1 | ||
| 106 | + | ||
| 104 | 107 | if self._closed == 0: | |
| 105 | 108 | self._warn_unclosed() | |
| 106 | 109 | self._close() | |
| 107 | 110 | ||
| 108 | - # It is unsafe to call `self.poll._close()` here as | ||
| 109 | - # we might be at the stage where all CPython objects | ||
| 110 | - # are being freed, and `self.poll` points to some | ||
| 111 | - # zombie Python object. So we do nothing. | ||
| 112 | - | ||
| 113 | - UVHandle._dealloc_impl(self) | ||
| 114 | - | ||
| 115 | 111 | cdef _free(self): | |
| 116 | 112 | if self.poll is not None: | |
| 117 | 113 | self.poll._close() | |
| Back | FazBrowse Home | New Git URL |
0 commit comments