Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
6120739f
Commit
6120739f
authored
Mar 09, 2014
by
Ned Deily
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #20875: Prevent possible gzip "'read' is not defined" NameError.
Patch by Claudiu Popa.
parent
5e572fd4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
1 deletion
+11
-1
Lib/gzip.py
Lib/gzip.py
+1
-1
Lib/test/test_gzip.py
Lib/test/test_gzip.py
+7
-0
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/gzip.py
View file @
6120739f
...
...
@@ -99,7 +99,7 @@ class _PaddedFile:
self
.
_read
-=
len
(
prepend
)
return
else
:
self
.
_buffer
=
self
.
_buffer
[
read
:]
+
prepend
self
.
_buffer
=
self
.
_buffer
[
self
.
_
read
:]
+
prepend
self
.
_length
=
len
(
self
.
_buffer
)
self
.
_read
=
0
...
...
Lib/test/test_gzip.py
View file @
6120739f
...
...
@@ -396,6 +396,13 @@ class TestGzip(BaseTest):
with
gzip
.
GzipFile
(
fileobj
=
io
.
BytesIO
(
gzdata
))
as
f
:
self
.
assertEqual
(
f
.
read
(),
b'Test'
)
def
test_prepend_error
(
self
):
# See issue #20875
with
gzip
.
open
(
self
.
filename
,
"wb"
)
as
f
:
f
.
write
(
data1
)
with
gzip
.
open
(
self
.
filename
,
"rb"
)
as
f
:
f
.
fileobj
.
prepend
()
class
TestOpen
(
BaseTest
):
def
test_binary_modes
(
self
):
uncompressed
=
data1
*
50
...
...
Misc/NEWS
View file @
6120739f
...
...
@@ -13,6 +13,9 @@ Core and Builtins
Library
-------
- Issue #20875: Prevent possible gzip "'
read
' is not defined" NameError.
Patch by Claudiu Popa.
- Issue #20283: RE pattern methods now accept the string keyword parameters
as documented. The pattern and source keyword parameters are left as
deprecated aliases.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment