Add maxlen argument to ErrorNetworkReply.readData.

This was missing before, causing a (hidden) exception with Python < 3.5, and
this with 3.5:

    TypeError: readData() takes 1 positional argument but 2 were given

    During handling of the above exception, another exception occurred:

    SystemError: PyEval_EvalFrameEx returned a result with an error set

Fixes #969.
This commit is contained in:
Florian Bruhin 2015-09-29 08:41:20 +02:00
parent 5db4ed0ed1
commit 11961db72c
2 changed files with 2 additions and 2 deletions

View File

@ -127,7 +127,7 @@ class ErrorNetworkReply(QNetworkReply):
"""We always have 0 bytes available."""
return 0
def readData(self):
def readData(self, _maxlen):
"""No data available."""
return bytes()

View File

@ -88,6 +88,6 @@ def test_error_network_reply(qtbot, req):
assert reply.isFinished()
assert not reply.isRunning()
assert reply.bytesAvailable() == 0
assert reply.readData() == b''
assert reply.readData(1) == b''
assert reply.error() == QNetworkReply.UnknownNetworkError
assert reply.errorString() == "This is an error"