mirror of https://github.com/scrapy/scrapy.git
use .seek(0) instead of reset() for compatibility
Since I don't find docs for the .reset() method, I lookup up the source
code, and it should work just the same as .seek(0).
For reference:
8eeb7e9122/Modules/cStringIO.c (L281)
This commit is contained in:
parent
2999fc75b1
commit
ef8872a518
|
|
@ -54,7 +54,7 @@ class ReceivedDataProtocol(Protocol):
|
|||
return self.__filename
|
||||
|
||||
def close(self):
|
||||
self.body.close() if self.filename else self.body.reset()
|
||||
self.body.close() if self.filename else self.body.seek(0)
|
||||
|
||||
_CODE_RE = re.compile("\d+")
|
||||
class FTPDownloadHandler(object):
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ class PickleItemExporterTest(BaseItemExporterTest):
|
|||
ie.export_item(i1)
|
||||
ie.export_item(i2)
|
||||
ie.finish_exporting()
|
||||
f.reset()
|
||||
f.seek(0)
|
||||
self.assertEqual(pickle.load(f), i1)
|
||||
self.assertEqual(pickle.load(f), i2)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue