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
579db160
Commit
579db160
authored
Jul 16, 2015
by
Victor Stinner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Closes #23247: Fix a crash in the StreamWriter.reset() of CJK codecs
parent
b37f43f9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
0 deletions
+12
-0
Lib/test/multibytecodec_support.py
Lib/test/multibytecodec_support.py
+7
-0
Misc/NEWS
Misc/NEWS
+2
-0
Modules/cjkcodecs/multibytecodec.c
Modules/cjkcodecs/multibytecodec.c
+3
-0
No files found.
Lib/test/multibytecodec_support.py
View file @
579db160
...
...
@@ -270,6 +270,13 @@ class TestBase:
self
.
assertEqual
(
ostream
.
getvalue
(),
self
.
tstring
[
0
])
def
test_streamwriter_reset_no_pending
(
self
):
# Issue #23247: Calling reset() on a fresh StreamWriter instance
# (without pending data) must not crash
stream
=
BytesIO
()
writer
=
self
.
writer
(
stream
)
writer
.
reset
()
class
TestBase_Mapping
(
unittest
.
TestCase
):
pass_enctest
=
[]
...
...
Misc/NEWS
View file @
579db160
...
...
@@ -66,6 +66,8 @@ Core and Builtins
Library
-------
-
Issue
#
23247
:
Fix
a
crash
in
the
StreamWriter
.
reset
()
of
CJK
codecs
.
-
Issue
#
18622
:
unittest
.
mock
.
mock_open
().
reset_mock
would
recurse
infinitely
.
Patch
from
Nicola
Palumbo
and
Laurent
De
Buyst
.
...
...
Modules/cjkcodecs/multibytecodec.c
View file @
579db160
...
...
@@ -1629,6 +1629,9 @@ mbstreamwriter_reset(MultibyteStreamWriterObject *self)
{
PyObject
*
pwrt
;
if
(
!
self
->
pending
)
Py_RETURN_NONE
;
pwrt
=
multibytecodec_encode
(
self
->
codec
,
&
self
->
state
,
self
->
pending
,
NULL
,
self
->
errors
,
MBENC_FLUSH
|
MBENC_RESET
);
...
...
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