Skip to content

Scrapy, a fast high-level web crawling & scraping framework for Python.

Invert PY2/PY3 test for conditional read1() definition

Paul Tremberth29ff84a7920d
diff --git a/scrapy/utils/gz.py b/scrapy/utils/gz.py
index d69fb598d..d035f9fdf 100644
--- a/scrapy/utils/gz.py
+++ b/scrapy/utils/gz.py
@@ -16,12 +16,12 @@ import six
# works here but is only available from Python>=3.3
# - scrapy does not support Python 3.2
# - Python 2.7 GzipFile works fine with standard read() + extrabuf
-if six.PY3:
+if six.PY2:
def read1(gzf, size=-1):
- return gzf.read1(size)
+ return gzf.read(size)
else:
def read1(gzf, size=-1):
- return gzf.read(size)
+ return gzf.read1(size)
def gunzip(data):