[Python-checkins] r85973 - in python/branches/pep-0384: Include/bytearrayobject.h Include/bytesobject.h Include/ceval.h Include/complexobject.h Include/descrobject.h Include/dictobject.h Include/floatobject.h Include/import.h Include/listobject.h Include/longintrepr.h Include/memoryobject.h Include/methodobject.h Include/object.h Include/objimpl.h Include/pyatomic.h Include/pyerrors.h Include/pystate.h Include/pythonrun.h Include/setobject.h Include/sliceobject.h Include/traceback.h Include/tupleobject.h Include/weakrefobject.h Modules/_ctypes/_ctypes.c Modules/_ctypes/callproc.c Modules/_ctypes/cfield.c Modules/_elementtree.c Modules/_json.c Modules/_localemodule.c Modules/arraymodule.c Modules/mmapmodule.c Modules/timemodule.c Modules/xxlimited.c Objects/bytearrayobject.c Objects/bytesobject.c Objects/listobject.c Objects/memoryobject.c Objects/sliceobject.c Objects/tupleobject.c Python/pythonrun.c
martin.v.loewis
python-checkins at python.org
Sat Oct 30 13:10:45 CEST 2010
Author: martin.v.loewis
Date: Sat Oct 30 13:10:45 2010
New Revision: 85973
Log:
Remove unexposed structs from Py_LIMITED_API.
Modified:
python/branches/pep-0384/Include/bytearrayobject.h
python/branches/pep-0384/Include/bytesobject.h
python/branches/pep-0384/Include/ceval.h
python/branches/pep-0384/Include/complexobject.h
python/branches/pep-0384/Include/descrobject.h
python/branches/pep-0384/Include/dictobject.h
python/branches/pep-0384/Include/floatobject.h
python/branches/pep-0384/Include/import.h
python/branches/pep-0384/Include/listobject.h
python/branches/pep-0384/Include/longintrepr.h
python/branches/pep-0384/Include/memoryobject.h
python/branches/pep-0384/Include/methodobject.h
python/branches/pep-0384/Include/object.h
python/branches/pep-0384/Include/objimpl.h
python/branches/pep-0384/Include/pyatomic.h
python/branches/pep-0384/Include/pyerrors.h
python/branches/pep-0384/Include/pystate.h
python/branches/pep-0384/Include/pythonrun.h
python/branches/pep-0384/Include/setobject.h
python/branches/pep-0384/Include/sliceobject.h
python/branches/pep-0384/Include/traceback.h
python/branches/pep-0384/Include/tupleobject.h
python/branches/pep-0384/Include/weakrefobject.h
python/branches/pep-0384/Modules/_ctypes/_ctypes.c
python/branches/pep-0384/Modules/_ctypes/callproc.c
python/branches/pep-0384/Modules/_ctypes/cfield.c
python/branches/pep-0384/Modules/_elementtree.c
python/branches/pep-0384/Modules/_json.c
python/branches/pep-0384/Modules/_localemodule.c
python/branches/pep-0384/Modules/arraymodule.c
python/branches/pep-0384/Modules/mmapmodule.c
python/branches/pep-0384/Modules/timemodule.c
python/branches/pep-0384/Modules/xxlimited.c
python/branches/pep-0384/Objects/bytearrayobject.c
python/branches/pep-0384/Objects/bytesobject.c
python/branches/pep-0384/Objects/listobject.c
python/branches/pep-0384/Objects/memoryobject.c
python/branches/pep-0384/Objects/sliceobject.c
python/branches/pep-0384/Objects/tupleobject.c
python/branches/pep-0384/Python/pythonrun.c
Modified: python/branches/pep-0384/Include/bytearrayobject.h
==============================================================================
--- python/branches/pep-0384/Include/bytearrayobject.h (original)
+++ python/branches/pep-0384/Include/bytearrayobject.h Sat Oct 30 13:10:45 2010
@@ -19,6 +19,7 @@
*/
/* Object layout */
+#ifndef Py_LIMITED_API
typedef struct {
PyObject_VAR_HEAD
/* XXX(nnorwitz): should ob_exports be Py_ssize_t? */
@@ -26,6 +27,7 @@
Py_ssize_t ob_alloc; /* How many bytes allocated */
char *ob_bytes;
} PyByteArrayObject;
+#endif
/* Type object */
PyAPI_DATA(PyTypeObject) PyByteArray_Type;
Modified: python/branches/pep-0384/Include/bytesobject.h
==============================================================================
--- python/branches/pep-0384/Include/bytesobject.h (original)
+++ python/branches/pep-0384/Include/bytesobject.h Sat Oct 30 13:10:45 2010
@@ -27,6 +27,7 @@
/* Caching the hash (ob_shash) saves recalculation of a string's hash value.
This significantly speeds up dict lookups. */
+#ifndef Py_LIMITED_API
typedef struct {
PyObject_VAR_HEAD
long ob_shash;
@@ -38,6 +39,7 @@
* ob_shash is the hash of the string or -1 if not computed yet.
*/
} PyBytesObject;
+#endif
PyAPI_DATA(PyTypeObject) PyBytes_Type;
PyAPI_DATA(PyTypeObject) PyBytesIter_Type;
@@ -66,9 +68,11 @@
const char *);
/* Macro, trading safety for speed */
+#ifndef Py_LIMITED_API
#define PyBytes_AS_STRING(op) (assert(PyBytes_Check(op)), \
(((PyBytesObject *)(op))->ob_sval))
#define PyBytes_GET_SIZE(op) (assert(PyBytes_Check(op)),Py_SIZE(op))
+#endif
/* _PyBytes_Join(sep, x) is like sep.join(x). sep must be PyBytesObject*,
x must be an iterable object. */
Modified: python/branches/pep-0384/Include/ceval.h
==============================================================================
--- python/branches/pep-0384/Include/ceval.h (original)
+++ python/branches/pep-0384/Include/ceval.h Sat Oct 30 13:10:45 2010
@@ -20,8 +20,10 @@
const char *methodname,
const char *format, ...);
+#ifndef Py_LIMITED_API
PyAPI_FUNC(void) PyEval_SetProfile(Py_tracefunc, PyObject *);
PyAPI_FUNC(void) PyEval_SetTrace(Py_tracefunc, PyObject *);
+#endif
struct _frame; /* Avoid including frameobject.h */
@@ -33,7 +35,9 @@
/* Look at the current frame's (if any) code's co_flags, and turn on
the corresponding compiler flags in cf->cf_flags. Return 1 if any
flag was set, else return 0. */
+#ifndef Py_LIMITED_API
PyAPI_FUNC(int) PyEval_MergeCompilerFlags(PyCompilerFlags *cf);
+#endif
PyAPI_FUNC(int) Py_AddPendingCall(int (*func)(void *), void *arg);
PyAPI_FUNC(int) Py_MakePendingCalls(void);
Modified: python/branches/pep-0384/Include/complexobject.h
==============================================================================
--- python/branches/pep-0384/Include/complexobject.h (original)
+++ python/branches/pep-0384/Include/complexobject.h Sat Oct 30 13:10:45 2010
@@ -6,6 +6,7 @@
extern "C" {
#endif
+#ifndef Py_LIMITED_API
typedef struct {
double real;
double imag;
@@ -28,7 +29,7 @@
PyAPI_FUNC(Py_complex) c_quot(Py_complex, Py_complex);
PyAPI_FUNC(Py_complex) c_pow(Py_complex, Py_complex);
PyAPI_FUNC(double) c_abs(Py_complex);
-
+#endif
/* Complex object interface */
@@ -36,23 +37,28 @@
PyComplexObject represents a complex number with double-precision
real and imaginary parts.
*/
-
+#ifndef Py_LIMITED_API
typedef struct {
PyObject_HEAD
Py_complex cval;
-} PyComplexObject;
+} PyComplexObject;
+#endif
PyAPI_DATA(PyTypeObject) PyComplex_Type;
#define PyComplex_Check(op) PyObject_TypeCheck(op, &PyComplex_Type)
#define PyComplex_CheckExact(op) (Py_TYPE(op) == &PyComplex_Type)
+#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject *) PyComplex_FromCComplex(Py_complex);
+#endif
PyAPI_FUNC(PyObject *) PyComplex_FromDoubles(double real, double imag);
PyAPI_FUNC(double) PyComplex_RealAsDouble(PyObject *op);
PyAPI_FUNC(double) PyComplex_ImagAsDouble(PyObject *op);
+#ifndef Py_LIMITED_API
PyAPI_FUNC(Py_complex) PyComplex_AsCComplex(PyObject *op);
+#endif
/* Format the object based on the format_spec, as defined in PEP 3101
(Advanced String Formatting). */
Modified: python/branches/pep-0384/Include/descrobject.h
==============================================================================
--- python/branches/pep-0384/Include/descrobject.h (original)
+++ python/branches/pep-0384/Include/descrobject.h Sat Oct 30 13:10:45 2010
@@ -22,6 +22,7 @@
typedef PyObject *(*wrapperfunc_kwds)(PyObject *self, PyObject *args,
void *wrapped, PyObject *kwds);
+#ifndef Py_LIMITED_API
struct wrapperbase {
char *name;
int offset;
@@ -68,6 +69,7 @@
struct wrapperbase *d_base;
void *d_wrapped; /* This can be any function pointer */
} PyWrapperDescrObject;
+#endif /* Py_LIMITED_API */
PyAPI_DATA(PyTypeObject) PyClassMethodDescr_Type;
PyAPI_DATA(PyTypeObject) PyGetSetDescr_Type;
@@ -78,13 +80,16 @@
PyAPI_FUNC(PyObject *) PyDescr_NewMethod(PyTypeObject *, PyMethodDef *);
PyAPI_FUNC(PyObject *) PyDescr_NewClassMethod(PyTypeObject *, PyMethodDef *);
+struct PyMemberDef; /* forward declaration for following prototype */
PyAPI_FUNC(PyObject *) PyDescr_NewMember(PyTypeObject *,
struct PyMemberDef *);
PyAPI_FUNC(PyObject *) PyDescr_NewGetSet(PyTypeObject *,
struct PyGetSetDef *);
+#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject *) PyDescr_NewWrapper(PyTypeObject *,
struct wrapperbase *, void *);
#define PyDescr_IsData(d) (Py_TYPE(d)->tp_descr_set != NULL)
+#endif
PyAPI_FUNC(PyObject *) PyDictProxy_New(PyObject *);
PyAPI_FUNC(PyObject *) PyWrapper_New(PyObject *, PyObject *);
Modified: python/branches/pep-0384/Include/dictobject.h
==============================================================================
--- python/branches/pep-0384/Include/dictobject.h (original)
+++ python/branches/pep-0384/Include/dictobject.h Sat Oct 30 13:10:45 2010
@@ -45,6 +45,7 @@
* majority of dicts (consisting mostly of usually-small instance dicts and
* usually-small dicts created to pass keyword arguments).
*/
+#ifndef Py_LIMITED_API
#define PyDict_MINSIZE 8
typedef struct {
@@ -87,6 +88,7 @@
PyDictEntry *(*ma_lookup)(PyDictObject *mp, PyObject *key, long hash);
PyDictEntry ma_smalltable[PyDict_MINSIZE];
};
+#endif /* Py_LIMITED_API */
PyAPI_DATA(PyTypeObject) PyDict_Type;
PyAPI_DATA(PyTypeObject) PyDictIterKey_Type;
Modified: python/branches/pep-0384/Include/floatobject.h
==============================================================================
--- python/branches/pep-0384/Include/floatobject.h (original)
+++ python/branches/pep-0384/Include/floatobject.h Sat Oct 30 13:10:45 2010
@@ -11,10 +11,12 @@
extern "C" {
#endif
+#ifndef Py_LIMITED_API
typedef struct {
PyObject_HEAD
double ob_fval;
} PyFloatObject;
+#endif
PyAPI_DATA(PyTypeObject) PyFloat_Type;
@@ -45,7 +47,9 @@
/* Extract C double from Python float. The macro version trades safety for
speed. */
PyAPI_FUNC(double) PyFloat_AsDouble(PyObject *);
+#ifndef Py_LIMITED_API
#define PyFloat_AS_DOUBLE(op) (((PyFloatObject *)(op))->ob_fval)
+#endif
/* _PyFloat_{Pack,Unpack}{4,8}
*
Modified: python/branches/pep-0384/Include/import.h
==============================================================================
--- python/branches/pep-0384/Include/import.h (original)
+++ python/branches/pep-0384/Include/import.h Sat Oct 30 13:10:45 2010
@@ -43,17 +43,20 @@
PyAPI_FUNC(PyObject *)_PyImport_FindExtension(char *, char *);
PyAPI_FUNC(int)_PyImport_FixupExtension(PyObject*, char *, char *);
+#ifndef Py_LIMITED_API
struct _inittab {
char *name;
PyObject* (*initfunc)(void);
};
+PyAPI_DATA(struct _inittab *) PyImport_Inittab;
+PyAPI_FUNC(int) PyImport_ExtendInittab(struct _inittab *newtab);
+#endif
PyAPI_DATA(PyTypeObject) PyNullImporter_Type;
-PyAPI_DATA(struct _inittab *) PyImport_Inittab;
PyAPI_FUNC(int) PyImport_AppendInittab(const char *name, PyObject* (*initfunc)(void));
-PyAPI_FUNC(int) PyImport_ExtendInittab(struct _inittab *newtab);
+#ifndef Py_LIMITED_API
struct _frozen {
char *name;
unsigned char *code;
@@ -64,6 +67,7 @@
collection of frozen modules: */
PyAPI_DATA(struct _frozen *) PyImport_FrozenModules;
+#endif
#ifdef __cplusplus
}
Modified: python/branches/pep-0384/Include/listobject.h
==============================================================================
--- python/branches/pep-0384/Include/listobject.h (original)
+++ python/branches/pep-0384/Include/listobject.h Sat Oct 30 13:10:45 2010
@@ -19,6 +19,7 @@
extern "C" {
#endif
+#ifndef Py_LIMITED_API
typedef struct {
PyObject_VAR_HEAD
/* Vector of pointers to list elements. list[0] is ob_item[0], etc. */
@@ -37,6 +38,7 @@
*/
Py_ssize_t allocated;
} PyListObject;
+#endif
PyAPI_DATA(PyTypeObject) PyList_Type;
PyAPI_DATA(PyTypeObject) PyListIter_Type;
@@ -58,12 +60,16 @@
PyAPI_FUNC(int) PyList_Sort(PyObject *);
PyAPI_FUNC(int) PyList_Reverse(PyObject *);
PyAPI_FUNC(PyObject *) PyList_AsTuple(PyObject *);
+#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject *) _PyList_Extend(PyListObject *, PyObject *);
+#endif
/* Macro, trading safety for speed */
+#ifndef Py_LIMITED_API
#define PyList_GET_ITEM(op, i) (((PyListObject *)(op))->ob_item[i])
#define PyList_SET_ITEM(op, i, v) (((PyListObject *)(op))->ob_item[i] = (v))
#define PyList_GET_SIZE(op) Py_SIZE(op)
+#endif
#ifdef __cplusplus
}
Modified: python/branches/pep-0384/Include/longintrepr.h
==============================================================================
--- python/branches/pep-0384/Include/longintrepr.h (original)
+++ python/branches/pep-0384/Include/longintrepr.h Sat Oct 30 13:10:45 2010
@@ -1,3 +1,4 @@
+#ifndef Py_LIMITED_API
#ifndef Py_LONGINTREPR_H
#define Py_LONGINTREPR_H
#ifdef __cplusplus
@@ -99,3 +100,4 @@
}
#endif
#endif /* !Py_LONGINTREPR_H */
+#endif /* Py_LIMITED_API */
Modified: python/branches/pep-0384/Include/memoryobject.h
==============================================================================
--- python/branches/pep-0384/Include/memoryobject.h (original)
+++ python/branches/pep-0384/Include/memoryobject.h Sat Oct 30 13:10:45 2010
@@ -10,10 +10,12 @@
#define PyMemoryView_Check(op) (Py_TYPE(op) == &PyMemoryView_Type)
+#ifndef Py_LIMITED_API
/* Get a pointer to the underlying Py_buffer of a memoryview object. */
#define PyMemoryView_GET_BUFFER(op) (&((PyMemoryViewObject *)(op))->view)
/* Get a pointer to the PyObject from which originates a memoryview object. */
#define PyMemoryView_GET_BASE(op) (((PyMemoryViewObject *)(op))->view.obj)
+#endif
PyAPI_FUNC(PyObject *) PyMemoryView_GetContiguous(PyObject *base,
@@ -61,12 +63,13 @@
/* The struct is declared here so that macros can work, but it shouldn't
be considered public. Don't access those fields directly, use the macros
and functions instead! */
+#ifndef Py_LIMITED_API
typedef struct {
PyObject_HEAD
PyObject *base;
Py_buffer view;
} PyMemoryViewObject;
-
+#endif
#ifdef __cplusplus
}
Modified: python/branches/pep-0384/Include/methodobject.h
==============================================================================
--- python/branches/pep-0384/Include/methodobject.h (original)
+++ python/branches/pep-0384/Include/methodobject.h Sat Oct 30 13:10:45 2010
@@ -26,12 +26,14 @@
/* Macros for direct access to these values. Type checks are *not*
done, so use with care. */
+#ifndef Py_LIMITED_API
#define PyCFunction_GET_FUNCTION(func) \
(((PyCFunctionObject *)func) -> m_ml -> ml_meth)
#define PyCFunction_GET_SELF(func) \
(((PyCFunctionObject *)func) -> m_self)
#define PyCFunction_GET_FLAGS(func) \
(((PyCFunctionObject *)func) -> m_ml -> ml_flags)
+#endif
PyAPI_FUNC(PyObject *) PyCFunction_Call(PyObject *, PyObject *, PyObject *);
struct PyMethodDef {
@@ -68,12 +70,14 @@
#define METH_COEXIST 0x0040
+#ifndef Py_LIMITED_API
typedef struct {
PyObject_HEAD
PyMethodDef *m_ml; /* Description of the C function to call */
PyObject *m_self; /* Passed as 'self' arg to the C func, can be NULL */
PyObject *m_module; /* The __module__ attribute, can be anything */
} PyCFunctionObject;
+#endif
PyAPI_FUNC(int) PyCFunction_ClearFreeList(void);
Modified: python/branches/pep-0384/Include/object.h
==============================================================================
--- python/branches/pep-0384/Include/object.h (original)
+++ python/branches/pep-0384/Include/object.h Sat Oct 30 13:10:45 2010
@@ -201,6 +201,7 @@
typedef int (*visitproc)(PyObject *, void *);
typedef int (*traverseproc)(PyObject *, visitproc, void *);
+#ifndef Py_LIMITED_API
typedef struct {
/* Number implementations must check *both*
arguments for proper type and implement the necessary conversions
@@ -270,6 +271,7 @@
getbufferproc bf_getbuffer;
releasebufferproc bf_releasebuffer;
} PyBufferProcs;
+#endif /* Py_LIMITED_API */
typedef void (*freefunc)(void *);
typedef void (*destructor)(PyObject *);
Modified: python/branches/pep-0384/Include/objimpl.h
==============================================================================
--- python/branches/pep-0384/Include/objimpl.h (original)
+++ python/branches/pep-0384/Include/objimpl.h Sat Oct 30 13:10:45 2010
@@ -246,6 +246,7 @@
#define _PyObject_GC_Del PyObject_GC_Del
/* GC information is stored BEFORE the object structure. */
+#ifndef Py_LIMITED_API
typedef union _gc_head {
struct {
union _gc_head *gc_next;
@@ -298,7 +299,7 @@
#define _PyObject_GC_MAY_BE_TRACKED(obj) \
(PyObject_IS_GC(obj) && \
(!PyTuple_CheckExact(obj) || _PyObject_GC_IS_TRACKED(obj)))
-
+#endif /* Py_LIMITED_API */
PyAPI_FUNC(PyObject *) _PyObject_GC_Malloc(size_t);
PyAPI_FUNC(PyObject *) _PyObject_GC_New(PyTypeObject *);
Modified: python/branches/pep-0384/Include/pyatomic.h
==============================================================================
--- python/branches/pep-0384/Include/pyatomic.h (original)
+++ python/branches/pep-0384/Include/pyatomic.h Sat Oct 30 13:10:45 2010
@@ -1,3 +1,4 @@
+#ifndef Py_LIMITED_API
#ifndef Py_ATOMIC_H
#define Py_ATOMIC_H
/* XXX: When compilers start offering a stdatomic.h with lock-free
@@ -177,3 +178,4 @@
#endif
#endif /* Py_ATOMIC_H */
+#endif /* Py_LIMITED_API */
Modified: python/branches/pep-0384/Include/pyerrors.h
==============================================================================
--- python/branches/pep-0384/Include/pyerrors.h (original)
+++ python/branches/pep-0384/Include/pyerrors.h Sat Oct 30 13:10:45 2010
@@ -6,6 +6,7 @@
/* Error objects */
+#ifndef Py_LIMITED_API
/* PyException_HEAD defines the initial segment of every exception class. */
#define PyException_HEAD PyObject_HEAD PyObject *dict;\
PyObject *args; PyObject *traceback;\
@@ -55,6 +56,7 @@
PyObject *winerror;
} PyWindowsErrorObject;
#endif
+#endif
/* Error handling definitions */
@@ -67,7 +69,7 @@
PyAPI_FUNC(void) PyErr_Restore(PyObject *, PyObject *, PyObject *);
PyAPI_FUNC(void) Py_FatalError(const char *message);
-#ifdef Py_DEBUG
+#if defined(Py_DEBUG) || defined(Py_LIMITED_API)
#define _PyErr_OCCURRED() PyErr_Occurred()
#else
#define _PyErr_OCCURRED() (_PyThreadState_Current->curexc_type)
Modified: python/branches/pep-0384/Include/pystate.h
==============================================================================
--- python/branches/pep-0384/Include/pystate.h (original)
+++ python/branches/pep-0384/Include/pystate.h Sat Oct 30 13:10:45 2010
@@ -13,6 +13,9 @@
struct _ts; /* Forward */
struct _is; /* Forward */
+#ifdef Py_LIMITED_API
+typedef struct _is PyInterpreterState;
+#else
typedef struct _is {
struct _is *next;
@@ -37,12 +40,14 @@
#endif
} PyInterpreterState;
+#endif
/* State unique per thread */
struct _frame; /* Avoid including frameobject.h */
+#ifndef Py_LIMITED_API
/* Py_tracefunc return -1 when raising an exception, or 0 for success. */
typedef int (*Py_tracefunc)(PyObject *, struct _frame *, int, PyObject *);
@@ -54,7 +59,11 @@
#define PyTrace_C_CALL 4
#define PyTrace_C_EXCEPTION 5
#define PyTrace_C_RETURN 6
+#endif
+#ifdef Py_LIMITED_API
+typedef struct _ts PyThreadState;
+#else
typedef struct _ts {
/* See Python/ceval.c for comments explaining most fields */
@@ -106,6 +115,7 @@
/* XXX signal handlers should also be here */
} PyThreadState;
+#endif
PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_New(void);
@@ -133,9 +143,11 @@
/* Assuming the current thread holds the GIL, this is the
PyThreadState for the current thread. */
+#ifndef Py_LIMITED_API
PyAPI_DATA(_Py_atomic_address) _PyThreadState_Current;
+#endif
-#ifdef Py_DEBUG
+#if defined(Py_DEBUG) || defined(Py_LIMITED_API)
#define PyThreadState_GET() PyThreadState_Get()
#else
#define PyThreadState_GET() \
Modified: python/branches/pep-0384/Include/pythonrun.h
==============================================================================
--- python/branches/pep-0384/Include/pythonrun.h (original)
+++ python/branches/pep-0384/Include/pythonrun.h Sat Oct 30 13:10:45 2010
@@ -16,9 +16,11 @@
#define PyCF_ONLY_AST 0x0400
#define PyCF_IGNORE_COOKIE 0x0800
+#ifndef Py_LIMITED_API
typedef struct {
int cf_flags; /* bitmask of CO_xxx flags relevant to future */
} PyCompilerFlags;
+#endif
PyAPI_FUNC(void) Py_SetProgramName(wchar_t *);
PyAPI_FUNC(wchar_t *) Py_GetProgramName(void);
@@ -33,8 +35,8 @@
PyAPI_FUNC(PyThreadState *) Py_NewInterpreter(void);
PyAPI_FUNC(void) Py_EndInterpreter(PyThreadState *);
-PyAPI_FUNC(int) PyRun_SimpleStringFlags(const char *, PyCompilerFlags *);
#ifndef Py_LIMITED_API
+PyAPI_FUNC(int) PyRun_SimpleStringFlags(const char *, PyCompilerFlags *);
PyAPI_FUNC(int) PyRun_AnyFileFlags(FILE *, const char *, PyCompilerFlags *);
PyAPI_FUNC(int) PyRun_AnyFileExFlags(FILE *, const char *, int, PyCompilerFlags *);
PyAPI_FUNC(int) PyRun_SimpleFileExFlags(FILE *, const char *, int, PyCompilerFlags *);
@@ -62,18 +64,22 @@
PyAPI_FUNC(struct _node *) PyParser_SimpleParseFileFlags(FILE *, const char *,
int, int);
+#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject *) PyRun_StringFlags(const char *, int, PyObject *,
PyObject *, PyCompilerFlags *);
-#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject *) PyRun_FileExFlags(FILE *, const char *, int,
PyObject *, PyObject *, int,
PyCompilerFlags *);
#endif
+#ifdef Py_LIMITED_API
+PyAPI_FUNC(PyObject *) Py_CompileStringFlags(const char *, const char *, int);
+#else
#define Py_CompileString(str, p, s) Py_CompileStringFlags(str, p, s, NULL)
PyAPI_FUNC(PyObject *) Py_CompileStringFlags(const char *, const char *, int,
PyCompilerFlags *);
+#endif
PyAPI_FUNC(struct symtable *) Py_SymtableString(const char *, const char *, int);
PyAPI_FUNC(void) PyErr_Print(void);
Modified: python/branches/pep-0384/Include/setobject.h
==============================================================================
--- python/branches/pep-0384/Include/setobject.h (original)
+++ python/branches/pep-0384/Include/setobject.h Sat Oct 30 13:10:45 2010
@@ -18,7 +18,7 @@
hold a search finger. The hash field of Unused or Dummy slots has
no meaning otherwise.
*/
-
+#ifndef Py_LIMITED_API
#define PySet_MINSIZE 8
typedef struct {
@@ -59,6 +59,7 @@
long hash; /* only used by frozenset objects */
PyObject *weakreflist; /* List of weak references */
};
+#endif /* Py_LIMITED_API */
PyAPI_DATA(PyTypeObject) PySet_Type;
PyAPI_DATA(PyTypeObject) PyFrozenSet_Type;
@@ -88,7 +89,9 @@
PyAPI_FUNC(PyObject *) PySet_New(PyObject *);
PyAPI_FUNC(PyObject *) PyFrozenSet_New(PyObject *);
PyAPI_FUNC(Py_ssize_t) PySet_Size(PyObject *anyset);
+#ifndef Py_LIMITED_API
#define PySet_GET_SIZE(so) (((PySetObject *)(so))->used)
+#endif
PyAPI_FUNC(int) PySet_Clear(PyObject *set);
PyAPI_FUNC(int) PySet_Contains(PyObject *anyset, PyObject *key);
PyAPI_FUNC(int) PySet_Discard(PyObject *set, PyObject *key);
Modified: python/branches/pep-0384/Include/sliceobject.h
==============================================================================
--- python/branches/pep-0384/Include/sliceobject.h (original)
+++ python/branches/pep-0384/Include/sliceobject.h Sat Oct 30 13:10:45 2010
@@ -18,11 +18,12 @@
names are from range). After much talk with Guido, it was decided to
let these be any arbitrary python type. Py_None stands for omitted values.
*/
-
+#ifndef Py_LIMITED_API
typedef struct {
PyObject_HEAD
PyObject *start, *stop, *step; /* not NULL */
} PySliceObject;
+#endif
PyAPI_DATA(PyTypeObject) PySlice_Type;
PyAPI_DATA(PyTypeObject) PyEllipsis_Type;
@@ -32,9 +33,9 @@
PyAPI_FUNC(PyObject *) PySlice_New(PyObject* start, PyObject* stop,
PyObject* step);
PyAPI_FUNC(PyObject *) _PySlice_FromIndices(Py_ssize_t start, Py_ssize_t stop);
-PyAPI_FUNC(int) PySlice_GetIndices(PySliceObject *r, Py_ssize_t length,
+PyAPI_FUNC(int) PySlice_GetIndices(PyObject *r, Py_ssize_t length,
Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step);
-PyAPI_FUNC(int) PySlice_GetIndicesEx(PySliceObject *r, Py_ssize_t length,
+PyAPI_FUNC(int) PySlice_GetIndicesEx(PyObject *r, Py_ssize_t length,
Py_ssize_t *start, Py_ssize_t *stop,
Py_ssize_t *step, Py_ssize_t *slicelength);
Modified: python/branches/pep-0384/Include/traceback.h
==============================================================================
--- python/branches/pep-0384/Include/traceback.h (original)
+++ python/branches/pep-0384/Include/traceback.h Sat Oct 30 13:10:45 2010
@@ -8,7 +8,7 @@
struct _frame;
/* Traceback interface */
-
+#ifndef Py_LIMITED_API
typedef struct _traceback {
PyObject_HEAD
struct _traceback *tb_next;
@@ -16,6 +16,7 @@
int tb_lasti;
int tb_lineno;
} PyTracebackObject;
+#endif
PyAPI_FUNC(int) PyTraceBack_Here(struct _frame *);
PyAPI_FUNC(int) PyTraceBack_Print(PyObject *, PyObject *);
Modified: python/branches/pep-0384/Include/tupleobject.h
==============================================================================
--- python/branches/pep-0384/Include/tupleobject.h (original)
+++ python/branches/pep-0384/Include/tupleobject.h Sat Oct 30 13:10:45 2010
@@ -21,6 +21,7 @@
returned item's reference count.
*/
+#ifndef Py_LIMITED_API
typedef struct {
PyObject_VAR_HEAD
PyObject *ob_item[1];
@@ -30,6 +31,7 @@
* the tuple is not yet visible outside the function that builds it.
*/
} PyTupleObject;
+#endif
PyAPI_DATA(PyTypeObject) PyTuple_Type;
PyAPI_DATA(PyTypeObject) PyTupleIter_Type;
@@ -48,11 +50,13 @@
PyAPI_FUNC(void) _PyTuple_MaybeUntrack(PyObject *);
/* Macro, trading safety for speed */
+#ifndef Py_LIMITED_API
#define PyTuple_GET_ITEM(op, i) (((PyTupleObject *)(op))->ob_item[i])
#define PyTuple_GET_SIZE(op) Py_SIZE(op)
/* Macro, *only* to be used to fill in brand new tuples */
#define PyTuple_SET_ITEM(op, i, v) (((PyTupleObject *)(op))->ob_item[i] = v)
+#endif
PyAPI_FUNC(int) PyTuple_ClearFreeList(void);
Modified: python/branches/pep-0384/Include/weakrefobject.h
==============================================================================
--- python/branches/pep-0384/Include/weakrefobject.h (original)
+++ python/branches/pep-0384/Include/weakrefobject.h Sat Oct 30 13:10:45 2010
@@ -12,6 +12,7 @@
/* PyWeakReference is the base struct for the Python ReferenceType, ProxyType,
* and CallableProxyType.
*/
+#ifndef Py_LIMITED_API
struct _PyWeakReference {
PyObject_HEAD
@@ -37,6 +38,7 @@
PyWeakReference *wr_prev;
PyWeakReference *wr_next;
};
+#endif
PyAPI_DATA(PyTypeObject) _PyWeakref_RefType;
PyAPI_DATA(PyTypeObject) _PyWeakref_ProxyType;
@@ -62,9 +64,11 @@
PyObject *callback);
PyAPI_FUNC(PyObject *) PyWeakref_GetObject(PyObject *ref);
+#ifndef Py_LIMITED_API
PyAPI_FUNC(Py_ssize_t) _PyWeakref_GetWeakrefCount(PyWeakReference *head);
PyAPI_FUNC(void) _PyWeakref_ClearRef(PyWeakReference *self);
+#endif
#define PyWeakref_GET_OBJECT(ref) (((PyWeakReference *)(ref))->wr_object)
Modified: python/branches/pep-0384/Modules/_ctypes/_ctypes.c
==============================================================================
--- python/branches/pep-0384/Modules/_ctypes/_ctypes.c (original)
+++ python/branches/pep-0384/Modules/_ctypes/_ctypes.c Sat Oct 30 13:10:45 2010
@@ -1155,7 +1155,7 @@
result = -1;
goto done;
}
- result = PyUnicode_AsWideChar((PyUnicodeObject *)value,
+ result = PyUnicode_AsWideChar(value,
(wchar_t *)self->b_ptr,
self->b_size/sizeof(wchar_t));
if (result >= 0 && (size_t)result < self->b_size/sizeof(wchar_t))
@@ -4174,7 +4174,7 @@
PyObject *np;
Py_ssize_t start, stop, step, slicelen, cur, i;
- if (PySlice_GetIndicesEx((PySliceObject *)item,
+ if (PySlice_GetIndicesEx(item,
self->b_length, &start, &stop,
&step, &slicelen) < 0) {
return NULL;
@@ -4308,7 +4308,7 @@
else if (PySlice_Check(item)) {
Py_ssize_t start, stop, step, slicelen, otherlen, i, cur;
- if (PySlice_GetIndicesEx((PySliceObject *)item,
+ if (PySlice_GetIndicesEx(item,
self->b_length, &start, &stop,
&step, &slicelen) < 0) {
return -1;
Modified: python/branches/pep-0384/Modules/_ctypes/callproc.c
==============================================================================
--- python/branches/pep-0384/Modules/_ctypes/callproc.c (original)
+++ python/branches/pep-0384/Modules/_ctypes/callproc.c Sat Oct 30 13:10:45 2010
@@ -680,7 +680,7 @@
PyMem_Free(pa->value.p);
return -1;
}
- if (-1 == PyUnicode_AsWideChar((PyUnicodeObject *)obj,
+ if (-1 == PyUnicode_AsWideChar(obj,
pa->value.p, PyUnicode_GET_SIZE(obj)))
return -1;
return 0;
Modified: python/branches/pep-0384/Modules/_ctypes/cfield.c
==============================================================================
--- python/branches/pep-0384/Modules/_ctypes/cfield.c (original)
+++ python/branches/pep-0384/Modules/_ctypes/cfield.c Sat Oct 30 13:10:45 2010
@@ -1289,7 +1289,7 @@
} else if (size < length-1)
/* copy terminating NUL character if there is space */
size += 1;
- PyUnicode_AsWideChar((PyUnicodeObject *)value, (wchar_t *)ptr, size);
+ PyUnicode_AsWideChar(value, (wchar_t *)ptr, size);
return value;
}
@@ -1449,7 +1449,7 @@
return NULL;
}
*(wchar_t **)ptr = (wchar_t *)buffer;
- if (-1 == PyUnicode_AsWideChar((PyUnicodeObject *)value,
+ if (-1 == PyUnicode_AsWideChar(value,
buffer, PyUnicode_GET_SIZE(value))) {
Py_DECREF(value);
Py_DECREF(keep);
Modified: python/branches/pep-0384/Modules/_elementtree.c
==============================================================================
--- python/branches/pep-0384/Modules/_elementtree.c (original)
+++ python/branches/pep-0384/Modules/_elementtree.c Sat Oct 30 13:10:45 2010
@@ -1272,7 +1272,7 @@
if (!self->extra)
return PyList_New(0);
- if (PySlice_GetIndicesEx((PySliceObject *)item,
+ if (PySlice_GetIndicesEx(item,
self->extra->length,
&start, &stop, &step, &slicelen) < 0) {
return NULL;
@@ -1331,7 +1331,7 @@
if (!self->extra)
element_new_extra(self, NULL);
- if (PySlice_GetIndicesEx((PySliceObject *)item,
+ if (PySlice_GetIndicesEx(item,
self->extra->length,
&start, &stop, &step, &slicelen) < 0) {
return -1;
Modified: python/branches/pep-0384/Modules/_json.c
==============================================================================
--- python/branches/pep-0384/Modules/_json.c (original)
+++ python/branches/pep-0384/Modules/_json.c Sat Oct 30 13:10:45 2010
@@ -1407,7 +1407,7 @@
Py_DECREF(mapping);
goto bail;
}
- items = PyEval_EvalCode((PyCodeObject *)code, PyEval_GetGlobals(), mapping);
+ items = PyEval_EvalCode(code, PyEval_GetGlobals(), mapping);
Py_DECREF(mapping);
} else {
items = PyMapping_Items(dct);
Modified: python/branches/pep-0384/Modules/_localemodule.c
==============================================================================
--- python/branches/pep-0384/Modules/_localemodule.c (original)
+++ python/branches/pep-0384/Modules/_localemodule.c Sat Oct 30 13:10:45 2010
@@ -253,7 +253,7 @@
PyErr_NoMemory();
goto done;
}
- if (PyUnicode_AsWideChar((PyUnicodeObject*)os1, ws1, len1) == -1)
+ if (PyUnicode_AsWideChar(os1, ws1, len1) == -1)
goto done;
ws1[len1 - 1] = 0;
len2 = PyUnicode_GET_SIZE(os2) + 1;
@@ -262,7 +262,7 @@
PyErr_NoMemory();
goto done;
}
- if (PyUnicode_AsWideChar((PyUnicodeObject*)os2, ws2, len2) == -1)
+ if (PyUnicode_AsWideChar(os2, ws2, len2) == -1)
goto done;
ws2[len2 - 1] = 0;
/* Collate the strings. */
Modified: python/branches/pep-0384/Modules/arraymodule.c
==============================================================================
--- python/branches/pep-0384/Modules/arraymodule.c (original)
+++ python/branches/pep-0384/Modules/arraymodule.c Sat Oct 30 13:10:45 2010
@@ -2050,7 +2050,7 @@
arrayobject* ar;
int itemsize = self->ob_descr->itemsize;
- if (PySlice_GetIndicesEx((PySliceObject*)item, Py_SIZE(self),
+ if (PySlice_GetIndicesEx(item, Py_SIZE(self),
&start, &stop, &step, &slicelength) < 0) {
return NULL;
}
@@ -2121,7 +2121,7 @@
return (*self->ob_descr->setitem)(self, i, value);
}
else if (PySlice_Check(item)) {
- if (PySlice_GetIndicesEx((PySliceObject *)item,
+ if (PySlice_GetIndicesEx(item,
Py_SIZE(self), &start, &stop,
&step, &slicelength) < 0) {
return -1;
Modified: python/branches/pep-0384/Modules/mmapmodule.c
==============================================================================
--- python/branches/pep-0384/Modules/mmapmodule.c (original)
+++ python/branches/pep-0384/Modules/mmapmodule.c Sat Oct 30 13:10:45 2010
@@ -759,7 +759,7 @@
else if (PySlice_Check(item)) {
Py_ssize_t start, stop, step, slicelen;
- if (PySlice_GetIndicesEx((PySliceObject *)item, self->size,
+ if (PySlice_GetIndicesEx(item, self->size,
&start, &stop, &step, &slicelen) < 0) {
return NULL;
}
@@ -885,7 +885,7 @@
Py_ssize_t start, stop, step, slicelen;
Py_buffer vbuf;
- if (PySlice_GetIndicesEx((PySliceObject *)item,
+ if (PySlice_GetIndicesEx(item,
self->size, &start, &stop,
&step, &slicelen) < 0) {
return -1;
Modified: python/branches/pep-0384/Modules/timemodule.c
==============================================================================
--- python/branches/pep-0384/Modules/timemodule.c (original)
+++ python/branches/pep-0384/Modules/timemodule.c Sat Oct 30 13:10:45 2010
@@ -488,7 +488,7 @@
return NULL;
/* This assumes that PyUnicode_AsWideChar doesn't do any UTF-16
expansion. */
- if (PyUnicode_AsWideChar((PyUnicodeObject*)format,
+ if (PyUnicode_AsWideChar(format,
(wchar_t*)PyBytes_AS_STRING(tmpfmt),
PyUnicode_GetSize(format)+1) == (size_t)-1)
/* This shouldn't fail. */
Modified: python/branches/pep-0384/Modules/xxlimited.c
==============================================================================
--- python/branches/pep-0384/Modules/xxlimited.c (original)
+++ python/branches/pep-0384/Modules/xxlimited.c Sat Oct 30 13:10:45 2010
@@ -97,6 +97,7 @@
static PyType_Slot Xxo_Type_slots[] = {
{Py_tp_dealloc, Xxo_dealloc},
{Py_tp_getattro, Xxo_getattro},
+ {Py_tp_setattr, Xxo_setattr},
{Py_tp_methods, Xxo_methods},
{0, 0},
};
Modified: python/branches/pep-0384/Objects/bytearrayobject.c
==============================================================================
--- python/branches/pep-0384/Objects/bytearrayobject.c (original)
+++ python/branches/pep-0384/Objects/bytearrayobject.c Sat Oct 30 13:10:45 2010
@@ -389,7 +389,7 @@
}
else if (PySlice_Check(index)) {
Py_ssize_t start, stop, step, slicelength, cur, i;
- if (PySlice_GetIndicesEx((PySliceObject *)index,
+ if (PySlice_GetIndicesEx(index,
PyByteArray_GET_SIZE(self),
&start, &stop, &step, &slicelength) < 0) {
return NULL;
@@ -573,7 +573,7 @@
}
}
else if (PySlice_Check(index)) {
- if (PySlice_GetIndicesEx((PySliceObject *)index,
+ if (PySlice_GetIndicesEx(index,
PyByteArray_GET_SIZE(self),
&start, &stop, &step, &slicelen) < 0) {
return -1;
Modified: python/branches/pep-0384/Objects/bytesobject.c
==============================================================================
--- python/branches/pep-0384/Objects/bytesobject.c (original)
+++ python/branches/pep-0384/Objects/bytesobject.c Sat Oct 30 13:10:45 2010
@@ -911,7 +911,7 @@
char* result_buf;
PyObject* result;
- if (PySlice_GetIndicesEx((PySliceObject*)item,
+ if (PySlice_GetIndicesEx(item,
PyBytes_GET_SIZE(self),
&start, &stop, &step, &slicelength) < 0) {
return NULL;
Modified: python/branches/pep-0384/Objects/listobject.c
==============================================================================
--- python/branches/pep-0384/Objects/listobject.c (original)
+++ python/branches/pep-0384/Objects/listobject.c Sat Oct 30 13:10:45 2010
@@ -2378,7 +2378,7 @@
PyObject* it;
PyObject **src, **dest;
- if (PySlice_GetIndicesEx((PySliceObject*)item, Py_SIZE(self),
+ if (PySlice_GetIndicesEx(item, Py_SIZE(self),
&start, &stop, &step, &slicelength) < 0) {
return NULL;
}
@@ -2427,7 +2427,7 @@
else if (PySlice_Check(item)) {
Py_ssize_t start, stop, step, slicelength;
- if (PySlice_GetIndicesEx((PySliceObject*)item, Py_SIZE(self),
+ if (PySlice_GetIndicesEx(item, Py_SIZE(self),
&start, &stop, &step, &slicelength) < 0) {
return -1;
}
Modified: python/branches/pep-0384/Objects/memoryobject.c
==============================================================================
--- python/branches/pep-0384/Objects/memoryobject.c (original)
+++ python/branches/pep-0384/Objects/memoryobject.c Sat Oct 30 13:10:45 2010
@@ -582,7 +582,7 @@
else if (PySlice_Check(key)) {
Py_ssize_t start, stop, step, slicelength;
- if (PySlice_GetIndicesEx((PySliceObject*)key, get_shape0(view),
+ if (PySlice_GetIndicesEx(key, get_shape0(view),
&start, &stop, &step, &slicelength) < 0) {
return NULL;
}
@@ -655,7 +655,7 @@
else if (PySlice_Check(key)) {
Py_ssize_t stop, step;
- if (PySlice_GetIndicesEx((PySliceObject*)key, get_shape0(view),
+ if (PySlice_GetIndicesEx(key, get_shape0(view),
&start, &stop, &step, &len) < 0) {
return -1;
}
Modified: python/branches/pep-0384/Objects/sliceobject.c
==============================================================================
--- python/branches/pep-0384/Objects/sliceobject.c (original)
+++ python/branches/pep-0384/Objects/sliceobject.c Sat Oct 30 13:10:45 2010
@@ -99,9 +99,10 @@
}
int
-PySlice_GetIndices(PySliceObject *r, Py_ssize_t length,
+PySlice_GetIndices(PyObject *_r, Py_ssize_t length,
Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step)
{
+ PySliceObject *r = (PySliceObject*)_r;
/* XXX support long ints */
if (r->step == Py_None) {
*step = 1;
@@ -130,10 +131,11 @@
}
int
-PySlice_GetIndicesEx(PySliceObject *r, Py_ssize_t length,
+PySlice_GetIndicesEx(PyObject *_r, Py_ssize_t length,
Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step,
Py_ssize_t *slicelength)
{
+ PySliceObject *r = (PySliceObject*)_r;
/* this is harder to get right than you might think */
Py_ssize_t defstart, defstop;
@@ -256,7 +258,7 @@
return NULL;
}
- if (PySlice_GetIndicesEx(self, ilen, &start, &stop,
+ if (PySlice_GetIndicesEx((PyObject*)self, ilen, &start, &stop,
&step, &slicelength) < 0) {
return NULL;
}
Modified: python/branches/pep-0384/Objects/tupleobject.c
==============================================================================
--- python/branches/pep-0384/Objects/tupleobject.c (original)
+++ python/branches/pep-0384/Objects/tupleobject.c Sat Oct 30 13:10:45 2010
@@ -689,7 +689,7 @@
PyObject* it;
PyObject **src, **dest;
- if (PySlice_GetIndicesEx((PySliceObject*)item,
+ if (PySlice_GetIndicesEx(item,
PyTuple_GET_SIZE(self),
&start, &stop, &step, &slicelength) < 0) {
return NULL;
Modified: python/branches/pep-0384/Python/pythonrun.c
==============================================================================
--- python/branches/pep-0384/Python/pythonrun.c (original)
+++ python/branches/pep-0384/Python/pythonrun.c Sat Oct 30 13:10:45 2010
@@ -1827,6 +1827,14 @@
return (PyObject *)co;
}
+/* For use in Py_LIMITED_API */
+#undef Py_CompileString
+PyObject *
+PyCompileString(const char *str, const char *filename, int start)
+{
+ return Py_CompileStringFlags(str, filename, start, NULL);
+}
+
struct symtable *
Py_SymtableString(const char *str, const char *filename, int start)
{
More information about the Python-checkins
mailing list