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
68f5abe7
Commit
68f5abe7
authored
Jul 12, 2000
by
Jeremy Hylton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change abstract size functions PySequence_Size &c.
add macros for backwards compatibility with C source
parent
dce48e4e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
15 deletions
+21
-15
Include/abstract.h
Include/abstract.h
+12
-6
Objects/abstract.c
Objects/abstract.c
+8
-8
Objects/object.c
Objects/object.c
+1
-1
No files found.
Include/abstract.h
View file @
68f5abe7
...
...
@@ -381,11 +381,13 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
equivalent to the Python expression: type(o).
*/
DL_IMPORT
(
int
)
PyObject_Length
(
PyObject
*
o
);
DL_IMPORT
(
int
)
PyObject_Size
(
PyObject
*
o
);
#define PyObject_Length(O) PyObject_Size((O))
/*
Return the
length
of object o. If the object, o, provides
both sequence and mapping protocols, the sequence
length
is
Return the
size
of object o. If the object, o, provides
both sequence and mapping protocols, the sequence
size
is
returned. On error, -1 is returned. This is the equivalent
to the Python expression: len(o).
...
...
@@ -681,10 +683,12 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
*/
DL_IMPORT
(
int
)
PySequence_Length
(
PyObject
*
o
);
DL_IMPORT
(
int
)
PySequence_Size
(
PyObject
*
o
);
#define PySequence_Length(O) PySequence_Size((O))
/*
Return the
length
of sequence object o, or -1 on failure.
Return the
size
of sequence object o, or -1 on failure.
*/
...
...
@@ -833,7 +837,9 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
This function always succeeds.
*/
DL_IMPORT
(
int
)
PyMapping_Length
(
PyObject
*
o
);
DL_IMPORT
(
int
)
PyMapping_Size
(
PyObject
*
o
);
#define PyMapping_Length(O) PyMapping_Size((O))
/*
Returns the number of keys in object o on success, and -1 on
...
...
Objects/abstract.c
View file @
68f5abe7
...
...
@@ -62,7 +62,7 @@ PyObject_Type(PyObject *o)
}
int
PyObject_
Length
(
PyObject
*
o
)
PyObject_
Size
(
PyObject
*
o
)
{
PySequenceMethods
*
m
;
...
...
@@ -75,7 +75,7 @@ PyObject_Length(PyObject *o)
if
(
m
&&
m
->
sq_length
)
return
m
->
sq_length
(
o
);
return
PyMapping_
Length
(
o
);
return
PyMapping_
Size
(
o
);
}
PyObject
*
...
...
@@ -803,7 +803,7 @@ PySequence_Check(PyObject *s)
}
int
PySequence_
Length
(
PyObject
*
s
)
PySequence_
Size
(
PyObject
*
s
)
{
PySequenceMethods
*
m
;
...
...
@@ -1036,7 +1036,7 @@ PySequence_Tuple(PyObject *v)
if
(
m
&&
m
->
sq_item
)
{
int
i
;
PyObject
*
t
;
int
n
=
PySequence_
Length
(
v
);
int
n
=
PySequence_
Size
(
v
);
if
(
n
<
0
)
return
NULL
;
t
=
PyTuple_New
(
n
);
...
...
@@ -1087,7 +1087,7 @@ PySequence_List(PyObject *v)
if
(
m
&&
m
->
sq_item
)
{
int
i
;
PyObject
*
l
;
int
n
=
PySequence_
Length
(
v
);
int
n
=
PySequence_
Size
(
v
);
if
(
n
<
0
)
return
NULL
;
l
=
PyList_New
(
n
);
...
...
@@ -1152,7 +1152,7 @@ PySequence_Count(PyObject *s, PyObject *o)
return
-
1
;
}
l
=
PySequence_
Length
(
s
);
l
=
PySequence_
Size
(
s
);
if
(
l
<
0
)
return
-
1
;
...
...
@@ -1232,7 +1232,7 @@ PySequence_Index(PyObject *s, PyObject *o)
return
-
1
;
}
l
=
PySequence_
Length
(
s
);
l
=
PySequence_
Size
(
s
);
if
(
l
<
0
)
return
-
1
;
...
...
@@ -1261,7 +1261,7 @@ PyMapping_Check(PyObject *o)
}
int
PyMapping_
Length
(
PyObject
*
o
)
PyMapping_
Size
(
PyObject
*
o
)
{
PyMappingMethods
*
m
;
...
...
Objects/object.c
View file @
68f5abe7
...
...
@@ -958,7 +958,7 @@ PyTypeObject *_Py_cobject_hack = &PyCObject_Type;
/* Hack to force loading of abstract.o */
int
(
*
_Py_abstract_hack
)(
PyObject
*
)
=
&
PyObject_
Length
;
int
(
*
_Py_abstract_hack
)(
PyObject
*
)
=
&
PyObject_
Size
;
/* Python's malloc wrappers (see mymalloc.h) */
...
...
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