Skip to content

Commit 547965e

Browse files
pmhahnberrange
authored andcommitted
stream: Convert type() to isinstance()
Signed-off-by: Philipp Hahn <[email protected]>
1 parent d144e70 commit 547965e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Diff for: libvirt-override-virStream.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def handler(stream, # virStream instance
4949

5050
try:
5151
ret = handler(self, got, opaque)
52-
if type(ret) is int and ret < 0:
52+
if isinstance(ret, int) and ret < 0:
5353
raise RuntimeError("recvAll handler returned %d" % ret)
5454
except BaseException:
5555
try:
@@ -204,7 +204,7 @@ def holeHandler(stream, # virStream instance
204204
self.abort()
205205
raise RuntimeError("recvHole handler failed")
206206
ret_hole = holeHandler(self, length, opaque)
207-
if type(ret_hole) is int and ret_hole < 0:
207+
if isinstance(ret_hole, int) and ret_hole < 0:
208208
self.abort()
209209
raise RuntimeError("holeHandler handler returned %d" % ret_hole)
210210
continue
@@ -217,7 +217,7 @@ def holeHandler(stream, # virStream instance
217217
break
218218

219219
ret_data = handler(self, got, opaque)
220-
if type(ret_data) is int and ret_data < 0:
220+
if isinstance(ret_data, int) and ret_data < 0:
221221
self.abort()
222222
raise RuntimeError("sparseRecvAll handler returned %d" % ret_data)
223223

@@ -264,7 +264,7 @@ def skipHandler(stream, # virStream instance
264264
want = sectionLen
265265

266266
got = handler(self, want, opaque)
267-
if type(got) is int and got < 0:
267+
if isinstance(got, int) and got < 0:
268268
self.abort()
269269
raise RuntimeError("sparseSendAll handler returned %d" % got)
270270

0 commit comments

Comments
 (0)