Commits

Alexey Borzenkov  committed ec17d8f

Get rid of _initialized in io watcher

  • Participants
  • Parent commits c9bda72

Comments (0)

Files changed (1)

File gevent/core_.pyx

 
     WATCHER(io)
 
-    cdef int _initialized # for __dealloc__, whether io is initialized
+    def __cinit__(self):
+        self._watcher.fd = -1;
 
     def __init__(self, loop loop, long fd, int events):
         cdef int vfd = libev.vfd_open(fd)
-        if self._initialized:
-            libev.vfd_free(self._watcher.fd)
+        libev.vfd_free(self._watcher.fd)
         libev.ev_io_init(&self._watcher, <void *>gevent_callback_io, vfd, events)
-        self._initialized = 1
         self.loop = loop
         self._incref = 0
 
     def __dealloc__(self):
-        if self._initialized:
-            libev.vfd_free(self._watcher.fd)
+        libev.vfd_free(self._watcher.fd)
 
     property fd: