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
9e30aa52
Commit
9e30aa52
authored
Nov 21, 2011
by
Victor Stinner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix misuse of PyUnicode_GET_SIZE() => PyUnicode_GET_LENGTH()
And PyUnicode_GetSize() => PyUnicode_GetLength()
parent
f3ae6208
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
18 additions
and
19 deletions
+18
-19
Modules/_csv.c
Modules/_csv.c
+1
-1
Modules/_datetimemodule.c
Modules/_datetimemodule.c
+2
-2
Modules/_gestalt.c
Modules/_gestalt.c
+1
-1
Modules/_io/stringio.c
Modules/_io/stringio.c
+1
-1
Modules/_io/textio.c
Modules/_io/textio.c
+2
-2
Objects/bytesobject.c
Objects/bytesobject.c
+1
-1
Objects/exceptions.c
Objects/exceptions.c
+2
-2
Objects/unicodeobject.c
Objects/unicodeobject.c
+2
-2
PC/import_nt.c
PC/import_nt.c
+1
-2
Python/_warnings.c
Python/_warnings.c
+5
-5
No files found.
Modules/_csv.c
View file @
9e30aa52
...
...
@@ -207,7 +207,7 @@ _set_char(const char *name, Py_UCS4 *target, PyObject *src, Py_UCS4 dflt)
*
target
=
'\0'
;
if
(
src
!=
Py_None
)
{
Py_ssize_t
len
;
len
=
PyUnicode_Get
Size
(
src
);
len
=
PyUnicode_Get
Length
(
src
);
if
(
len
>
1
)
{
PyErr_Format
(
PyExc_TypeError
,
"
\"
%s
\"
must be an 1-character string"
,
...
...
Modules/_datetimemodule.c
View file @
9e30aa52
...
...
@@ -1080,7 +1080,7 @@ make_Zreplacement(PyObject *object, PyObject *tzinfoarg)
PyObject
*
tzinfo
=
get_tzinfo_member
(
object
);
PyObject
*
Zreplacement
=
PyUnicode_FromStringAndSize
(
NULL
,
0
);
_Py_IDENTIFIER
(
replace
);
if
(
Zreplacement
==
NULL
)
return
NULL
;
if
(
tzinfo
==
Py_None
||
tzinfo
==
NULL
)
...
...
@@ -2673,7 +2673,7 @@ date_format(PyDateTime_Date *self, PyObject *args)
return
NULL
;
/* if the format is zero length, return str(self) */
if
(
PyUnicode_Get
Size
(
format
)
==
0
)
if
(
PyUnicode_Get
Length
(
format
)
==
0
)
return
PyObject_Str
((
PyObject
*
)
self
);
return
_PyObject_CallMethodId
((
PyObject
*
)
self
,
&
PyId_strftime
,
"O"
,
format
);
...
...
Modules/_gestalt.c
View file @
9e30aa52
...
...
@@ -33,7 +33,7 @@ static int
convert_to_OSType
(
PyObject
*
v
,
OSType
*
pr
)
{
uint32_t
tmp
;
if
(
!
PyUnicode_Check
(
v
)
||
PyUnicode_Get
Size
(
v
)
!=
4
)
{
if
(
!
PyUnicode_Check
(
v
)
||
PyUnicode_Get
Length
(
v
)
!=
4
)
{
PyErr_SetString
(
PyExc_TypeError
,
"OSType arg must be string of 4 chars"
);
return
0
;
...
...
Modules/_io/stringio.c
View file @
9e30aa52
...
...
@@ -730,7 +730,7 @@ stringio_init(stringio *self, PyObject *args, PyObject *kwds)
and copy it */
self
->
string_size
=
0
;
if
(
value
&&
value
!=
Py_None
)
value_len
=
PyUnicode_Get
Size
(
value
);
value_len
=
PyUnicode_Get
Length
(
value
);
else
value_len
=
0
;
if
(
value_len
>
0
)
{
...
...
Modules/_io/textio.c
View file @
9e30aa52
...
...
@@ -2144,7 +2144,7 @@ textiowrapper_seek(textio *self, PyObject *args)
textiowrapper_set_decoded_chars
(
self
,
decoded
);
/* Skip chars_to_skip of the decoded characters. */
if
(
PyUnicode_Get
Size
(
self
->
decoded_chars
)
<
cookie
.
chars_to_skip
)
{
if
(
PyUnicode_Get
Length
(
self
->
decoded_chars
)
<
cookie
.
chars_to_skip
)
{
PyErr_SetString
(
PyExc_IOError
,
"can't restore logical file position"
);
goto
fail
;
}
...
...
@@ -2208,7 +2208,7 @@ textiowrapper_tell(textio *self, PyObject *args)
goto
fail
;
if
(
self
->
decoder
==
NULL
||
self
->
snapshot
==
NULL
)
{
assert
(
self
->
decoded_chars
==
NULL
||
PyUnicode_Get
Size
(
self
->
decoded_chars
)
==
0
);
assert
(
self
->
decoded_chars
==
NULL
||
PyUnicode_Get
Length
(
self
->
decoded_chars
)
==
0
);
return
posobj
;
}
...
...
Objects/bytesobject.c
View file @
9e30aa52
...
...
@@ -2941,7 +2941,7 @@ _PyBytes_FormatLong(PyObject *val, int flags, int prec, int type,
PyErr_BadInternalCall
();
return
NULL
;
}
llen
=
PyUnicode_Get
Size
(
result
);
llen
=
PyUnicode_Get
Length
(
result
);
if
(
llen
>
INT_MAX
)
{
PyErr_SetString
(
PyExc_ValueError
,
"string too large in _PyBytes_FormatLong"
);
...
...
Objects/exceptions.c
View file @
9e30aa52
...
...
@@ -1273,7 +1273,7 @@ PyUnicodeEncodeError_GetStart(PyObject *exc, Py_ssize_t *start)
if
(
!
obj
)
return
-
1
;
*
start
=
((
PyUnicodeErrorObject
*
)
exc
)
->
start
;
size
=
PyUnicode_GET_
SIZE
(
obj
);
size
=
PyUnicode_GET_
LENGTH
(
obj
);
if
(
*
start
<
0
)
*
start
=
0
;
/*XXX check for values <0*/
if
(
*
start
>=
size
)
...
...
@@ -1341,7 +1341,7 @@ PyUnicodeEncodeError_GetEnd(PyObject *exc, Py_ssize_t *end)
if
(
!
obj
)
return
-
1
;
*
end
=
((
PyUnicodeErrorObject
*
)
exc
)
->
end
;
size
=
PyUnicode_GET_
SIZE
(
obj
);
size
=
PyUnicode_GET_
LENGTH
(
obj
);
if
(
*
end
<
1
)
*
end
=
1
;
if
(
*
end
>
size
)
...
...
Objects/unicodeobject.c
View file @
9e30aa52
...
...
@@ -4784,7 +4784,7 @@ _PyUnicode_AsUTF8String(PyObject *unicode, const char *errors)
if
(
PyBytes_Check
(
rep
))
repsize
=
PyBytes_GET_SIZE
(
rep
);
else
repsize
=
PyUnicode_GET_
SIZE
(
rep
);
repsize
=
PyUnicode_GET_
LENGTH
(
rep
);
if
(
repsize
>
4
)
{
Py_ssize_t
offset
;
...
...
@@ -8187,7 +8187,7 @@ charmap_encoding_error(
Py_DECREF
(
repunicode
);
return
-
1
;
}
repsize
=
PyUnicode_GET_
SIZE
(
repunicode
);
repsize
=
PyUnicode_GET_
LENGTH
(
repunicode
);
data
=
PyUnicode_DATA
(
repunicode
);
kind
=
PyUnicode_KIND
(
repunicode
);
for
(
index
=
0
;
index
<
repsize
;
index
++
)
{
...
...
PC/import_nt.c
View file @
9e30aa52
...
...
@@ -86,12 +86,11 @@ _PyWin_FindRegisteredModule(PyObject *moduleName,
suffix
=
PyUnicode_FromString
(
fdp
->
suffix
);
if
(
suffix
==
NULL
)
return
NULL
;
wsuffix
=
PyUnicode_AsUnicode
(
suffix
);
wsuffix
=
PyUnicode_AsUnicode
AndSize
(
suffix
,
&
extLen
);
if
(
wsuffix
==
NULL
)
{
Py_DECREF
(
suffix
);
return
NULL
;
}
extLen
=
PyUnicode_GET_SIZE
(
suffix
);
if
((
Py_ssize_t
)
modNameSize
>
extLen
&&
_wcsnicmp
(
pathBuf
+
((
Py_ssize_t
)
modNameSize
-
extLen
-
1
),
wsuffix
,
...
...
Python/_warnings.c
View file @
9e30aa52
...
...
@@ -203,13 +203,13 @@ normalize_module(PyObject *filename)
mod_str
=
_PyUnicode_AsString
(
filename
);
if
(
mod_str
==
NULL
)
return
NULL
;
len
=
PyUnicode_Get
Size
(
filename
);
return
NULL
;
len
=
PyUnicode_Get
Length
(
filename
);
if
(
len
<
0
)
return
NULL
;
if
(
len
>=
3
&&
strncmp
(
mod_str
+
(
len
-
3
),
".py"
,
3
)
==
0
)
{
module
=
PyUnicode_
FromStringAndSize
(
mod_str
,
len
-
3
);
module
=
PyUnicode_
Substring
(
filename
,
0
,
len
-
3
);
}
else
{
module
=
filename
;
...
...
@@ -506,7 +506,7 @@ setup_context(Py_ssize_t stack_level, PyObject **filename, int *lineno,
if
(
PyUnicode_READY
(
*
filename
))
goto
handle_error
;
len
=
PyUnicode_Get
Size
(
*
filename
);
len
=
PyUnicode_Get
Length
(
*
filename
);
kind
=
PyUnicode_KIND
(
*
filename
);
data
=
PyUnicode_DATA
(
*
filename
);
...
...
@@ -690,7 +690,7 @@ warnings_warn_explicit(PyObject *self, PyObject *args, PyObject *kwds)
}
/* Split the source into lines. */
source_list
=
PyObject_CallMethodObjArgs
(
source
,
source_list
=
PyObject_CallMethodObjArgs
(
source
,
PyId_splitlines
.
object
,
NULL
);
Py_DECREF
(
source
);
...
...
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