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
29273c87
Commit
29273c87
authored
Feb 04, 2003
by
Marc-André Lemburg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for [ 543344 ] Interpreter crashes when recoding; suggested
by Michael Stone (mbrierst). Python 2.1.4, 2.2.2 candidate.
parent
604ade4e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
1 deletion
+12
-1
Lib/test/test_codecs.py
Lib/test/test_codecs.py
+9
-0
Modules/_codecsmodule.c
Modules/_codecsmodule.c
+3
-1
No files found.
Lib/test/test_codecs.py
View file @
29273c87
...
...
@@ -27,11 +27,20 @@ class EscapeDecodeTest(unittest.TestCase):
def
test_empty_escape_decode
(
self
):
self
.
assertEquals
(
codecs
.
escape_decode
(
""
),
(
""
,
0
))
class
RecodingTest
(
unittest
.
TestCase
):
def
test_recoding
(
self
):
f
=
StringIO
.
StringIO
()
f2
=
codecs
.
EncodedFile
(
f
,
"unicode_internal"
,
"utf-8"
)
f2
.
write
(
u"a"
)
f2
.
close
()
# Python used to crash on this at exit because of a refcount
# bug in _codecsmodule.c
def
test_main
():
suite
=
unittest
.
TestSuite
()
suite
.
addTest
(
unittest
.
makeSuite
(
UTF16Test
))
suite
.
addTest
(
unittest
.
makeSuite
(
EscapeDecodeTest
))
suite
.
addTest
(
unittest
.
makeSuite
(
RecodingTest
))
test_support
.
run_suite
(
suite
)
...
...
Modules/_codecsmodule.c
View file @
29273c87
...
...
@@ -167,8 +167,10 @@ unicode_internal_decode(PyObject *self,
&
obj
,
&
errors
))
return
NULL
;
if
(
PyUnicode_Check
(
obj
))
if
(
PyUnicode_Check
(
obj
))
{
Py_INCREF
(
obj
);
return
codec_tuple
(
obj
,
PyUnicode_GET_SIZE
(
obj
));
}
else
{
if
(
PyObject_AsReadBuffer
(
obj
,
(
const
void
**
)
&
data
,
&
size
))
return
NULL
;
...
...
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