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
dc2004f9
Commit
dc2004f9
authored
Jan 04, 2001
by
Neil Schemenauer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Add nb_cmp slot for new style nubmers.
- Define type flag for new style numbers. - Add Py_NotImplemented.
parent
033c760f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
0 deletions
+22
-0
Include/object.h
Include/object.h
+22
-0
No files found.
Include/object.h
View file @
dc2004f9
...
...
@@ -119,6 +119,11 @@ typedef int (*visitproc)(PyObject *, void *);
typedef
int
(
*
traverseproc
)(
PyObject
*
,
visitproc
,
void
*
);
typedef
struct
{
/* For old style numbers all arguments are guaranteed to be of the
object's type (modulo coercion hacks that is); new style numbers
should check both arguments for proper type and implement the
necessary conversions in the slots themselves. */
binaryfunc
nb_add
;
binaryfunc
nb_subtract
;
binaryfunc
nb_multiply
;
...
...
@@ -153,6 +158,12 @@ typedef struct {
binaryfunc
nb_inplace_and
;
binaryfunc
nb_inplace_xor
;
binaryfunc
nb_inplace_or
;
/* New style number slots; these are only used the
Py_TPFLAGS_NEWSTYLENUMBER flag is set */
binaryfunc
nb_cmp
;
/* XXX this should be richcmpfunc */
}
PyNumberMethods
;
typedef
struct
{
...
...
@@ -322,6 +333,9 @@ given type object has a specified feature.
/* PySequenceMethods and PyNumberMethods contain in-place operators */
#define Py_TPFLAGS_HAVE_INPLACEOPS (1L<<3)
/* PyNumberMethods do their own coercion */
#define Py_TPFLAGS_NEWSTYLENUMBER (1L<<4)
#define Py_TPFLAGS_DEFAULT (Py_TPFLAGS_HAVE_GETCHARBUFFER | \
Py_TPFLAGS_HAVE_SEQUENCE_IN | \
Py_TPFLAGS_HAVE_INPLACEOPS)
...
...
@@ -434,6 +448,14 @@ extern DL_IMPORT(PyObject) _Py_NoneStruct; /* Don't use this directly */
#define Py_None (&_Py_NoneStruct)
/*
Py_NotImplemented is a singleton used to signal that an operation is
not implemented for a given type combination.
*/
extern
DL_IMPORT
(
PyObject
)
_Py_NotImplementedStruct
;
/* Don't use this directly */
#define Py_NotImplemented (&_Py_NotImplementedStruct)
/*
A common programming style in Python requires the forward declaration
...
...
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