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
d1f9942a
Commit
d1f9942a
authored
Jul 16, 2013
by
Victor Stinner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #18408: Fix cjkcodecs decoders, add a new MBERR_EXCEPTION constant to
notify exceptions raised by the _PyUnicodeWriter API
parent
85c761d3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
2 deletions
+5
-2
Modules/cjkcodecs/cjkcodecs.h
Modules/cjkcodecs/cjkcodecs.h
+2
-2
Modules/cjkcodecs/multibytecodec.c
Modules/cjkcodecs/multibytecodec.c
+2
-0
Modules/cjkcodecs/multibytecodec.h
Modules/cjkcodecs/multibytecodec.h
+1
-0
No files found.
Modules/cjkcodecs/cjkcodecs.h
View file @
d1f9942a
...
...
@@ -130,7 +130,7 @@ static const struct dbcs_map *mapping_list;
#define OUTCHAR(c) \
do { \
if (_PyUnicodeWriter_WriteChar(writer, (c)) < 0) \
return MBERR_
TOOSMALL
; \
return MBERR_
EXCEPTION
; \
} while (0)
#define OUTCHAR2(c1, c2) \
...
...
@@ -138,7 +138,7 @@ static const struct dbcs_map *mapping_list;
Py_UCS4 _c1 = (c1); \
Py_UCS4 _c2 = (c2); \
if (_PyUnicodeWriter_Prepare(writer, 2, Py_MAX(_c1, c2)) < 0) \
return MBERR_
TOOSMALL
; \
return MBERR_
EXCEPTION
; \
PyUnicode_WRITE(writer->kind, writer->data, writer->pos, _c1); \
PyUnicode_WRITE(writer->kind, writer->data, writer->pos + 1, _c2); \
writer->pos += 2; \
...
...
Modules/cjkcodecs/multibytecodec.c
View file @
d1f9942a
...
...
@@ -384,6 +384,8 @@ multibytecodec_decerror(MultibyteCodec *codec,
PyErr_SetString
(
PyExc_RuntimeError
,
"internal codec error"
);
return
-
1
;
case
MBERR_EXCEPTION
:
return
-
1
;
default:
PyErr_SetString
(
PyExc_RuntimeError
,
"unknown runtime error"
);
...
...
Modules/cjkcodecs/multibytecodec.h
View file @
d1f9942a
...
...
@@ -112,6 +112,7 @@ typedef struct {
#define MBERR_TOOSMALL (-1)
/* insufficient output buffer space */
#define MBERR_TOOFEW (-2)
/* incomplete input buffer */
#define MBERR_INTERNAL (-3)
/* internal runtime error */
#define MBERR_EXCEPTION (-4)
/* an exception has been raised */
#define ERROR_STRICT (PyObject *)(1)
#define ERROR_IGNORE (PyObject *)(2)
...
...
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