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
85041a54
Commit
85041a54
authored
Oct 03, 2011
by
Victor Stinner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
_PyUnicode_CheckConsistency() checks utf8 field consistency
parent
3cf4637e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
0 deletions
+8
-0
Include/unicodeobject.h
Include/unicodeobject.h
+2
-0
Objects/unicodeobject.c
Objects/unicodeobject.c
+6
-0
No files found.
Include/unicodeobject.h
View file @
85041a54
...
...
@@ -225,6 +225,7 @@ typedef struct {
* compact = 1
* ready = 1
* ascii = 0
* utf8 != data
- string created by the legacy API (not ready):
...
...
@@ -246,6 +247,7 @@ typedef struct {
* compact = 0
* ready = 1
* data.any is not NULL
* utf8 = data if ascii is 1
String created by the legacy API becomes ready when calling
PyUnicode_READY().
...
...
Objects/unicodeobject.c
View file @
85041a54
...
...
@@ -293,11 +293,13 @@ _PyUnicode_CheckConsistency(void *op)
assert
(
ascii
->
state
.
ready
==
1
);
}
else
if
(
ascii
->
state
.
compact
==
1
)
{
PyCompactUnicodeObject
*
compact
=
(
PyCompactUnicodeObject
*
)
op
;
assert
(
kind
==
PyUnicode_1BYTE_KIND
||
kind
==
PyUnicode_2BYTE_KIND
||
kind
==
PyUnicode_4BYTE_KIND
);
assert
(
ascii
->
state
.
ascii
==
0
);
assert
(
ascii
->
state
.
ready
==
1
);
assert
(
compact
->
utf8
!=
(
void
*
)(
compact
+
1
));
}
else
{
PyCompactUnicodeObject
*
compact
=
(
PyCompactUnicodeObject
*
)
op
;
PyUnicodeObject
*
unicode
=
(
PyUnicodeObject
*
)
op
;
...
...
@@ -318,6 +320,10 @@ _PyUnicode_CheckConsistency(void *op)
assert
(
ascii
->
state
.
compact
==
0
);
assert
(
ascii
->
state
.
ready
==
1
);
assert
(
unicode
->
data
.
any
!=
NULL
);
if
(
ascii
->
state
.
ascii
)
assert
(
compact
->
utf8
==
unicode
->
data
.
any
);
else
assert
(
compact
->
utf8
!=
unicode
->
data
.
any
);
}
}
return
1
;
...
...
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