+6926
-1312
lines changedFilter options
+6926
-1312
lines changed Original file line number Diff line number Diff line change
@@ -89,6 +89,7 @@
89
89
#include "sliceobject.h"
90
90
#include "cellobject.h"
91
91
#include "iterobject.h"
92
+
#include "descrobject.h"
92
93
93
94
#include "codecs.h"
94
95
#include "pyerrors.h"
Original file line number Diff line number Diff line change
@@ -294,6 +294,17 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
294
294
*/
295
295
296
296
297
+
298
+
DL_IMPORT(PyObject *) PyObject_Call(PyObject *callable_object,
299
+
PyObject *args, PyObject *kw);
300
+
301
+
/*
302
+
303
+
Call a callable Python object, callable_object, with
304
+
arguments and keywords arguments. The 'args' argument can not be
305
+
NULL, but the 'kw' argument can be NULL.
306
+
307
+
*/
297
308
298
309
DL_IMPORT(PyObject *) PyObject_CallObject(PyObject *callable_object,
299
310
PyObject *args);
Original file line number Diff line number Diff line change
@@ -45,6 +45,9 @@ DL_IMPORT(int) Py_MakePendingCalls(void);
45
45
DL_IMPORT(void) Py_SetRecursionLimit(int);
46
46
DL_IMPORT(int) Py_GetRecursionLimit(void);
47
47
48
+
DL_IMPORT(char *) PyEval_GetFuncName(PyObject *);
49
+
DL_IMPORT(char *) PyEval_GetFuncDesc(PyObject *);
50
+
48
51
/* Interface for threads.
49
52
50
53
A module that plans to do a blocking system call (or something else
Original file line number Diff line number Diff line change
@@ -47,10 +47,6 @@ extern DL_IMPORT(PyObject *) PyInstance_New(PyObject *, PyObject *,
47
47
extern DL_IMPORT(PyObject *) PyInstance_NewRaw(PyObject *, PyObject *);
48
48
extern DL_IMPORT(PyObject *) PyMethod_New(PyObject *, PyObject *, PyObject *);
49
49
50
-
extern DL_IMPORT(PyObject *) PyMethod_Function(PyObject *);
51
-
extern DL_IMPORT(PyObject *) PyMethod_Self(PyObject *);
52
-
extern DL_IMPORT(PyObject *) PyMethod_Class(PyObject *);
53
-
54
50
/* Macros for direct access to these values. Type checks are *not*
55
51
done, so use with care. */
56
52
#define PyMethod_GET_FUNCTION(meth) \
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
1
+
/* XXX getter, setter, getsetlist and wrapperbase need 'Py'-prefixed names */
2
+
3
+
typedef PyObject *(*getter)(PyObject *, void *);
4
+
typedef int (*setter)(PyObject *, PyObject *, void *);
5
+
6
+
struct getsetlist {
7
+
char *name;
8
+
getter get;
9
+
setter set;
10
+
void *closure;
11
+
};
12
+
13
+
typedef PyObject *(*wrapperfunc)(PyObject *self, PyObject *args,
14
+
void *wrapped);
15
+
16
+
struct wrapperbase {
17
+
char *name;
18
+
wrapperfunc wrapper;
19
+
char *doc;
20
+
};
21
+
22
+
extern DL_IMPORT(PyObject *) PyDescr_NewMethod(PyTypeObject *, PyMethodDef *);
23
+
extern DL_IMPORT(PyObject *) PyDescr_NewMember(PyTypeObject *,
24
+
struct memberlist *);
25
+
extern DL_IMPORT(PyObject *) PyDescr_NewGetSet(PyTypeObject *,
26
+
struct getsetlist *);
27
+
extern DL_IMPORT(PyObject *) PyDescr_NewWrapper(PyTypeObject *,
28
+
struct wrapperbase *, void *);
29
+
extern DL_IMPORT(int) PyDescr_IsData(PyObject *);
30
+
31
+
extern DL_IMPORT(PyObject *) PyDictProxy_New(PyObject *);
32
+
extern DL_IMPORT(PyObject *) PyWrapper_New(PyObject *, PyObject *);
Original file line number Diff line number Diff line change
@@ -7,9 +7,83 @@ extern "C" {
7
7
8
8
/* Dictionary object type -- mapping from hashable object to object */
9
9
10
+
/*
11
+
There are three kinds of slots in the table:
12
+
13
+
1. Unused. me_key == me_value == NULL
14
+
Does not hold an active (key, value) pair now and never did. Unused can
15
+
transition to Active upon key insertion. This is the only case in which
16
+
me_key is NULL, and is each slot's initial state.
17
+
18
+
2. Active. me_key != NULL and me_key != dummy and me_value != NULL
19
+
Holds an active (key, value) pair. Active can transition to Dummy upon
20
+
key deletion. This is the only case in which me_value != NULL.
21
+
22
+
3. Dummy. me_key == dummy and me_value == NULL
23
+
Previously held an active (key, value) pair, but that was deleted and an
24
+
active pair has not yet overwritten the slot. Dummy can transition to
25
+
Active upon key insertion. Dummy slots cannot be made Unused again
26
+
(cannot have me_key set to NULL), else the probe sequence in case of
27
+
collision would have no way to know they were once active.
28
+
29
+
Note: .popitem() abuses the me_hash field of an Unused or Dummy slot to
30
+
hold a search finger. The me_hash field of Unused or Dummy slots has no
31
+
meaning otherwise.
32
+
*/
33
+
34
+
/* PyDict_MINSIZE is the minimum size of a dictionary. This many slots are
35
+
* allocated directly in the dict object (in the ma_smalltable member).
36
+
* It must be a power of 2, and at least 4. 8 allows dicts with no more
37
+
* than 5 active entries to live in ma_smalltable (and so avoid an
38
+
* additional malloc); instrumentation suggested this suffices for the
39
+
* majority of dicts (consisting mostly of usually-small instance dicts and
40
+
* usually-small dicts created to pass keyword arguments).
41
+
*/
42
+
#define PyDict_MINSIZE 8
43
+
44
+
typedef struct {
45
+
long me_hash; /* cached hash code of me_key */
46
+
PyObject *me_key;
47
+
PyObject *me_value;
48
+
#ifdef USE_CACHE_ALIGNED
49
+
long aligner;
50
+
#endif
51
+
} PyDictEntry;
52
+
53
+
/*
54
+
To ensure the lookup algorithm terminates, there must be at least one Unused
55
+
slot (NULL key) in the table.
56
+
The value ma_fill is the number of non-NULL keys (sum of Active and Dummy);
57
+
ma_used is the number of non-NULL, non-dummy keys (== the number of non-NULL
58
+
values == the number of Active items).
59
+
To avoid slowing down lookups on a near-full table, we resize the table when
60
+
it's two-thirds full.
61
+
*/
62
+
typedef struct _dictobject PyDictObject;
63
+
struct _dictobject {
64
+
PyObject_HEAD
65
+
int ma_fill; /* # Active + # Dummy */
66
+
int ma_used; /* # Active */
67
+
68
+
/* The table contains ma_mask + 1 slots, and that's a power of 2.
69
+
* We store the mask instead of the size because the mask is more
70
+
* frequently needed.
71
+
*/
72
+
int ma_mask;
73
+
74
+
/* ma_table points to ma_smalltable for small tables, else to
75
+
* additional malloc'ed memory. ma_table is never NULL! This rule
76
+
* saves repeated runtime null-tests in the workhorse getitem and
77
+
* setitem calls.
78
+
*/
79
+
PyDictEntry *ma_table;
80
+
PyDictEntry *(*ma_lookup)(PyDictObject *mp, PyObject *key, long hash);
81
+
PyDictEntry ma_smalltable[PyDict_MINSIZE];
82
+
};
83
+
10
84
extern DL_IMPORT(PyTypeObject) PyDict_Type;
11
85
12
-
#define PyDict_Check(op) ((op)->ob_type == &PyDict_Type)
86
+
#define PyDict_Check(op) PyObject_TypeCheck(op, &PyDict_Type)
13
87
14
88
extern DL_IMPORT(PyObject *) PyDict_New(void);
15
89
extern DL_IMPORT(PyObject *) PyDict_GetItem(PyObject *mp, PyObject *key);
@@ -23,6 +97,7 @@ extern DL_IMPORT(PyObject *) PyDict_Values(PyObject *mp);
23
97
extern DL_IMPORT(PyObject *) PyDict_Items(PyObject *mp);
24
98
extern DL_IMPORT(int) PyDict_Size(PyObject *mp);
25
99
extern DL_IMPORT(PyObject *) PyDict_Copy(PyObject *mp);
100
+
extern DL_IMPORT(int) PyDict_Update(PyObject *mp, PyObject *other);
26
101
27
102
28
103
extern DL_IMPORT(PyObject *) PyDict_GetItemString(PyObject *dp, char *key);
Original file line number Diff line number Diff line change
@@ -9,6 +9,14 @@ extern "C" {
9
9
10
10
DL_IMPORT(PyObject *) PyEval_EvalCode(PyCodeObject *, PyObject *, PyObject *);
11
11
12
+
DL_IMPORT(PyObject *) PyEval_EvalCodeEx(PyCodeObject *co,
13
+
PyObject *globals,
14
+
PyObject *locals,
15
+
PyObject **args, int argc,
16
+
PyObject **kwds, int kwdc,
17
+
PyObject **defs, int defc,
18
+
PyObject *closure);
19
+
12
20
#ifdef __cplusplus
13
21
}
14
22
#endif
Original file line number Diff line number Diff line change
@@ -42,6 +42,13 @@ extern DL_IMPORT(int) PyFunction_SetClosure(PyObject *, PyObject *);
42
42
#define PyFunction_GET_CLOSURE(func) \
43
43
(((PyFunctionObject *)func) -> func_closure)
44
44
45
+
/* The classmethod and staticmethod types lives here, too */
46
+
extern DL_IMPORT(PyTypeObject) PyClassMethod_Type;
47
+
extern DL_IMPORT(PyTypeObject) PyStaticMethod_Type;
48
+
49
+
extern DL_IMPORT(PyObject *) PyClassMethod_New(PyObject *);
50
+
extern DL_IMPORT(PyObject *) PyStaticMethod_New(PyObject *);
51
+
45
52
#ifdef __cplusplus
46
53
}
47
54
#endif
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@ typedef struct {
26
26
27
27
extern DL_IMPORT(PyTypeObject) PyList_Type;
28
28
29
-
#define PyList_Check(op) ((op)->ob_type == &PyList_Type)
29
+
#define PyList_Check(op) PyObject_TypeCheck(op, &PyList_Type)
30
30
31
31
extern DL_IMPORT(PyObject *) PyList_New(int size);
32
32
extern DL_IMPORT(int) PyList_Size(PyObject *);
Original file line number Diff line number Diff line change
@@ -22,8 +22,8 @@ extern DL_IMPORT(int) PyModule_AddObject(PyObject *, char *, PyObject *);
22
22
extern DL_IMPORT(int) PyModule_AddIntConstant(PyObject *, char *, long);
23
23
extern DL_IMPORT(int) PyModule_AddStringConstant(PyObject *, char *, char *);
24
24
25
-
#define PYTHON_API_VERSION 1010
26
-
#define PYTHON_API_STRING "1010"
25
+
#define PYTHON_API_VERSION 1011
26
+
#define PYTHON_API_STRING "1011"
27
27
/* The API version is maintained (independently from the Python version)
28
28
so we can detect mismatches between the interpreter and dynamically
29
29
loaded modules. These are diagnosed by an error message but
@@ -37,6 +37,8 @@ extern DL_IMPORT(int) PyModule_AddStringConstant(PyObject *, char *, char *);
37
37
Please add a line or two to the top of this log for each API
38
38
version change:
39
39
40
+
17-Jul-2001 GvR 1011 Descr-branch, just to be on the safe side
41
+
40
42
25-Jan-2001 FLD 1010 Parameters added to PyCode_New() and
41
43
PyFrame_New(); Python 2.1a2
42
44
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4