mirror of
https://gitlab.com/libvirt/libvirt-python.git
synced 2025-08-02 04:21:59 +03:00
override: Catch type error
handler() should either return bytes or -2 or -3. Explicitly raise ValueError or TypeError to silence mypy. Signed-off-by: Philipp Hahn <hahn@univention.de>
This commit is contained in:
committed by
Daniel Berrange
parent
051a00c212
commit
d49e850807
@ -200,7 +200,7 @@
|
|||||||
if got == -2:
|
if got == -2:
|
||||||
raise libvirtError("cannot use sparseRecvAll with "
|
raise libvirtError("cannot use sparseRecvAll with "
|
||||||
"nonblocking stream")
|
"nonblocking stream")
|
||||||
if got == -3:
|
elif got == -3:
|
||||||
length = self.recvHole()
|
length = self.recvHole()
|
||||||
if length is None:
|
if length is None:
|
||||||
self.abort()
|
self.abort()
|
||||||
@ -210,6 +210,10 @@
|
|||||||
self.abort()
|
self.abort()
|
||||||
raise RuntimeError("holeHandler handler returned %d" % ret)
|
raise RuntimeError("holeHandler handler returned %d" % ret)
|
||||||
continue
|
continue
|
||||||
|
elif isinstance(got, int):
|
||||||
|
raise ValueError(got)
|
||||||
|
elif not isinstance(got, bytes):
|
||||||
|
raise TypeError(type(got))
|
||||||
|
|
||||||
if len(got) == 0:
|
if len(got) == 0:
|
||||||
break
|
break
|
||||||
|
Reference in New Issue
Block a user