Skip to content

Commit ac7db93

Browse files
committed
fixed pipe and stream checks to test for not None
1 parent 57e5fd7 commit ac7db93

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/namedpipe/_posix.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def __str__(self):
9090

9191
def close(self):
9292
# close named pipe
93-
if self.stream:
93+
if self.stream is not None:
9494
self.stream.close()
9595
self.stream = None
9696
if path.exists(self._path):

src/namedpipe/_win32.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,10 @@ def __str__(self):
119119

120120
def close(self):
121121
# close named pipe
122-
if self.stream:
122+
if self.stream is not None:
123123
self.stream.close()
124124
self.stream = None
125-
if self._pipe:
125+
if self._pipe is not None:
126126
if win32file.CloseHandle(self._pipe):
127127
raise _win_error()
128128
self._pipe = None
@@ -210,7 +210,7 @@ def close(self) -> None:
210210
be called more than once without error."""
211211
if self.closed:
212212
return
213-
if self.handle:
213+
if self.handle is not None:
214214
win32file.CloseHandle(self.handle)
215215
self.handle = None
216216

0 commit comments

Comments
 (0)