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
245f025e
Commit
245f025e
authored
Jul 12, 2000
by
Jeremy Hylton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
replace PyXXX_Length calls with PyXXX_Size calls
parent
68f5abe7
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
30 additions
and
29 deletions
+30
-29
Modules/_sre.c
Modules/_sre.c
+1
-1
Modules/_tkinter.c
Modules/_tkinter.c
+1
-1
Modules/almodule.c
Modules/almodule.c
+2
-2
Modules/cPickle.c
Modules/cPickle.c
+2
-2
Modules/cStringIO.c
Modules/cStringIO.c
+1
-1
Modules/parsermodule.c
Modules/parsermodule.c
+5
-5
Modules/posixmodule.c
Modules/posixmodule.c
+2
-2
Modules/stropmodule.c
Modules/stropmodule.c
+1
-1
Objects/listobject.c
Objects/listobject.c
+2
-2
Objects/stringobject.c
Objects/stringobject.c
+1
-1
Objects/unicodeobject.c
Objects/unicodeobject.c
+1
-1
Python/bltinmodule.c
Python/bltinmodule.c
+1
-1
Python/exceptions.c
Python/exceptions.c
+9
-8
Python/getargs.c
Python/getargs.c
+1
-1
No files found.
Modules/_sre.c
View file @
245f025e
...
@@ -1127,7 +1127,7 @@ _compile(PyObject* self_, PyObject* args)
...
@@ -1127,7 +1127,7 @@ _compile(PyObject* self_, PyObject* args)
if
(
!
code
)
if
(
!
code
)
return
NULL
;
return
NULL
;
n
=
PySequence_
Length
(
code
);
n
=
PySequence_
Size
(
code
);
self
=
PyObject_NEW_VAR
(
PatternObject
,
&
Pattern_Type
,
100
*
n
);
self
=
PyObject_NEW_VAR
(
PatternObject
,
&
Pattern_Type
,
100
*
n
);
if
(
!
self
)
{
if
(
!
self
)
{
...
...
Modules/_tkinter.c
View file @
245f025e
...
@@ -1934,7 +1934,7 @@ Tkinter_Flatten(PyObject* self, PyObject* args)
...
@@ -1934,7 +1934,7 @@ Tkinter_Flatten(PyObject* self, PyObject* args)
if
(
!
PyArg_ParseTuple
(
args
,
"O:_flatten"
,
&
item
))
if
(
!
PyArg_ParseTuple
(
args
,
"O:_flatten"
,
&
item
))
return
NULL
;
return
NULL
;
context
.
maxsize
=
PySequence_
Length
(
item
);
context
.
maxsize
=
PySequence_
Size
(
item
);
if
(
context
.
maxsize
<=
0
)
if
(
context
.
maxsize
<=
0
)
return
PyTuple_New
(
0
);
return
PyTuple_New
(
0
);
...
...
Modules/almodule.c
View file @
245f025e
...
@@ -176,13 +176,13 @@ python2param(int resource, ALpv *param, PyObject *value, ALparamInfo *pinfo)
...
@@ -176,13 +176,13 @@ python2param(int resource, ALpv *param, PyObject *value, ALparamInfo *pinfo)
case
AL_INT32_ELEM
:
case
AL_INT32_ELEM
:
case
AL_RESOURCE_ELEM
:
case
AL_RESOURCE_ELEM
:
case
AL_ENUM_ELEM
:
case
AL_ENUM_ELEM
:
param
->
sizeIn
=
PySequence_
Length
(
value
);
param
->
sizeIn
=
PySequence_
Size
(
value
);
param
->
value
.
ptr
=
PyMem_NEW
(
int
,
param
->
sizeIn
);
param
->
value
.
ptr
=
PyMem_NEW
(
int
,
param
->
sizeIn
);
stepsize
=
sizeof
(
int
);
stepsize
=
sizeof
(
int
);
break
;
break
;
case
AL_INT64_ELEM
:
case
AL_INT64_ELEM
:
case
AL_FIXED_ELEM
:
case
AL_FIXED_ELEM
:
param
->
sizeIn
=
PySequence_
Length
(
value
);
param
->
sizeIn
=
PySequence_
Size
(
value
);
param
->
value
.
ptr
=
PyMem_NEW
(
long
long
,
param
->
sizeIn
);
param
->
value
.
ptr
=
PyMem_NEW
(
long
long
,
param
->
sizeIn
);
stepsize
=
sizeof
(
long
long
);
stepsize
=
sizeof
(
long
long
);
break
;
break
;
...
...
Modules/cPickle.c
View file @
245f025e
...
@@ -1466,7 +1466,7 @@ save_inst(Picklerobject *self, PyObject *args) {
...
@@ -1466,7 +1466,7 @@ save_inst(Picklerobject *self, PyObject *args) {
PyObject_CallObject
(
getinitargs_func
,
empty_tuple
))
PyObject_CallObject
(
getinitargs_func
,
empty_tuple
))
goto
finally
;
goto
finally
;
if
((
len
=
PyObject_
Length
(
class_args
))
<
0
)
if
((
len
=
PyObject_
Size
(
class_args
))
<
0
)
goto
finally
;
goto
finally
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
for
(
i
=
0
;
i
<
len
;
i
++
)
{
...
@@ -2874,7 +2874,7 @@ Instance_New(PyObject *cls, PyObject *args) {
...
@@ -2874,7 +2874,7 @@ Instance_New(PyObject *cls, PyObject *args) {
if
(
PyClass_Check
(
cls
))
{
if
(
PyClass_Check
(
cls
))
{
int
l
;
int
l
;
if
((
l
=
PyObject_
Length
(
args
))
<
0
)
goto
err
;
if
((
l
=
PyObject_
Size
(
args
))
<
0
)
goto
err
;
UNLESS
(
l
)
{
UNLESS
(
l
)
{
PyObject
*
__getinitargs__
;
PyObject
*
__getinitargs__
;
...
...
Modules/cStringIO.c
View file @
245f025e
...
@@ -367,7 +367,7 @@ O_writelines(Oobject *self, PyObject *args) {
...
@@ -367,7 +367,7 @@ O_writelines(Oobject *self, PyObject *args) {
Py_DECREF
(
string_module
);
Py_DECREF
(
string_module
);
}
}
if
(
PyObject_
Length
(
args
)
==
-
1
)
{
if
(
PyObject_
Size
(
args
)
==
-
1
)
{
return
NULL
;
return
NULL
;
}
}
...
...
Modules/parsermodule.c
View file @
245f025e
...
@@ -610,7 +610,7 @@ parser_tuple2ast(PyAST_Object *self, PyObject *args, PyObject *kw)
...
@@ -610,7 +610,7 @@ parser_tuple2ast(PyAST_Object *self, PyObject *args, PyObject *kw)
* so we can DECREF it after the check. But we really should accept
* so we can DECREF it after the check. But we really should accept
* lists as well as tuples at the very least.
* lists as well as tuples at the very least.
*/
*/
ok
=
PyObject_
Length
(
tuple
)
>=
2
;
ok
=
PyObject_
Size
(
tuple
)
>=
2
;
if
(
ok
)
{
if
(
ok
)
{
temp
=
PySequence_GetItem
(
tuple
,
0
);
temp
=
PySequence_GetItem
(
tuple
,
0
);
ok
=
(
temp
!=
NULL
)
&&
PyInt_Check
(
temp
);
ok
=
(
temp
!=
NULL
)
&&
PyInt_Check
(
temp
);
...
@@ -626,7 +626,7 @@ parser_tuple2ast(PyAST_Object *self, PyObject *args, PyObject *kw)
...
@@ -626,7 +626,7 @@ parser_tuple2ast(PyAST_Object *self, PyObject *args, PyObject *kw)
}
}
if
(
ok
)
{
if
(
ok
)
{
temp
=
PySequence_GetItem
(
tuple
,
1
);
temp
=
PySequence_GetItem
(
tuple
,
1
);
ok
=
(
temp
!=
NULL
)
&&
PyObject_
Length
(
temp
)
>=
2
;
ok
=
(
temp
!=
NULL
)
&&
PyObject_
Size
(
temp
)
>=
2
;
if
(
ok
)
{
if
(
ok
)
{
PyObject
*
temp2
=
PySequence_GetItem
(
temp
,
0
);
PyObject
*
temp2
=
PySequence_GetItem
(
temp
,
0
);
if
(
temp2
!=
NULL
)
{
if
(
temp2
!=
NULL
)
{
...
@@ -693,7 +693,7 @@ parser_tuple2ast(PyAST_Object *self, PyObject *args, PyObject *kw)
...
@@ -693,7 +693,7 @@ parser_tuple2ast(PyAST_Object *self, PyObject *args, PyObject *kw)
static
int
static
int
check_terminal_tuple
(
PyObject
*
elem
)
check_terminal_tuple
(
PyObject
*
elem
)
{
{
int
len
=
PyObject_
Length
(
elem
);
int
len
=
PyObject_
Size
(
elem
);
int
res
=
1
;
int
res
=
1
;
char
*
str
=
"Illegal terminal symbol; bad node length."
;
char
*
str
=
"Illegal terminal symbol; bad node length."
;
...
@@ -731,7 +731,7 @@ check_terminal_tuple(PyObject *elem)
...
@@ -731,7 +731,7 @@ check_terminal_tuple(PyObject *elem)
static
node
*
static
node
*
build_node_children
(
PyObject
*
tuple
,
node
*
root
,
int
*
line_num
)
build_node_children
(
PyObject
*
tuple
,
node
*
root
,
int
*
line_num
)
{
{
int
len
=
PyObject_
Length
(
tuple
);
int
len
=
PyObject_
Size
(
tuple
);
int
i
;
int
i
;
for
(
i
=
1
;
i
<
len
;
++
i
)
{
for
(
i
=
1
;
i
<
len
;
++
i
)
{
...
@@ -771,7 +771,7 @@ build_node_children(PyObject *tuple, node *root, int *line_num)
...
@@ -771,7 +771,7 @@ build_node_children(PyObject *tuple, node *root, int *line_num)
(
void
)
strcpy
(
strn
,
PyString_AS_STRING
(
temp
));
(
void
)
strcpy
(
strn
,
PyString_AS_STRING
(
temp
));
Py_DECREF
(
temp
);
Py_DECREF
(
temp
);
if
(
PyObject_
Length
(
elem
)
==
3
)
{
if
(
PyObject_
Size
(
elem
)
==
3
)
{
PyObject
*
temp
=
PySequence_GetItem
(
elem
,
2
);
PyObject
*
temp
=
PySequence_GetItem
(
elem
,
2
);
*
line_num
=
PyInt_AsLong
(
temp
);
*
line_num
=
PyInt_AsLong
(
temp
);
Py_DECREF
(
temp
);
Py_DECREF
(
temp
);
...
...
Modules/posixmodule.c
View file @
245f025e
...
@@ -1417,7 +1417,7 @@ posix_execve(PyObject *self, PyObject *args)
...
@@ -1417,7 +1417,7 @@ posix_execve(PyObject *self, PyObject *args)
}
}
argvlist
[
argc
]
=
NULL
;
argvlist
[
argc
]
=
NULL
;
i
=
PyMapping_
Length
(
env
);
i
=
PyMapping_
Size
(
env
);
envlist
=
PyMem_NEW
(
char
*
,
i
+
1
);
envlist
=
PyMem_NEW
(
char
*
,
i
+
1
);
if
(
envlist
==
NULL
)
{
if
(
envlist
==
NULL
)
{
PyErr_NoMemory
();
PyErr_NoMemory
();
...
@@ -1610,7 +1610,7 @@ posix_spawnve(PyObject *self, PyObject *args)
...
@@ -1610,7 +1610,7 @@ posix_spawnve(PyObject *self, PyObject *args)
}
}
argvlist
[
argc
]
=
NULL
;
argvlist
[
argc
]
=
NULL
;
i
=
PyMapping_
Length
(
env
);
i
=
PyMapping_
Size
(
env
);
envlist
=
PyMem_NEW
(
char
*
,
i
+
1
);
envlist
=
PyMem_NEW
(
char
*
,
i
+
1
);
if
(
envlist
==
NULL
)
{
if
(
envlist
==
NULL
)
{
PyErr_NoMemory
();
PyErr_NoMemory
();
...
...
Modules/stropmodule.c
View file @
245f025e
...
@@ -190,7 +190,7 @@ strop_joinfields(PyObject *self, PyObject *args)
...
@@ -190,7 +190,7 @@ strop_joinfields(PyObject *self, PyObject *args)
seplen
=
1
;
seplen
=
1
;
}
}
seqlen
=
PySequence_
Length
(
seq
);
seqlen
=
PySequence_
Size
(
seq
);
if
(
seqlen
<
0
&&
PyErr_Occurred
())
if
(
seqlen
<
0
&&
PyErr_Occurred
())
return
NULL
;
return
NULL
;
...
...
Objects/listobject.c
View file @
245f025e
...
@@ -563,7 +563,7 @@ listextend(PyListObject *self, PyObject *args)
...
@@ -563,7 +563,7 @@ listextend(PyListObject *self, PyObject *args)
if
(
!
b
)
if
(
!
b
)
return
NULL
;
return
NULL
;
if
(
PyObject_
Length
(
b
)
==
0
)
if
(
PyObject_
Size
(
b
)
==
0
)
/* short circuit when b is empty */
/* short circuit when b is empty */
goto
ok
;
goto
ok
;
...
@@ -585,7 +585,7 @@ listextend(PyListObject *self, PyObject *args)
...
@@ -585,7 +585,7 @@ listextend(PyListObject *self, PyObject *args)
}
}
}
}
blen
=
PyObject_
Length
(
b
);
blen
=
PyObject_
Size
(
b
);
/* resize a using idiom */
/* resize a using idiom */
items
=
self
->
ob_item
;
items
=
self
->
ob_item
;
...
...
Objects/stringobject.c
View file @
245f025e
...
@@ -759,7 +759,7 @@ string_join(PyStringObject *self, PyObject *args)
...
@@ -759,7 +759,7 @@ string_join(PyStringObject *self, PyObject *args)
/* From here on out, errors go through finally: for proper
/* From here on out, errors go through finally: for proper
* reference count manipulations.
* reference count manipulations.
*/
*/
seqlen
=
PySequence_
Length
(
seq
);
seqlen
=
PySequence_
Size
(
seq
);
if
(
seqlen
==
1
)
{
if
(
seqlen
==
1
)
{
item
=
PySequence_Fast_GET_ITEM
(
seq
,
0
);
item
=
PySequence_Fast_GET_ITEM
(
seq
,
0
);
Py_INCREF
(
item
);
Py_INCREF
(
item
);
...
...
Objects/unicodeobject.c
View file @
245f025e
...
@@ -2650,7 +2650,7 @@ PyObject *PyUnicode_Join(PyObject *separator,
...
@@ -2650,7 +2650,7 @@ PyObject *PyUnicode_Join(PyObject *separator,
int
sz
=
100
;
int
sz
=
100
;
int
i
;
int
i
;
seqlen
=
PySequence_
Length
(
seq
);
seqlen
=
PySequence_
Size
(
seq
);
if
(
seqlen
<
0
&&
PyErr_Occurred
())
if
(
seqlen
<
0
&&
PyErr_Occurred
())
return
NULL
;
return
NULL
;
...
...
Python/bltinmodule.c
View file @
245f025e
...
@@ -1385,7 +1385,7 @@ builtin_len(self, args)
...
@@ -1385,7 +1385,7 @@ builtin_len(self, args)
if
(
!
PyArg_ParseTuple
(
args
,
"O:len"
,
&
v
))
if
(
!
PyArg_ParseTuple
(
args
,
"O:len"
,
&
v
))
return
NULL
;
return
NULL
;
res
=
PyObject_
Length
(
v
);
res
=
PyObject_
Size
(
v
);
if
(
res
<
0
&&
PyErr_Occurred
())
if
(
res
<
0
&&
PyErr_Occurred
())
return
NULL
;
return
NULL
;
return
PyInt_FromLong
(
res
);
return
PyInt_FromLong
(
res
);
...
...
Python/exceptions.c
View file @
245f025e
...
@@ -224,7 +224,8 @@ Exception__init__(PyObject* self, PyObject* args)
...
@@ -224,7 +224,8 @@ Exception__init__(PyObject* self, PyObject* args)
return
NULL
;
return
NULL
;
/* set args attribute */
/* set args attribute */
args
=
PySequence_GetSlice
(
args
,
1
,
PySequence_Length
(
args
));
/* XXX size is only a hint */
args
=
PySequence_GetSlice
(
args
,
1
,
PySequence_Size
(
args
));
if
(
!
args
)
if
(
!
args
)
return
NULL
;
return
NULL
;
status
=
PyObject_SetAttrString
(
self
,
"args"
,
args
);
status
=
PyObject_SetAttrString
(
self
,
"args"
,
args
);
...
@@ -249,7 +250,7 @@ Exception__str__(PyObject* self, PyObject* args)
...
@@ -249,7 +250,7 @@ Exception__str__(PyObject* self, PyObject* args)
if
(
!
args
)
if
(
!
args
)
return
NULL
;
return
NULL
;
switch
(
PySequence_
Length
(
args
))
{
switch
(
PySequence_
Size
(
args
))
{
case
0
:
case
0
:
out
=
PyString_FromString
(
""
);
out
=
PyString_FromString
(
""
);
break
;
break
;
...
@@ -374,7 +375,7 @@ SystemExit__init__(PyObject* self, PyObject* args)
...
@@ -374,7 +375,7 @@ SystemExit__init__(PyObject* self, PyObject* args)
return
NULL
;
return
NULL
;
/* Set args attribute. */
/* Set args attribute. */
if
(
!
(
args
=
PySequence_GetSlice
(
args
,
1
,
PySequence_
Length
(
args
))))
if
(
!
(
args
=
PySequence_GetSlice
(
args
,
1
,
PySequence_
Size
(
args
))))
return
NULL
;
return
NULL
;
status
=
PyObject_SetAttrString
(
self
,
"args"
,
args
);
status
=
PyObject_SetAttrString
(
self
,
"args"
,
args
);
...
@@ -384,7 +385,7 @@ SystemExit__init__(PyObject* self, PyObject* args)
...
@@ -384,7 +385,7 @@ SystemExit__init__(PyObject* self, PyObject* args)
}
}
/* set code attribute */
/* set code attribute */
switch
(
PySequence_
Length
(
args
))
{
switch
(
PySequence_
Size
(
args
))
{
case
0
:
case
0
:
Py_INCREF
(
Py_None
);
Py_INCREF
(
Py_None
);
code
=
Py_None
;
code
=
Py_None
;
...
@@ -441,7 +442,7 @@ EnvironmentError__init__(PyObject* self, PyObject* args)
...
@@ -441,7 +442,7 @@ EnvironmentError__init__(PyObject* self, PyObject* args)
if
(
!
(
self
=
get_self
(
args
)))
if
(
!
(
self
=
get_self
(
args
)))
return
NULL
;
return
NULL
;
if
(
!
(
args
=
PySequence_GetSlice
(
args
,
1
,
PySequence_
Length
(
args
))))
if
(
!
(
args
=
PySequence_GetSlice
(
args
,
1
,
PySequence_
Size
(
args
))))
return
NULL
;
return
NULL
;
if
(
PyObject_SetAttrString
(
self
,
"args"
,
args
)
||
if
(
PyObject_SetAttrString
(
self
,
"args"
,
args
)
||
...
@@ -452,7 +453,7 @@ EnvironmentError__init__(PyObject* self, PyObject* args)
...
@@ -452,7 +453,7 @@ EnvironmentError__init__(PyObject* self, PyObject* args)
goto
finally
;
goto
finally
;
}
}
switch
(
PySequence_
Length
(
args
))
{
switch
(
PySequence_
Size
(
args
))
{
case
3
:
case
3
:
/* Where a function has a single filename, such as open() or some
/* Where a function has a single filename, such as open() or some
* of the os module functions, PyErr_SetFromErrnoWithFilename() is
* of the os module functions, PyErr_SetFromErrnoWithFilename() is
...
@@ -671,13 +672,13 @@ SyntaxError__init__(PyObject* self, PyObject* args)
...
@@ -671,13 +672,13 @@ SyntaxError__init__(PyObject* self, PyObject* args)
if
(
!
(
self
=
get_self
(
args
)))
if
(
!
(
self
=
get_self
(
args
)))
return
NULL
;
return
NULL
;
if
(
!
(
args
=
PySequence_GetSlice
(
args
,
1
,
PySequence_
Length
(
args
))))
if
(
!
(
args
=
PySequence_GetSlice
(
args
,
1
,
PySequence_
Size
(
args
))))
return
NULL
;
return
NULL
;
if
(
PyObject_SetAttrString
(
self
,
"args"
,
args
))
if
(
PyObject_SetAttrString
(
self
,
"args"
,
args
))
goto
finally
;
goto
finally
;
lenargs
=
PySequence_
Length
(
args
);
lenargs
=
PySequence_
Size
(
args
);
if
(
lenargs
>=
1
)
{
if
(
lenargs
>=
1
)
{
PyObject
*
item0
=
PySequence_GetItem
(
args
,
0
);
PyObject
*
item0
=
PySequence_GetItem
(
args
,
0
);
int
status
;
int
status
;
...
...
Python/getargs.c
View file @
245f025e
...
@@ -348,7 +348,7 @@ converttuple(arg, p_format, p_va, levels, msgbuf, toplevel)
...
@@ -348,7 +348,7 @@ converttuple(arg, p_format, p_va, levels, msgbuf, toplevel)
return
msgbuf
;
return
msgbuf
;
}
}
if
((
i
=
PySequence_
Length
(
arg
))
!=
n
)
{
if
((
i
=
PySequence_
Size
(
arg
))
!=
n
)
{
levels
[
0
]
=
0
;
levels
[
0
]
=
0
;
sprintf
(
msgbuf
,
sprintf
(
msgbuf
,
toplevel
?
"%d arguments, %d"
:
"%d-sequence, %d-sequence"
,
toplevel
?
"%d arguments, %d"
:
"%d-sequence, %d-sequence"
,
...
...
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