Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Kirill Smelkov
cpython
Commits
6120739f
Commit
6120739f
authored
11 years ago
by
Ned Deily
Browse files
Options
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
...
...
This diff is collapsed.
Click to expand it.
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
...
...
This diff is collapsed.
Click to expand it.
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.
...
...
This diff is collapsed.
Click to expand it.
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