Merge branches/pep-0384.
diff --git a/Doc/c-api/veryhigh.rst b/Doc/c-api/veryhigh.rst
index 7cc1dc1..5b93325 100644
--- a/Doc/c-api/veryhigh.rst
+++ b/Doc/c-api/veryhigh.rst
@@ -239,14 +239,14 @@
be parsed or compiled.
-.. c:function:: PyObject* PyEval_EvalCode(PyCodeObject *co, PyObject *globals, PyObject *locals)
+.. c:function:: PyObject* PyEval_EvalCode(PyObject *co, PyObject *globals, PyObject *locals)
This is a simplified interface to :c:func:`PyEval_EvalCodeEx`, with just
the code object, and the dictionaries of global and local variables.
The other arguments are set to *NULL*.
-.. c:function:: PyObject* PyEval_EvalCodeEx(PyCodeObject *co, PyObject *globals, PyObject *locals, PyObject **args, int argcount, PyObject **kws, int kwcount, PyObject **defs, int defcount, PyObject *closure)
+.. c:function:: PyObject* PyEval_EvalCodeEx(PyObject *co, PyObject *globals, PyObject *locals, PyObject **args, int argcount, PyObject **kws, int kwcount, PyObject **defs, int defcount, PyObject *closure)
Evaluate a precompiled code object, given a particular environment for its
evaluation. This environment consists of dictionaries of global and local
diff --git a/Doc/faq/extending.rst b/Doc/faq/extending.rst
index 59e5422..678f1bd 100644
--- a/Doc/faq/extending.rst
+++ b/Doc/faq/extending.rst
@@ -379,7 +379,7 @@
if (ps1 == prompt || /* ">>> " or */
'\n' == code[i + j - 1]) /* "... " and double '\n' */
{ /* so execute it */
- dum = PyEval_EvalCode ((PyCodeObject *)src, glb, loc);
+ dum = PyEval_EvalCode (src, glb, loc);
Py_XDECREF (dum);
Py_XDECREF (src);
free (code);
diff --git a/Doc/whatsnew/3.2.rst b/Doc/whatsnew/3.2.rst
index db88e4a..8d0f0f5 100644
--- a/Doc/whatsnew/3.2.rst
+++ b/Doc/whatsnew/3.2.rst
@@ -49,6 +49,24 @@
This article explains the new features in Python 3.2, compared to 3.1.
+PEP 382: Defining a Stable ABI
+==============================
+
+In the past, extension modules built for one Python version were often
+not usable with other Python versions. Particularly on Windows, every
+feature release of Python required rebuilding all extension modules that
+one wanted to use. This requirement was the result of the free access to
+Python interpreter internals that extension modules could use.
+
+With Python 3.2, an alternative approach becomes available: extension
+modules with restrict themselves to a limited API (by defining
+Py_LIMITED_API) cannot use many of the internals, but are constrained
+to a set of API functions that are promised to be stable for several
+releases. As a consequence, extension modules built for 3.2 in that
+mode will also work with 3.3, 3.4, and so on. Extension modules that
+make use of details of memory structures can still be built, but will
+need to be recompiled for every feature release.
+
PEP 391: Dictionary Based Configuration for Logging
====================================================
diff --git a/Include/Python.h b/Include/Python.h
index a49753f..db33a76 100644
--- a/Include/Python.h
+++ b/Include/Python.h
@@ -66,6 +66,7 @@
#include "object.h"
#include "objimpl.h"
+#include "typeslots.h"
#include "pydebug.h"
@@ -100,6 +101,7 @@
#include "weakrefobject.h"
#include "structseq.h"
+
#include "codecs.h"
#include "pyerrors.h"
@@ -130,7 +132,9 @@
#endif
/* _Py_Mangle is defined in compile.c */
+#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject*) _Py_Mangle(PyObject *p, PyObject *name);
+#endif
#ifdef __cplusplus
}
diff --git a/Include/abstract.h b/Include/abstract.h
index 2399079..53c9dc7 100644
--- a/Include/abstract.h
+++ b/Include/abstract.h
@@ -387,7 +387,9 @@
PyAPI_FUNC(Py_ssize_t) PyObject_Length(PyObject *o);
#define PyObject_Length PyObject_Size
+#ifndef Py_LIMITED_API
PyAPI_FUNC(Py_ssize_t) _PyObject_LengthHint(PyObject *o, Py_ssize_t);
+#endif
/*
Guess the size of object o using len(o) or o.__length_hint__().
@@ -765,9 +767,11 @@
that can accept a char* naming integral's type.
*/
+#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject *) _PyNumber_ConvertIntegralToInt(
PyObject *integral,
const char* error_format);
+#endif
/*
Returns the object converted to Py_ssize_t by going through
@@ -1057,11 +1061,13 @@
Use __contains__ if possible, else _PySequence_IterSearch().
*/
+#ifndef Py_LIMITED_API
#define PY_ITERSEARCH_COUNT 1
#define PY_ITERSEARCH_INDEX 2
#define PY_ITERSEARCH_CONTAINS 3
PyAPI_FUNC(Py_ssize_t) _PySequence_IterSearch(PyObject *seq,
PyObject *obj, int operation);
+#endif
/*
Iterate over seq. Result depends on the operation:
PY_ITERSEARCH_COUNT: return # of times obj appears in seq; -1 if
@@ -1228,6 +1234,7 @@
/* issubclass(object, typeorclass) */
+#ifndef Py_LIMITED_API
PyAPI_FUNC(int) _PyObject_RealIsInstance(PyObject *inst, PyObject *cls);
PyAPI_FUNC(int) _PyObject_RealIsSubclass(PyObject *derived, PyObject *cls);
@@ -1235,6 +1242,7 @@
PyAPI_FUNC(char *const *) _PySequence_BytesToCharpArray(PyObject* self);
PyAPI_FUNC(void) _Py_FreeCharPArray(char *const array[]);
+#endif
/* For internal use by buffer API functions */
PyAPI_FUNC(void) _Py_add_one_to_index_F(int nd, Py_ssize_t *index,
diff --git a/Include/bytearrayobject.h b/Include/bytearrayobject.h
index e1281a6..eccd44c 100644
--- a/Include/bytearrayobject.h
+++ b/Include/bytearrayobject.h
@@ -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;
@@ -44,12 +46,14 @@
PyAPI_FUNC(int) PyByteArray_Resize(PyObject *, Py_ssize_t);
/* Macros, trading safety for speed */
+#ifndef Py_LIMITED_API
#define PyByteArray_AS_STRING(self) \
(assert(PyByteArray_Check(self)), \
Py_SIZE(self) ? ((PyByteArrayObject *)(self))->ob_bytes : _PyByteArray_empty_string)
#define PyByteArray_GET_SIZE(self) (assert(PyByteArray_Check(self)),Py_SIZE(self))
PyAPI_DATA(char) _PyByteArray_empty_string[];
+#endif
#ifdef __cplusplus
}
diff --git a/Include/bytes_methods.h b/Include/bytes_methods.h
index d0a6242..1498b8f 100644
--- a/Include/bytes_methods.h
+++ b/Include/bytes_methods.h
@@ -1,3 +1,4 @@
+#ifndef Py_LIMITED_API
#ifndef Py_BYTES_CTYPE_H
#define Py_BYTES_CTYPE_H
@@ -42,3 +43,4 @@
#define PyDoc_STRVAR_shared(name,str) const char name[] = PyDoc_STR(str)
#endif /* !Py_BYTES_CTYPE_H */
+#endif /* !Py_LIMITED_API */
diff --git a/Include/bytesobject.h b/Include/bytesobject.h
index 3c69d25..e1af89f 100644
--- a/Include/bytesobject.h
+++ b/Include/bytesobject.h
@@ -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
Py_hash_t 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;
@@ -58,21 +60,27 @@
PyAPI_FUNC(PyObject *) PyBytes_Repr(PyObject *, int);
PyAPI_FUNC(void) PyBytes_Concat(PyObject **, PyObject *);
PyAPI_FUNC(void) PyBytes_ConcatAndDel(PyObject **, PyObject *);
+#ifndef Py_LIMITED_API
PyAPI_FUNC(int) _PyBytes_Resize(PyObject **, Py_ssize_t);
PyAPI_FUNC(PyObject *) _PyBytes_FormatLong(PyObject*, int, int,
int, char**, int*);
+#endif
PyAPI_FUNC(PyObject *) PyBytes_DecodeEscape(const char *, Py_ssize_t,
const char *, Py_ssize_t,
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. */
+#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject *) _PyBytes_Join(PyObject *sep, PyObject *x);
+#endif
/* Provides access to the internal data buffer and size of a string
object or the default encoded version of an Unicode object. Passing
@@ -90,7 +98,7 @@
/* Using the current locale, insert the thousands grouping
into the string pointed to by buffer. For the argument descriptions,
see Objects/stringlib/localeutil.h */
-
+#ifndef Py_LIMITED_API
PyAPI_FUNC(Py_ssize_t) _PyBytes_InsertThousandsGroupingLocale(char *buffer,
Py_ssize_t n_buffer,
char *digits,
@@ -107,6 +115,7 @@
Py_ssize_t min_width,
const char *grouping,
const char *thousands_sep);
+#endif
/* Flags used by string formatting */
#define F_LJUST (1<<0)
diff --git a/Include/cellobject.h b/Include/cellobject.h
index c927ee5..a0aa4d9 100644
--- a/Include/cellobject.h
+++ b/Include/cellobject.h
@@ -1,5 +1,5 @@
/* Cell object interface */
-
+#ifndef Py_LIMITED_API
#ifndef Py_CELLOBJECT_H
#define Py_CELLOBJECT_H
#ifdef __cplusplus
@@ -26,3 +26,4 @@
}
#endif
#endif /* !Py_TUPLEOBJECT_H */
+#endif /* Py_LIMITED_API */
diff --git a/Include/ceval.h b/Include/ceval.h
index 2acde13..6811367 100644
--- a/Include/ceval.h
+++ b/Include/ceval.h
@@ -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);
@@ -167,8 +171,10 @@
PyAPI_FUNC(void) PyEval_ReleaseThread(PyThreadState *tstate);
PyAPI_FUNC(void) PyEval_ReInitThreads(void);
+#ifndef Py_LIMITED_API
PyAPI_FUNC(void) _PyEval_SetSwitchInterval(unsigned long microseconds);
PyAPI_FUNC(unsigned long) _PyEval_GetSwitchInterval(void);
+#endif
#define Py_BEGIN_ALLOW_THREADS { \
PyThreadState *_save; \
@@ -187,8 +193,10 @@
#endif /* !WITH_THREAD */
+#ifndef Py_LIMITED_API
PyAPI_FUNC(int) _PyEval_SliceIndex(PyObject *, Py_ssize_t *);
PyAPI_FUNC(void) _PyEval_SignalAsyncExc(void);
+#endif
#ifdef __cplusplus
diff --git a/Include/classobject.h b/Include/classobject.h
index b7eebe5..eeeb3e9 100644
--- a/Include/classobject.h
+++ b/Include/classobject.h
@@ -2,6 +2,7 @@
/* Revealing some structures (not for general use) */
+#ifndef Py_LIMITED_API
#ifndef Py_CLASSOBJECT_H
#define Py_CLASSOBJECT_H
#ifdef __cplusplus
@@ -54,3 +55,4 @@
}
#endif
#endif /* !Py_CLASSOBJECT_H */
+#endif /* Py_LIMITED_API */
diff --git a/Include/code.h b/Include/code.h
index 11ecc95..e773b6a 100644
--- a/Include/code.h
+++ b/Include/code.h
@@ -1,5 +1,6 @@
/* Definitions for bytecode */
+#ifndef Py_LIMITED_API
#ifndef Py_CODE_H
#define Py_CODE_H
#ifdef __cplusplus
@@ -93,8 +94,10 @@
/* Update *bounds to describe the first and one-past-the-last instructions in the
same line as lasti. Return the number of that line.
*/
+#ifndef Py_LIMITED_API
PyAPI_FUNC(int) _PyCode_CheckLineNumber(PyCodeObject* co,
int lasti, PyAddrPair *bounds);
+#endif
PyAPI_FUNC(PyObject*) PyCode_Optimize(PyObject *code, PyObject* consts,
PyObject *names, PyObject *lineno_obj);
@@ -103,3 +106,4 @@
}
#endif
#endif /* !Py_CODE_H */
+#endif /* Py_LIMITED_API */
diff --git a/Include/codecs.h b/Include/codecs.h
index 4ea934e..dff09e7 100644
--- a/Include/codecs.h
+++ b/Include/codecs.h
@@ -45,9 +45,11 @@
*/
+#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject *) _PyCodec_Lookup(
const char *encoding
);
+#endif
/* Codec registry encoding check API.
diff --git a/Include/compile.h b/Include/compile.h
index 7c329b3..4a5ebe6 100644
--- a/Include/compile.h
+++ b/Include/compile.h
@@ -1,4 +1,4 @@
-
+#ifndef Py_LIMITED_API
#ifndef Py_COMPILE_H
#define Py_COMPILE_H
@@ -38,3 +38,4 @@
}
#endif
#endif /* !Py_COMPILE_H */
+#endif /* !Py_LIMITED_API */
diff --git a/Include/complexobject.h b/Include/complexobject.h
index 8290a6d..c379b08 100644
--- a/Include/complexobject.h
+++ b/Include/complexobject.h
@@ -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,29 +37,36 @@
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). */
+#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject *) _PyComplex_FormatAdvanced(PyObject *obj,
Py_UNICODE *format_spec,
Py_ssize_t format_spec_len);
+#endif
#ifdef __cplusplus
}
diff --git a/Include/datetime.h b/Include/datetime.h
index 2d71fce..db57a18 100644
--- a/Include/datetime.h
+++ b/Include/datetime.h
@@ -1,6 +1,6 @@
/* datetime.h
*/
-
+#ifndef Py_LIMITED_API
#ifndef DATETIME_H
#define DATETIME_H
#ifdef __cplusplus
@@ -234,3 +234,4 @@
}
#endif
#endif
+#endif /* !Py_LIMITED_API */
diff --git a/Include/descrobject.h b/Include/descrobject.h
index 4f0c693..f715fe1 100644
--- a/Include/descrobject.h
+++ b/Include/descrobject.h
@@ -16,6 +16,7 @@
void *closure;
} PyGetSetDef;
+#ifndef Py_LIMITED_API
typedef PyObject *(*wrapperfunc)(PyObject *self, PyObject *args,
void *wrapped);
@@ -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 *);
diff --git a/Include/dictobject.h b/Include/dictobject.h
index 024a688..b026785 100644
--- a/Include/dictobject.h
+++ b/Include/dictobject.h
@@ -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 {
@@ -84,6 +85,7 @@
PyDictEntry *(*ma_lookup)(PyDictObject *mp, PyObject *key, Py_hash_t hash);
PyDictEntry ma_smalltable[PyDict_MINSIZE];
};
+#endif /* Py_LIMITED_API */
PyAPI_DATA(PyTypeObject) PyDict_Type;
PyAPI_DATA(PyTypeObject) PyDictIterKey_Type;
@@ -112,18 +114,22 @@
PyAPI_FUNC(void) PyDict_Clear(PyObject *mp);
PyAPI_FUNC(int) PyDict_Next(
PyObject *mp, Py_ssize_t *pos, PyObject **key, PyObject **value);
+#ifndef Py_LIMITED_API
PyAPI_FUNC(int) _PyDict_Next(
PyObject *mp, Py_ssize_t *pos, PyObject **key, PyObject **value, Py_hash_t *hash);
+#endif
PyAPI_FUNC(PyObject *) PyDict_Keys(PyObject *mp);
PyAPI_FUNC(PyObject *) PyDict_Values(PyObject *mp);
PyAPI_FUNC(PyObject *) PyDict_Items(PyObject *mp);
PyAPI_FUNC(Py_ssize_t) PyDict_Size(PyObject *mp);
PyAPI_FUNC(PyObject *) PyDict_Copy(PyObject *mp);
PyAPI_FUNC(int) PyDict_Contains(PyObject *mp, PyObject *key);
+#ifndef Py_LIMITED_API
PyAPI_FUNC(int) _PyDict_Contains(PyObject *mp, PyObject *key, Py_hash_t hash);
PyAPI_FUNC(PyObject *) _PyDict_NewPresized(Py_ssize_t minused);
PyAPI_FUNC(void) _PyDict_MaybeUntrack(PyObject *mp);
PyAPI_FUNC(int) _PyDict_HasOnlyStringKeys(PyObject *mp);
+#endif
/* PyDict_Update(mp, other) is equivalent to PyDict_Merge(mp, other, 1). */
PyAPI_FUNC(int) PyDict_Update(PyObject *mp, PyObject *other);
diff --git a/Include/dtoa.h b/Include/dtoa.h
index 9b434b7..819bd0f 100644
--- a/Include/dtoa.h
+++ b/Include/dtoa.h
@@ -1,3 +1,4 @@
+#ifndef Py_LIMITED_API
#ifndef PY_NO_SHORT_FLOAT_REPR
#ifdef __cplusplus
extern "C" {
@@ -13,3 +14,4 @@
}
#endif
#endif
+#endif
diff --git a/Include/eval.h b/Include/eval.h
index 1d03c97..a1c6e81 100644
--- a/Include/eval.h
+++ b/Include/eval.h
@@ -7,9 +7,9 @@
extern "C" {
#endif
-PyAPI_FUNC(PyObject *) PyEval_EvalCode(PyCodeObject *, PyObject *, PyObject *);
+PyAPI_FUNC(PyObject *) PyEval_EvalCode(PyObject *, PyObject *, PyObject *);
-PyAPI_FUNC(PyObject *) PyEval_EvalCodeEx(PyCodeObject *co,
+PyAPI_FUNC(PyObject *) PyEval_EvalCodeEx(PyObject *co,
PyObject *globals,
PyObject *locals,
PyObject **args, int argc,
@@ -17,7 +17,9 @@
PyObject **defs, int defc,
PyObject *kwdefs, PyObject *closure);
+#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject *) _PyEval_CallTracing(PyObject *func, PyObject *args);
+#endif
#ifdef __cplusplus
}
diff --git a/Include/fileobject.h b/Include/fileobject.h
index 20545fa..c4a2a2b 100644
--- a/Include/fileobject.h
+++ b/Include/fileobject.h
@@ -14,7 +14,9 @@
PyAPI_FUNC(int) PyFile_WriteObject(PyObject *, PyObject *, int);
PyAPI_FUNC(int) PyFile_WriteString(const char *, PyObject *);
PyAPI_FUNC(int) PyObject_AsFileDescriptor(PyObject *);
+#ifndef Py_LIMITED_API
PyAPI_FUNC(char *) Py_UniversalNewlineFgets(char *, int, FILE*, PyObject *);
+#endif
/* The default encoding used by the platform file system APIs
If non-NULL, this is different than the default encoding for strings
@@ -26,6 +28,7 @@
The std printer acts as a preliminary sys.stderr until the new io
infrastructure is in place. */
+#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject *) PyFile_NewStdPrinter(int);
PyAPI_DATA(PyTypeObject) PyStdPrinter_Type;
@@ -39,6 +42,7 @@
#else
#define _PyVerify_fd(A) (1) /* dummy */
#endif
+#endif /* Py_LIMITED_API */
#ifdef __cplusplus
}
diff --git a/Include/floatobject.h b/Include/floatobject.h
index 364b913..90f0a45 100644
--- a/Include/floatobject.h
+++ b/Include/floatobject.h
@@ -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,8 +47,11 @@
/* 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
+#ifndef Py_LIMITED_API
/* _PyFloat_{Pack,Unpack}{4,8}
*
* The struct and pickle (at least) modules need an efficient platform-
@@ -110,6 +115,7 @@
PyAPI_FUNC(PyObject *) _PyFloat_FormatAdvanced(PyObject *obj,
Py_UNICODE *format_spec,
Py_ssize_t format_spec_len);
+#endif /* Py_LIMITED_API */
#ifdef __cplusplus
}
diff --git a/Include/frameobject.h b/Include/frameobject.h
index 9440973..1fb64bb 100644
--- a/Include/frameobject.h
+++ b/Include/frameobject.h
@@ -1,6 +1,7 @@
/* Frame object interface */
+#ifndef Py_LIMITED_API
#ifndef Py_FRAMEOBJECT_H
#define Py_FRAMEOBJECT_H
#ifdef __cplusplus
@@ -85,3 +86,4 @@
}
#endif
#endif /* !Py_FRAMEOBJECT_H */
+#endif /* Py_LIMITED_API */
diff --git a/Include/funcobject.h b/Include/funcobject.h
index 058c6bf..521d87b 100644
--- a/Include/funcobject.h
+++ b/Include/funcobject.h
@@ -1,6 +1,6 @@
/* Function object interface */
-
+#ifndef Py_LIMITED_API
#ifndef Py_FUNCOBJECT_H
#define Py_FUNCOBJECT_H
#ifdef __cplusplus
@@ -84,3 +84,4 @@
}
#endif
#endif /* !Py_FUNCOBJECT_H */
+#endif /* Py_LIMITED_API */
diff --git a/Include/genobject.h b/Include/genobject.h
index 135561b..d29fb1e 100644
--- a/Include/genobject.h
+++ b/Include/genobject.h
@@ -1,6 +1,7 @@
/* Generator object interface */
+#ifndef Py_LIMITED_API
#ifndef Py_GENOBJECT_H
#define Py_GENOBJECT_H
#ifdef __cplusplus
@@ -38,3 +39,4 @@
}
#endif
#endif /* !Py_GENOBJECT_H */
+#endif /* Py_LIMITED_API */
diff --git a/Include/import.h b/Include/import.h
index 3e81e78..2df94ff 100644
--- a/Include/import.h
+++ b/Include/import.h
@@ -30,6 +30,7 @@
PyAPI_FUNC(void) PyImport_Cleanup(void);
PyAPI_FUNC(int) PyImport_ImportFrozenModule(char *);
+#ifndef Py_LIMITED_API
#ifdef WITH_THREAD
PyAPI_FUNC(void) _PyImport_AcquireLock(void);
PyAPI_FUNC(int) _PyImport_ReleaseLock(void);
@@ -49,13 +50,15 @@
char *name;
PyObject* (*initfunc)(void);
};
+PyAPI_DATA(struct _inittab *) PyImport_Inittab;
+PyAPI_FUNC(int) PyImport_ExtendInittab(struct _inittab *newtab);
+#endif /* Py_LIMITED_API */
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;
@@ -66,6 +69,7 @@
collection of frozen modules: */
PyAPI_DATA(struct _frozen *) PyImport_FrozenModules;
+#endif
#ifdef __cplusplus
}
diff --git a/Include/listobject.h b/Include/listobject.h
index 755fbbe..949b1a3 100644
--- a/Include/listobject.h
+++ b/Include/listobject.h
@@ -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
}
diff --git a/Include/longintrepr.h b/Include/longintrepr.h
index 3d71a35..b94f7b2 100644
--- a/Include/longintrepr.h
+++ b/Include/longintrepr.h
@@ -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 */
diff --git a/Include/longobject.h b/Include/longobject.h
index 6adf262..c09565a 100644
--- a/Include/longobject.h
+++ b/Include/longobject.h
@@ -50,7 +50,9 @@
#endif /* SIZEOF_PID_T */
/* Used by Python/mystrtoul.c. */
+#ifndef Py_LIMITED_API
PyAPI_DATA(unsigned char) _PyLong_DigitValue[256];
+#endif
/* _PyLong_Frexp returns a double x and an exponent e such that the
true value is approximately equal to x * 2**e. e is >= 0. x is
@@ -58,7 +60,9 @@
zeroes); otherwise, 0.5 <= abs(x) < 1.0. On overflow, which is
possible if the number of bits doesn't fit into a Py_ssize_t, sets
OverflowError and returns -1.0 for x, 0 for e. */
+#ifndef Py_LIMITED_API
PyAPI_FUNC(double) _PyLong_Frexp(PyLongObject *a, Py_ssize_t *e);
+#endif
PyAPI_FUNC(double) PyLong_AsDouble(PyObject *);
PyAPI_FUNC(PyObject *) PyLong_FromVoidPtr(void *);
@@ -74,8 +78,11 @@
#endif /* HAVE_LONG_LONG */
PyAPI_FUNC(PyObject *) PyLong_FromString(char *, char **, int);
+#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject *) PyLong_FromUnicode(Py_UNICODE*, Py_ssize_t, int);
+#endif
+#ifndef Py_LIMITED_API
/* _PyLong_Sign. Return 0 if v is 0, -1 if v < 0, +1 if v > 0.
v must not be NULL, and must be a normalized long.
There are no error cases.
@@ -150,6 +157,7 @@
PyAPI_FUNC(PyObject *) _PyLong_FormatAdvanced(PyObject *obj,
Py_UNICODE *format_spec,
Py_ssize_t format_spec_len);
+#endif /* Py_LIMITED_API */
/* These aren't really part of the long object, but they're handy. The
functions are in Python/mystrtoul.c.
diff --git a/Include/marshal.h b/Include/marshal.h
index 411fdca..e96d062 100644
--- a/Include/marshal.h
+++ b/Include/marshal.h
@@ -13,10 +13,12 @@
PyAPI_FUNC(void) PyMarshal_WriteObjectToFile(PyObject *, FILE *, int);
PyAPI_FUNC(PyObject *) PyMarshal_WriteObjectToString(PyObject *, int);
+#ifndef Py_LIMITED_API
PyAPI_FUNC(long) PyMarshal_ReadLongFromFile(FILE *);
PyAPI_FUNC(int) PyMarshal_ReadShortFromFile(FILE *);
PyAPI_FUNC(PyObject *) PyMarshal_ReadObjectFromFile(FILE *);
PyAPI_FUNC(PyObject *) PyMarshal_ReadLastObjectFromFile(FILE *);
+#endif
PyAPI_FUNC(PyObject *) PyMarshal_ReadObjectFromString(char *, Py_ssize_t);
#ifdef __cplusplus
diff --git a/Include/memoryobject.h b/Include/memoryobject.h
index 5bbfb05..f763531 100644
--- a/Include/memoryobject.h
+++ b/Include/memoryobject.h
@@ -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,11 +63,12 @@
/* 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
Py_buffer view;
} PyMemoryViewObject;
-
+#endif
#ifdef __cplusplus
}
diff --git a/Include/methodobject.h b/Include/methodobject.h
index 81e84ce..7e67c0b 100644
--- a/Include/methodobject.h
+++ b/Include/methodobject.h
@@ -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);
diff --git a/Include/modsupport.h b/Include/modsupport.h
index 57886df..bf6478f 100644
--- a/Include/modsupport.h
+++ b/Include/modsupport.h
@@ -31,7 +31,9 @@
PyAPI_FUNC(int) PyArg_UnpackTuple(PyObject *, const char *, Py_ssize_t, Py_ssize_t, ...);
PyAPI_FUNC(PyObject *) Py_BuildValue(const char *, ...);
PyAPI_FUNC(PyObject *) _Py_BuildValue_SizeT(const char *, ...);
+#ifndef Py_LIMITED_API
PyAPI_FUNC(int) _PyArg_NoKeywords(const char *funcname, PyObject *kw);
+#endif
PyAPI_FUNC(int) PyArg_VaParse(PyObject *, const char *, va_list);
PyAPI_FUNC(int) PyArg_VaParseTupleAndKeywords(PyObject *, PyObject *,
@@ -92,6 +94,12 @@
9-Jan-1995 GvR Initial version (incompatible with older API)
*/
+/* The PYTHON_ABI_VERSION is introduced in PEP 384. For the lifetime of
+ Python 3, it will stay at the value of 3; changes to the limited API
+ must be performed in a strictly backwards-compatible manner. */
+#define PYTHON_ABI_VERSION 3
+#define PYTHON_ABI_STRING "3"
+
#ifdef Py_TRACE_REFS
/* When we are tracing reference counts, rename PyModule_Create2 so
modules compiled with incompatible settings will generate a
@@ -102,10 +110,17 @@
PyAPI_FUNC(PyObject *) PyModule_Create2(struct PyModuleDef*,
int apiver);
+#ifdef Py_LIMITED_API
+#define PyModule_Create(module) \
+ PyModule_Create2(module, PYTHON_ABI_VERSION)
+#else
#define PyModule_Create(module) \
PyModule_Create2(module, PYTHON_API_VERSION)
+#endif
+#ifndef Py_LIMITED_API
PyAPI_DATA(char *) _Py_PackageContext;
+#endif
#ifdef __cplusplus
}
diff --git a/Include/moduleobject.h b/Include/moduleobject.h
index 34fa810..338cf4b 100644
--- a/Include/moduleobject.h
+++ b/Include/moduleobject.h
@@ -17,7 +17,9 @@
PyAPI_FUNC(const char *) PyModule_GetName(PyObject *);
PyAPI_FUNC(const char *) PyModule_GetFilename(PyObject *);
PyAPI_FUNC(PyObject *) PyModule_GetFilenameObject(PyObject *);
+#ifndef Py_LIMITED_API
PyAPI_FUNC(void) _PyModule_Clear(PyObject *);
+#endif
PyAPI_FUNC(struct PyModuleDef*) PyModule_GetDef(PyObject*);
PyAPI_FUNC(void*) PyModule_GetState(PyObject*);
diff --git a/Include/object.h b/Include/object.h
index bc528fd..78bb13b 100644
--- a/Include/object.h
+++ b/Include/object.h
@@ -61,6 +61,10 @@
#define Py_REF_DEBUG
#endif
+#if defined(Py_LIMITED_API) && defined(Py_REF_DEBUG)
+#error Py_LIMITED_API is incompatible with Py_DEBUG, Py_TRACE_REFS, and Py_REF_DEBUG
+#endif
+
#ifdef Py_TRACE_REFS
/* Define pointers to support a doubly-linked list of all live heap objects. */
#define _PyObject_HEAD_EXTRA \
@@ -196,6 +200,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
@@ -265,10 +270,17 @@
getbufferproc bf_getbuffer;
releasebufferproc bf_releasebuffer;
} PyBufferProcs;
+#endif /* Py_LIMITED_API */
typedef void (*freefunc)(void *);
typedef void (*destructor)(PyObject *);
+#ifndef Py_LIMITED_API
+/* We can't provide a full compile-time check that limited-API
+ users won't implement tp_print. However, not defining printfunc
+ and making tp_print of a different function pointer type
+ should at least cause a warning in most cases. */
typedef int (*printfunc)(PyObject *, FILE *, int);
+#endif
typedef PyObject *(*getattrfunc)(PyObject *, char *);
typedef PyObject *(*getattrofunc)(PyObject *, PyObject *);
typedef int (*setattrfunc)(PyObject *, char *, PyObject *);
@@ -284,6 +296,9 @@
typedef PyObject *(*newfunc)(struct _typeobject *, PyObject *, PyObject *);
typedef PyObject *(*allocfunc)(struct _typeobject *, Py_ssize_t);
+#ifdef Py_LIMITED_API
+typedef struct _typeobject PyTypeObject; /* opaque */
+#else
typedef struct _typeobject {
PyObject_VAR_HEAD
const char *tp_name; /* For printing, in format "<module>.<name>" */
@@ -371,8 +386,25 @@
struct _typeobject *tp_next;
#endif
} PyTypeObject;
+#endif
+typedef struct{
+ int slot; /* slot id, see below */
+ void *pfunc; /* function pointer */
+} PyType_Slot;
+typedef struct{
+ const char* name;
+ const char* doc;
+ int basicsize;
+ int itemsize;
+ int flags;
+ PyType_Slot *slots; /* terminated by slot==0. */
+} PyType_Spec;
+
+PyAPI_FUNC(PyObject*) PyType_FromSpec(PyType_Spec*);
+
+#ifndef Py_LIMITED_API
/* The *real* layout of a type object when allocated on the heap */
typedef struct _heaptypeobject {
/* Note: there's a dependency on the order of these members
@@ -393,7 +425,7 @@
/* access macro to the members which are floating "behind" the object */
#define PyHeapType_GET_MEMBERS(etype) \
((PyMemberDef *)(((char *)etype) + Py_TYPE(etype)->tp_basicsize))
-
+#endif
/* Generic type check */
PyAPI_FUNC(int) PyType_IsSubtype(PyTypeObject *, PyTypeObject *);
@@ -412,15 +444,19 @@
PyAPI_FUNC(PyObject *) PyType_GenericAlloc(PyTypeObject *, Py_ssize_t);
PyAPI_FUNC(PyObject *) PyType_GenericNew(PyTypeObject *,
PyObject *, PyObject *);
+#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject *) _PyType_Lookup(PyTypeObject *, PyObject *);
PyAPI_FUNC(PyObject *) _PyObject_LookupSpecial(PyObject *, char *, PyObject **);
+#endif
PyAPI_FUNC(unsigned int) PyType_ClearCache(void);
PyAPI_FUNC(void) PyType_Modified(PyTypeObject *);
/* Generic operations on objects */
+#ifndef Py_LIMITED_API
PyAPI_FUNC(int) PyObject_Print(PyObject *, FILE *, int);
PyAPI_FUNC(void) _Py_BreakPoint(void);
PyAPI_FUNC(void) _PyObject_Dump(PyObject *);
+#endif
PyAPI_FUNC(PyObject *) PyObject_Repr(PyObject *);
PyAPI_FUNC(PyObject *) PyObject_Str(PyObject *);
PyAPI_FUNC(PyObject *) PyObject_ASCII(PyObject *);
@@ -433,9 +469,13 @@
PyAPI_FUNC(PyObject *) PyObject_GetAttr(PyObject *, PyObject *);
PyAPI_FUNC(int) PyObject_SetAttr(PyObject *, PyObject *, PyObject *);
PyAPI_FUNC(int) PyObject_HasAttr(PyObject *, PyObject *);
+#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject **) _PyObject_GetDictPtr(PyObject *);
+#endif
PyAPI_FUNC(PyObject *) PyObject_SelfIter(PyObject *);
+#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject *) _PyObject_NextNotImplemented(PyObject *);
+#endif
PyAPI_FUNC(PyObject *) PyObject_GenericGetAttr(PyObject *, PyObject *);
PyAPI_FUNC(int) PyObject_GenericSetAttr(PyObject *,
PyObject *, PyObject *);
@@ -469,8 +509,10 @@
PyAPI_FUNC(void) Py_ReprLeave(PyObject *);
/* Helpers for hash functions */
+#ifndef Py_LIMITED_API
PyAPI_FUNC(Py_hash_t) _Py_HashDouble(double);
PyAPI_FUNC(Py_hash_t) _Py_HashPointer(void*);
+#endif
/* Helper for passing objects to printf and the like */
#define PyObject_REPR(obj) _PyUnicode_AsString(PyObject_Repr(obj))
@@ -649,9 +691,13 @@
#define _Py_ForgetReference(op) _Py_INC_TPFREES(op)
+#ifdef Py_LIMITED_API
+PyAPI_FUNC(void) _Py_Dealloc(PyObject *);
+#else
#define _Py_Dealloc(op) ( \
_Py_INC_TPFREES(op) _Py_COUNT_ALLOCS_COMMA \
(*Py_TYPE(op)->tp_dealloc)((PyObject *)(op)))
+#endif
#endif /* !Py_TRACE_REFS */
#define Py_INCREF(op) ( \
diff --git a/Include/objimpl.h b/Include/objimpl.h
index 2980031..3fef376 100644
--- a/Include/objimpl.h
+++ b/Include/objimpl.h
@@ -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 *);
diff --git a/Include/parsetok.h b/Include/parsetok.h
index af80570..d183784 100644
--- a/Include/parsetok.h
+++ b/Include/parsetok.h
@@ -1,6 +1,6 @@
/* Parser-tokenizer link interface */
-
+#ifndef Py_LIMITED_API
#ifndef Py_PARSETOK_H
#define Py_PARSETOK_H
#ifdef __cplusplus
@@ -64,3 +64,4 @@
}
#endif
#endif /* !Py_PARSETOK_H */
+#endif /* !Py_LIMITED_API */
diff --git a/Include/pyarena.h b/Include/pyarena.h
index 5f193fe..db3ad01 100644
--- a/Include/pyarena.h
+++ b/Include/pyarena.h
@@ -1,6 +1,7 @@
/* An arena-like memory interface for the compiler.
*/
+#ifndef Py_LIMITED_API
#ifndef Py_PYARENA_H
#define Py_PYARENA_H
@@ -60,3 +61,4 @@
#endif
#endif /* !Py_PYARENA_H */
+#endif /* Py_LIMITED_API */
diff --git a/Include/pyatomic.h b/Include/pyatomic.h
index 7d3449d..b0028fd 100644
--- a/Include/pyatomic.h
+++ b/Include/pyatomic.h
@@ -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 */
diff --git a/Include/pyctype.h b/Include/pyctype.h
index c5cc614..787c1b9 100644
--- a/Include/pyctype.h
+++ b/Include/pyctype.h
@@ -1,3 +1,4 @@
+#ifndef Py_LIMITED_API
#ifndef PYCTYPE_H
#define PYCTYPE_H
@@ -29,3 +30,4 @@
#define Py_TOUPPER(c) (_Py_ctype_toupper[Py_CHARMASK(c)])
#endif /* !PYCTYPE_H */
+#endif /* !Py_LIMITED_API */
diff --git a/Include/pydebug.h b/Include/pydebug.h
index 0a31f5b..1cbb342 100644
--- a/Include/pydebug.h
+++ b/Include/pydebug.h
@@ -1,4 +1,4 @@
-
+#ifndef Py_LIMITED_API
#ifndef Py_PYDEBUG_H
#define Py_PYDEBUG_H
#ifdef __cplusplus
@@ -31,3 +31,4 @@
}
#endif
#endif /* !Py_PYDEBUG_H */
+#endif /* Py_LIMITED_API */
diff --git a/Include/pyerrors.h b/Include/pyerrors.h
index f717afa..d72ce07 100644
--- a/Include/pyerrors.h
+++ b/Include/pyerrors.h
@@ -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 */
@@ -68,8 +70,9 @@
PyAPI_FUNC(void) PyErr_Clear(void);
PyAPI_FUNC(void) PyErr_Fetch(PyObject **, PyObject **, PyObject **);
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)
@@ -183,7 +186,7 @@
PyObject *exc,
const char *filename /* decoded from the filesystem encoding */
);
-#ifdef MS_WINDOWS
+#if defined(MS_WINDOWS) && !defined(Py_LIMITED_API)
PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithUnicodeFilename(
PyObject *, const Py_UNICODE *);
#endif /* MS_WINDOWS */
@@ -199,15 +202,20 @@
int, const char *);
PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithFilename(
int, const char *);
+#ifndef Py_LIMITED_API
+/* XXX redeclare to use WSTRING */
PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithUnicodeFilename(
int, const Py_UNICODE *);
+#endif
PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErr(int);
PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithFilenameObject(
PyObject *,int, PyObject *);
PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithFilename(
PyObject *,int, const char *);
+#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithUnicodeFilename(
PyObject *,int, const Py_UNICODE *);
+#endif
PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErr(PyObject *, int);
#endif /* MS_WINDOWS */
@@ -230,7 +238,9 @@
PyAPI_FUNC(void) PyErr_SetInterrupt(void);
/* In signalmodule.c */
+#ifndef Py_LIMITED_API
int PySignal_SetWakeupFd(int fd);
+#endif
/* Support for adding program text to SyntaxErrors */
PyAPI_FUNC(void) PyErr_SyntaxLocation(const char *, int);
@@ -245,12 +255,16 @@
const char *, const char *, Py_ssize_t, Py_ssize_t, Py_ssize_t, const char *);
/* create a UnicodeEncodeError object */
+#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_Create(
const char *, const Py_UNICODE *, Py_ssize_t, Py_ssize_t, Py_ssize_t, const char *);
+#endif
/* create a UnicodeTranslateError object */
+#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject *) PyUnicodeTranslateError_Create(
const Py_UNICODE *, Py_ssize_t, Py_ssize_t, Py_ssize_t, const char *);
+#endif
/* get the encoding attribute */
PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_GetEncoding(PyObject *);
diff --git a/Include/pygetopt.h b/Include/pygetopt.h
index 19e3fd1..4de8c00 100644
--- a/Include/pygetopt.h
+++ b/Include/pygetopt.h
@@ -5,9 +5,11 @@
extern "C" {
#endif
+#ifndef Py_LIMITED_API
PyAPI_DATA(int) _PyOS_opterr;
PyAPI_DATA(int) _PyOS_optind;
PyAPI_DATA(wchar_t *) _PyOS_optarg;
+#endif
PyAPI_FUNC(int) _PyOS_GetOpt(int argc, wchar_t **argv, wchar_t *optstring);
diff --git a/Include/pymath.h b/Include/pymath.h
index e3cf22b..b4eda66 100644
--- a/Include/pymath.h
+++ b/Include/pymath.h
@@ -67,6 +67,7 @@
nothing. */
/* we take double rounding as evidence of x87 usage */
+#ifndef Py_LIMITED_API
#ifndef Py_FORCE_DOUBLE
# ifdef X87_DOUBLE_ROUNDING
PyAPI_FUNC(double) _Py_force_double(double);
@@ -75,11 +76,14 @@
# define Py_FORCE_DOUBLE(X) (X)
# endif
#endif
+#endif
+#ifndef Py_LIMITED_API
#ifdef HAVE_GCC_ASM_FOR_X87
PyAPI_FUNC(unsigned short) _Py_get_387controlword(void);
PyAPI_FUNC(void) _Py_set_387controlword(unsigned short);
#endif
+#endif
/* Py_IS_NAN(X)
* Return 1 if float or double arg is a NaN, else 0.
diff --git a/Include/pystate.h b/Include/pystate.h
index 7b6b602..50245c2 100644
--- a/Include/pystate.h
+++ b/Include/pystate.h
@@ -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() \
@@ -190,19 +202,25 @@
/* The implementation of sys._current_frames() Returns a dict mapping
thread id to that thread's current frame.
*/
+#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject *) _PyThread_CurrentFrames(void);
+#endif
/* Routines for advanced debuggers, requested by David Beazley.
Don't use unless you know what you are doing! */
+#ifndef Py_LIMITED_API
PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_Head(void);
PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_Next(PyInterpreterState *);
PyAPI_FUNC(PyThreadState *) PyInterpreterState_ThreadHead(PyInterpreterState *);
PyAPI_FUNC(PyThreadState *) PyThreadState_Next(PyThreadState *);
typedef struct _frame *(*PyThreadFrameGetter)(PyThreadState *self_);
+#endif
/* hook for PyEval_GetFrame(), requested for Psyco */
+#ifndef Py_LIMITED_API
PyAPI_DATA(PyThreadFrameGetter) _PyThreadState_GetFrame;
+#endif
#ifdef __cplusplus
}
diff --git a/Include/pystrtod.h b/Include/pystrtod.h
index d7bae12..23fd1c6 100644
--- a/Include/pystrtod.h
+++ b/Include/pystrtod.h
@@ -18,7 +18,9 @@
int flags,
int *type);
+#ifndef Py_LIMITED_API
PyAPI_FUNC(double) _Py_parse_inf_or_nan(const char *p, char **endptr);
+#endif
/* PyOS_double_to_string's "flags" parameter can be set to 0 or more of: */
diff --git a/Include/pythonrun.h b/Include/pythonrun.h
index 108b647..95bdf9e 100644
--- a/Include/pythonrun.h
+++ b/Include/pythonrun.h
@@ -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,9 +35,10 @@
PyAPI_FUNC(PyThreadState *) Py_NewInterpreter(void);
PyAPI_FUNC(void) Py_EndInterpreter(PyThreadState *);
+#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_SimpleStringFlags(const char *, PyCompilerFlags *);
PyAPI_FUNC(int) PyRun_SimpleFileExFlags(FILE *, const char *, int, PyCompilerFlags *);
PyAPI_FUNC(int) PyRun_InteractiveOneFlags(FILE *, const char *, PyCompilerFlags *);
PyAPI_FUNC(int) PyRun_InteractiveLoopFlags(FILE *, const char *, PyCompilerFlags *);
@@ -48,25 +51,35 @@
char *, char *,
PyCompilerFlags *, int *,
PyArena *);
+#endif
+
+#ifndef PyParser_SimpleParseString
#define PyParser_SimpleParseString(S, B) \
PyParser_SimpleParseStringFlags(S, B, 0)
#define PyParser_SimpleParseFile(FP, S, B) \
PyParser_SimpleParseFileFlags(FP, S, B, 0)
+#endif
PyAPI_FUNC(struct _node *) PyParser_SimpleParseStringFlags(const char *, int,
int);
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 *);
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);
@@ -76,19 +89,24 @@
/* Py_PyAtExit is for the atexit module, Py_AtExit is for low-level
* exit functions.
*/
+#ifndef Py_LIMITED_API
PyAPI_FUNC(void) _Py_PyAtExit(void (*func)(void));
+#endif
PyAPI_FUNC(int) Py_AtExit(void (*func)(void));
PyAPI_FUNC(void) Py_Exit(int);
/* Restore signals that the interpreter has called SIG_IGN on to SIG_DFL. */
+#ifndef Py_LIMITED_API
PyAPI_FUNC(void) _Py_RestoreSignals(void);
PyAPI_FUNC(int) Py_FdIsInteractive(FILE *, const char *);
+#endif
/* Bootstrap */
PyAPI_FUNC(int) Py_Main(int argc, wchar_t **argv);
+#ifndef Py_LIMITED_API
/* Use macros for a bunch of old variants */
#define PyRun_String(str, s, g, l) PyRun_StringFlags(str, s, g, l, NULL)
#define PyRun_AnyFile(fp, name) PyRun_AnyFileExFlags(fp, name, 0, NULL)
@@ -107,6 +125,7 @@
PyRun_FileExFlags(fp, p, s, g, l, c, NULL)
#define PyRun_FileFlags(fp, p, s, g, l, flags) \
PyRun_FileExFlags(fp, p, s, g, l, 0, flags)
+#endif
/* In getpath.c */
PyAPI_FUNC(wchar_t *) Py_GetProgramFullPath(void);
@@ -114,6 +133,9 @@
PyAPI_FUNC(wchar_t *) Py_GetExecPrefix(void);
PyAPI_FUNC(wchar_t *) Py_GetPath(void);
PyAPI_FUNC(void) Py_SetPath(const wchar_t *);
+#ifdef MS_WINDOWS
+int _Py_CheckPython3();
+#endif
/* In their own files */
PyAPI_FUNC(const char *) Py_GetVersion(void);
@@ -121,11 +143,14 @@
PyAPI_FUNC(const char *) Py_GetCopyright(void);
PyAPI_FUNC(const char *) Py_GetCompiler(void);
PyAPI_FUNC(const char *) Py_GetBuildInfo(void);
+#ifndef Py_LIMITED_API
PyAPI_FUNC(const char *) _Py_svnversion(void);
PyAPI_FUNC(const char *) Py_SubversionRevision(void);
PyAPI_FUNC(const char *) Py_SubversionShortBranch(void);
+#endif
/* Internal -- various one-time initializations */
+#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject *) _PyBuiltin_Init(void);
PyAPI_FUNC(PyObject *) _PySys_Init(void);
PyAPI_FUNC(void) _PyImport_Init(void);
@@ -134,8 +159,10 @@
PyAPI_FUNC(int) _PyFrame_Init(void);
PyAPI_FUNC(void) _PyFloat_Init(void);
PyAPI_FUNC(int) PyByteArray_Init(void);
+#endif
/* Various internal finalizers */
+#ifndef Py_LIMITED_API
PyAPI_FUNC(void) _PyExc_Fini(void);
PyAPI_FUNC(void) _PyImport_Fini(void);
PyAPI_FUNC(void) PyMethod_Fini(void);
@@ -150,12 +177,17 @@
PyAPI_FUNC(void) PyFloat_Fini(void);
PyAPI_FUNC(void) PyOS_FiniInterrupts(void);
PyAPI_FUNC(void) _PyGC_Fini(void);
+#endif
/* Stuff with no proper home (yet) */
+#ifndef Py_LIMITED_API
PyAPI_FUNC(char *) PyOS_Readline(FILE *, FILE *, char *);
+#endif
PyAPI_DATA(int) (*PyOS_InputHook)(void);
PyAPI_DATA(char) *(*PyOS_ReadlineFunctionPointer)(FILE *, FILE *, char *);
+#ifndef Py_LIMITED_API
PyAPI_DATA(PyThreadState*) _PyOS_ReadlineTState;
+#endif
/* Stack size, in "pointers" (so we get extra safety margins
on 64-bit platforms). On a 32-bit platform, this translates
diff --git a/Include/pytime.h b/Include/pytime.h
index 964d096..d707bdb 100644
--- a/Include/pytime.h
+++ b/Include/pytime.h
@@ -1,3 +1,4 @@
+#ifndef Py_LIMITED_API
#ifndef Py_PYTIME_H
#define Py_PYTIME_H
@@ -44,3 +45,4 @@
#endif
#endif /* Py_PYTIME_H */
+#endif /* Py_LIMITED_API */
diff --git a/Include/setobject.h b/Include/setobject.h
index 023c5fa..6234111 100644
--- a/Include/setobject.h
+++ b/Include/setobject.h
@@ -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 {
@@ -56,6 +56,7 @@
Py_hash_t 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;
@@ -85,14 +86,20 @@
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);
PyAPI_FUNC(int) PySet_Add(PyObject *set, PyObject *key);
+#ifndef Py_LIMITED_API
PyAPI_FUNC(int) _PySet_NextEntry(PyObject *set, Py_ssize_t *pos, PyObject **key, Py_hash_t *hash);
+#endif
PyAPI_FUNC(PyObject *) PySet_Pop(PyObject *set);
+#ifndef Py_LIMITED_API
PyAPI_FUNC(int) _PySet_Update(PyObject *set, PyObject *iterable);
+#endif
#ifdef __cplusplus
}
diff --git a/Include/sliceobject.h b/Include/sliceobject.h
index 8ab62dd..8bec179 100644
--- a/Include/sliceobject.h
+++ b/Include/sliceobject.h
@@ -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;
@@ -31,10 +32,12 @@
PyAPI_FUNC(PyObject *) PySlice_New(PyObject* start, PyObject* stop,
PyObject* step);
+#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject *) _PySlice_FromIndices(Py_ssize_t start, Py_ssize_t stop);
-PyAPI_FUNC(int) PySlice_GetIndices(PySliceObject *r, Py_ssize_t length,
+#endif
+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);
diff --git a/Include/structseq.h b/Include/structseq.h
index a5d7b2e..30c52ac 100644
--- a/Include/structseq.h
+++ b/Include/structseq.h
@@ -21,18 +21,25 @@
extern char* PyStructSequence_UnnamedField;
+#ifndef Py_LIMITED_API
PyAPI_FUNC(void) PyStructSequence_InitType(PyTypeObject *type,
PyStructSequence_Desc *desc);
+#endif
+PyAPI_FUNC(PyTypeObject*) PyStructSequence_NewType(PyStructSequence_Desc *desc);
PyAPI_FUNC(PyObject *) PyStructSequence_New(PyTypeObject* type);
+#ifndef Py_LIMITED_API
typedef PyTupleObject PyStructSequence;
/* Macro, *only* to be used to fill in brand new objects */
#define PyStructSequence_SET_ITEM(op, i, v) PyTuple_SET_ITEM(op, i, v)
#define PyStructSequence_GET_ITEM(op, i) PyTuple_GET_ITEM(op, i)
+#endif
+PyAPI_FUNC(void) PyStructSequence_SetItem(PyObject*, Py_ssize_t, PyObject*);
+PyAPI_FUNC(PyObject*) PyStructSequence_GetItem(PyObject*, Py_ssize_t);
#ifdef __cplusplus
}
diff --git a/Include/symtable.h b/Include/symtable.h
index 9b1b75b..2ad204d 100644
--- a/Include/symtable.h
+++ b/Include/symtable.h
@@ -1,3 +1,4 @@
+#ifndef Py_LIMITED_API
#ifndef Py_SYMTABLE_H
#define Py_SYMTABLE_H
@@ -102,3 +103,4 @@
}
#endif
#endif /* !Py_SYMTABLE_H */
+#endif /* Py_LIMITED_API */
diff --git a/Include/sysmodule.h b/Include/sysmodule.h
index c00901b..010e6e0 100644
--- a/Include/sysmodule.h
+++ b/Include/sysmodule.h
@@ -20,7 +20,9 @@
PyAPI_FUNC(void) PySys_FormatStdout(const char *format, ...);
PyAPI_FUNC(void) PySys_FormatStderr(const char *format, ...);
+#ifndef Py_LIMITED_API
PyAPI_DATA(PyObject *) _PySys_TraceFunc, *_PySys_ProfileFunc;
+#endif
PyAPI_FUNC(void) PySys_ResetWarnOptions(void);
PyAPI_FUNC(void) PySys_AddWarnOption(const wchar_t *);
diff --git a/Include/timefuncs.h b/Include/timefuncs.h
index 553142d..3c43575 100644
--- a/Include/timefuncs.h
+++ b/Include/timefuncs.h
@@ -14,7 +14,9 @@
* to fit in a time_t. ValueError is set on return iff the return
* value is (time_t)-1 and PyErr_Occurred().
*/
+#ifndef Py_LIMITED_API
PyAPI_FUNC(time_t) _PyTime_DoubleToTimet(double x);
+#endif
#ifdef __cplusplus
diff --git a/Include/token.h b/Include/token.h
index 9c19f5c..a462c64 100644
--- a/Include/token.h
+++ b/Include/token.h
@@ -1,6 +1,6 @@
/* Token types */
-
+#ifndef Py_LIMITED_API
#ifndef Py_TOKEN_H
#define Py_TOKEN_H
#ifdef __cplusplus
@@ -85,3 +85,4 @@
}
#endif
#endif /* !Py_TOKEN_H */
+#endif /* Py_LIMITED_API */
diff --git a/Include/traceback.h b/Include/traceback.h
index fc0c586..69e3d05 100644
--- a/Include/traceback.h
+++ b/Include/traceback.h
@@ -8,7 +8,7 @@
struct _frame;
/* Traceback interface */
-
+#ifndef Py_LIMITED_API
typedef struct _traceback {
PyObject_HEAD
struct _traceback *tb_next;
@@ -16,10 +16,13 @@
int tb_lasti;
int tb_lineno;
} PyTracebackObject;
+#endif
PyAPI_FUNC(int) PyTraceBack_Here(struct _frame *);
PyAPI_FUNC(int) PyTraceBack_Print(PyObject *, PyObject *);
+#ifndef Py_LIMITED_API
PyAPI_FUNC(int) _Py_DisplaySourceLine(PyObject *, PyObject *, int, int);
+#endif
/* Reveal traceback type so we can typecheck traceback objects */
PyAPI_DATA(PyTypeObject) PyTraceBack_Type;
diff --git a/Include/tupleobject.h b/Include/tupleobject.h
index 19fe7a5..f17b788 100644
--- a/Include/tupleobject.h
+++ b/Include/tupleobject.h
@@ -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;
@@ -43,16 +45,22 @@
PyAPI_FUNC(PyObject *) PyTuple_GetItem(PyObject *, Py_ssize_t);
PyAPI_FUNC(int) PyTuple_SetItem(PyObject *, Py_ssize_t, PyObject *);
PyAPI_FUNC(PyObject *) PyTuple_GetSlice(PyObject *, Py_ssize_t, Py_ssize_t);
+#ifndef Py_LIMITED_API
PyAPI_FUNC(int) _PyTuple_Resize(PyObject **, Py_ssize_t);
+#endif
PyAPI_FUNC(PyObject *) PyTuple_Pack(Py_ssize_t, ...);
+#ifndef Py_LIMITED_API
PyAPI_FUNC(void) _PyTuple_MaybeUntrack(PyObject *);
+#endif
/* 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);
diff --git a/Include/typeslots.h b/Include/typeslots.h
new file mode 100644
index 0000000..9ab9850
--- /dev/null
+++ b/Include/typeslots.h
@@ -0,0 +1,71 @@
+#define Py_bf_getbuffer 1
+#define Py_bf_releasebuffer 2
+#define Py_mp_ass_subscript 3
+#define Py_mp_length 4
+#define Py_mp_subscript 5
+#define Py_nb_absolute 6
+#define Py_nb_add 7
+#define Py_nb_and 8
+#define Py_nb_bool 9
+#define Py_nb_divmod 10
+#define Py_nb_float 11
+#define Py_nb_floor_divide 12
+#define Py_nb_index 13
+#define Py_nb_inplace_add 14
+#define Py_nb_inplace_and 15
+#define Py_nb_inplace_floor_divide 16
+#define Py_nb_inplace_lshift 17
+#define Py_nb_inplace_multiply 18
+#define Py_nb_inplace_or 19
+#define Py_nb_inplace_power 20
+#define Py_nb_inplace_remainder 21
+#define Py_nb_inplace_rshift 22
+#define Py_nb_inplace_subtract 23
+#define Py_nb_inplace_true_divide 24
+#define Py_nb_inplace_xor 25
+#define Py_nb_int 26
+#define Py_nb_invert 27
+#define Py_nb_lshift 28
+#define Py_nb_multiply 29
+#define Py_nb_negative 30
+#define Py_nb_or 31
+#define Py_nb_positive 32
+#define Py_nb_power 33
+#define Py_nb_remainder 34
+#define Py_nb_rshift 35
+#define Py_nb_subtract 36
+#define Py_nb_true_divide 37
+#define Py_nb_xor 38
+#define Py_sq_ass_item 39
+#define Py_sq_concat 40
+#define Py_sq_contains 41
+#define Py_sq_inplace_concat 42
+#define Py_sq_inplace_repeat 43
+#define Py_sq_item 44
+#define Py_sq_length 45
+#define Py_sq_repeat 46
+#define Py_tp_alloc 47
+#define Py_tp_base 48
+#define Py_tp_bases 49
+#define Py_tp_call 50
+#define Py_tp_clear 51
+#define Py_tp_dealloc 52
+#define Py_tp_del 53
+#define Py_tp_descr_get 54
+#define Py_tp_descr_set 55
+#define Py_tp_doc 56
+#define Py_tp_getattr 57
+#define Py_tp_getattro 58
+#define Py_tp_hash 59
+#define Py_tp_init 60
+#define Py_tp_is_gc 61
+#define Py_tp_iter 62
+#define Py_tp_iternext 63
+#define Py_tp_methods 64
+#define Py_tp_new 65
+#define Py_tp_repr 66
+#define Py_tp_richcompare 67
+#define Py_tp_setattr 68
+#define Py_tp_setattro 69
+#define Py_tp_str 70
+#define Py_tp_traverse 71
diff --git a/Include/ucnhash.h b/Include/ucnhash.h
index 69b7774..70fdf13 100644
--- a/Include/ucnhash.h
+++ b/Include/ucnhash.h
@@ -1,5 +1,5 @@
/* Unicode name database interface */
-
+#ifndef Py_LIMITED_API
#ifndef Py_UCNHASH_H
#define Py_UCNHASH_H
#ifdef __cplusplus
@@ -31,3 +31,4 @@
}
#endif
#endif /* !Py_UCNHASH_H */
+#endif /* !Py_LIMITED_API */
diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h
index 2a20779..116bb82 100644
--- a/Include/unicodeobject.h
+++ b/Include/unicodeobject.h
@@ -131,7 +131,9 @@
Python and represents a single Unicode element in the Unicode
type. */
+#ifndef Py_LIMITED_API
typedef PY_UNICODE_TYPE Py_UNICODE;
+#endif
/* --- UCS-2/UCS-4 Name Mangling ------------------------------------------ */
@@ -318,6 +320,7 @@
_Py_ascii_whitespace (see below) with an inlined check.
*/
+#ifndef Py_LIMITED_API
#define Py_UNICODE_ISSPACE(ch) \
((ch) < 128U ? _Py_ascii_whitespace[(ch)] : _PyUnicode_IsWhitespace(ch))
@@ -362,6 +365,7 @@
((*((string)->str + (offset)) == *((substring)->str)) && \
((*((string)->str + (offset) + (substring)->length-1) == *((substring)->str + (substring)->length-1))) && \
!memcmp((string)->str + (offset), (substring)->str, (substring)->length*sizeof(Py_UNICODE)))
+#endif /* Py_LIMITED_API */
#ifdef __cplusplus
extern "C" {
@@ -369,6 +373,7 @@
/* --- Unicode Type ------------------------------------------------------- */
+#ifndef Py_LIMITED_API
typedef struct {
PyObject_HEAD
Py_ssize_t length; /* Length of raw Unicode data in buffer */
@@ -381,6 +386,7 @@
string, or NULL; this is used for
implementing the buffer protocol */
} PyUnicodeObject;
+#endif
PyAPI_DATA(PyTypeObject) PyUnicode_Type;
PyAPI_DATA(PyTypeObject) PyUnicodeIter_Type;
@@ -394,6 +400,7 @@
#define PyUnicode_CheckExact(op) (Py_TYPE(op) == &PyUnicode_Type)
/* Fast access macros */
+#ifndef Py_LIMITED_API
#define PyUnicode_GET_SIZE(op) \
(assert(PyUnicode_Check(op)),(((PyUnicodeObject *)(op))->length))
#define PyUnicode_GET_DATA_SIZE(op) \
@@ -402,6 +409,7 @@
(assert(PyUnicode_Check(op)),(((PyUnicodeObject *)(op))->str))
#define PyUnicode_AS_DATA(op) \
(assert(PyUnicode_Check(op)),((const char *)((PyUnicodeObject *)(op))->str))
+#endif
/* --- Constants ---------------------------------------------------------- */
@@ -426,10 +434,12 @@
The buffer is copied into the new object. */
+#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject*) PyUnicode_FromUnicode(
const Py_UNICODE *u, /* Unicode buffer */
Py_ssize_t size /* size of buffer */
);
+#endif
/* Similar to PyUnicode_FromUnicode(), but u points to UTF-8 encoded bytes */
PyAPI_FUNC(PyObject*) PyUnicode_FromStringAndSize(
@@ -446,9 +456,11 @@
/* Return a read-only pointer to the Unicode object's internal
Py_UNICODE buffer. */
+#ifndef Py_LIMITED_API
PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
PyObject *unicode /* Unicode object */
);
+#endif
/* Get the length of the Unicode object. */
@@ -456,8 +468,10 @@
PyObject *unicode /* Unicode object */
);
+#ifndef Py_LIMITED_API
/* Get the maximum ordinal for a Unicode character. */
PyAPI_FUNC(Py_UNICODE) PyUnicode_GetMax(void);
+#endif
/* Resize an already allocated Unicode object to the new size length.
@@ -527,16 +541,20 @@
...
);
+#ifndef Py_LIMITED_API
/* Format the object based on the format_spec, as defined in PEP 3101
(Advanced String Formatting). */
PyAPI_FUNC(PyObject *) _PyUnicode_FormatAdvanced(PyObject *obj,
Py_UNICODE *format_spec,
Py_ssize_t format_spec_len);
+#endif
PyAPI_FUNC(void) PyUnicode_InternInPlace(PyObject **);
PyAPI_FUNC(void) PyUnicode_InternImmortal(PyObject **);
PyAPI_FUNC(PyObject *) PyUnicode_InternFromString(const char *);
+#ifndef Py_LIMITED_API
PyAPI_FUNC(void) _Py_ReleaseInternedUnicodeStrings(void);
+#endif
/* Use only if you know it's a string */
#define PyUnicode_CHECK_INTERNED(op) (((PyUnicodeObject *)(op))->state)
@@ -568,7 +586,7 @@
error. */
PyAPI_FUNC(Py_ssize_t) PyUnicode_AsWideChar(
- PyUnicodeObject *unicode, /* Unicode object */
+ PyObject *unicode, /* Unicode object */
register wchar_t *w, /* wchar_t buffer */
Py_ssize_t size /* size of buffer */
);
@@ -646,9 +664,11 @@
*/
+#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject *) _PyUnicode_AsDefaultEncodedString(
PyObject *unicode,
const char *errors);
+#endif
/* Returns a pointer to the default encoding (UTF-8) of the
Unicode object unicode and the size of the encoded representation
@@ -664,9 +684,11 @@
*/
+#ifndef Py_LIMITED_API
PyAPI_FUNC(char *) _PyUnicode_AsStringAndSize(
PyObject *unicode,
Py_ssize_t *size);
+#endif
/* Returns a pointer to the default encoding (UTF-8) of the
Unicode object unicode.
@@ -682,7 +704,9 @@
*/
+#ifndef Py_LIMITED_API
PyAPI_FUNC(char *) _PyUnicode_AsString(PyObject *unicode);
+#endif
/* Returns "utf-8". */
@@ -721,12 +745,14 @@
/* Encodes a Py_UNICODE buffer of the given size and returns a
Python string object. */
+#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject*) PyUnicode_Encode(
const Py_UNICODE *s, /* Unicode char buffer */
Py_ssize_t size, /* number of Py_UNICODE chars to encode */
const char *encoding, /* encoding */
const char *errors /* error handling */
);
+#endif
/* Encodes a Unicode object and returns the result as Python
object. */
@@ -776,6 +802,7 @@
Py_ssize_t *consumed /* bytes consumed */
);
+#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF7(
const Py_UNICODE *data, /* Unicode char buffer */
Py_ssize_t length, /* number of Py_UNICODE chars to encode */
@@ -783,6 +810,7 @@
int base64WhiteSpace, /* Encode whitespace (sp, ht, nl, cr) in base64 */
const char *errors /* error handling */
);
+#endif
/* --- UTF-8 Codecs ------------------------------------------------------- */
@@ -803,11 +831,13 @@
PyObject *unicode /* Unicode object */
);
+#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF8(
const Py_UNICODE *data, /* Unicode char buffer */
Py_ssize_t length, /* number of Py_UNICODE chars to encode */
const char *errors /* error handling */
);
+#endif
/* --- UTF-32 Codecs ------------------------------------------------------ */
@@ -876,12 +906,14 @@
*/
+#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF32(
const Py_UNICODE *data, /* Unicode char buffer */
Py_ssize_t length, /* number of Py_UNICODE chars to encode */
const char *errors, /* error handling */
int byteorder /* byteorder to use 0=BOM+native;-1=LE,1=BE */
);
+#endif
/* --- UTF-16 Codecs ------------------------------------------------------ */
@@ -954,12 +986,14 @@
*/
+#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF16(
const Py_UNICODE *data, /* Unicode char buffer */
Py_ssize_t length, /* number of Py_UNICODE chars to encode */
const char *errors, /* error handling */
int byteorder /* byteorder to use 0=BOM+native;-1=LE,1=BE */
);
+#endif
/* --- Unicode-Escape Codecs ---------------------------------------------- */
@@ -973,10 +1007,12 @@
PyObject *unicode /* Unicode object */
);
+#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject*) PyUnicode_EncodeUnicodeEscape(
const Py_UNICODE *data, /* Unicode char buffer */
Py_ssize_t length /* Number of Py_UNICODE chars to encode */
);
+#endif
/* --- Raw-Unicode-Escape Codecs ------------------------------------------ */
@@ -990,20 +1026,24 @@
PyObject *unicode /* Unicode object */
);
+#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject*) PyUnicode_EncodeRawUnicodeEscape(
const Py_UNICODE *data, /* Unicode char buffer */
Py_ssize_t length /* Number of Py_UNICODE chars to encode */
);
+#endif
/* --- Unicode Internal Codec ---------------------------------------------
Only for internal use in _codecsmodule.c */
+#ifndef Py_LIMITED_API
PyObject *_PyUnicode_DecodeUnicodeInternal(
const char *string,
Py_ssize_t length,
const char *errors
);
+#endif
/* --- Latin-1 Codecs -----------------------------------------------------
@@ -1021,11 +1061,13 @@
PyObject *unicode /* Unicode object */
);
+#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject*) PyUnicode_EncodeLatin1(
const Py_UNICODE *data, /* Unicode char buffer */
Py_ssize_t length, /* Number of Py_UNICODE chars to encode */
const char *errors /* error handling */
);
+#endif
/* --- ASCII Codecs -------------------------------------------------------
@@ -1043,11 +1085,13 @@
PyObject *unicode /* Unicode object */
);
+#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject*) PyUnicode_EncodeASCII(
const Py_UNICODE *data, /* Unicode char buffer */
Py_ssize_t length, /* Number of Py_UNICODE chars to encode */
const char *errors /* error handling */
);
+#endif
/* --- Character Map Codecs -----------------------------------------------
@@ -1085,6 +1129,7 @@
(unicode ordinal -> char ordinal) */
);
+#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject*) PyUnicode_EncodeCharmap(
const Py_UNICODE *data, /* Unicode char buffer */
Py_ssize_t length, /* Number of Py_UNICODE chars to encode */
@@ -1092,6 +1137,7 @@
(unicode ordinal -> char ordinal) */
const char *errors /* error handling */
);
+#endif
/* Translate a Py_UNICODE buffer of the given length by applying a
character mapping table to it and return the resulting Unicode
@@ -1106,12 +1152,14 @@
*/
+#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject *) PyUnicode_TranslateCharmap(
const Py_UNICODE *data, /* Unicode char buffer */
Py_ssize_t length, /* Number of Py_UNICODE chars to encode */
PyObject *table, /* Translate table */
const char *errors /* error handling */
);
+#endif
#ifdef MS_WIN32
@@ -1134,11 +1182,13 @@
PyObject *unicode /* Unicode object */
);
+#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject*) PyUnicode_EncodeMBCS(
const Py_UNICODE *data, /* Unicode char buffer */
Py_ssize_t length, /* Number of Py_UNICODE chars to encode */
const char *errors /* error handling */
);
+#endif
#endif /* MS_WIN32 */
@@ -1166,12 +1216,14 @@
*/
+#ifndef Py_LIMITED_API
PyAPI_FUNC(int) PyUnicode_EncodeDecimal(
Py_UNICODE *s, /* Unicode buffer */
Py_ssize_t length, /* Number of Py_UNICODE chars to encode */
char *output, /* Output buffer; must have size >= length */
const char *errors /* error handling */
);
+#endif
/* --- File system encoding ---------------------------------------------- */
@@ -1438,26 +1490,31 @@
PyAPI_FUNC(int) PyUnicode_IsIdentifier(PyObject *s);
+#ifndef Py_LIMITED_API
/* Externally visible for str.strip(unicode) */
PyAPI_FUNC(PyObject *) _PyUnicode_XStrip(
PyUnicodeObject *self,
int striptype,
PyObject *sepobj
);
+#endif
/* Using the current locale, insert the thousands grouping
into the string pointed to by buffer. For the argument descriptions,
see Objects/stringlib/localeutil.h */
+#ifndef Py_LIMITED_API
PyAPI_FUNC(Py_ssize_t) _PyUnicode_InsertThousandsGroupingLocale(Py_UNICODE *buffer,
Py_ssize_t n_buffer,
Py_UNICODE *digits,
Py_ssize_t n_digits,
Py_ssize_t min_width);
+#endif
/* Using explicit passed-in values, insert the thousands grouping
into the string pointed to by buffer. For the argument descriptions,
see Objects/stringlib/localeutil.h */
+#ifndef Py_LIMITED_API
PyAPI_FUNC(Py_ssize_t) _PyUnicode_InsertThousandsGrouping(Py_UNICODE *buffer,
Py_ssize_t n_buffer,
Py_UNICODE *digits,
@@ -1465,10 +1522,12 @@
Py_ssize_t min_width,
const char *grouping,
const char *thousands_sep);
+#endif
/* === Characters Type APIs =============================================== */
/* Helper array used by Py_UNICODE_ISSPACE(). */
+#ifndef Py_LIMITED_API
PyAPI_DATA(const unsigned char) _Py_ascii_whitespace[];
/* These should not be used directly. Use the Py_UNICODE_IS* and
@@ -1594,6 +1653,7 @@
PyAPI_FUNC(Py_UNICODE*) PyUnicode_AsUnicodeCopy(
PyObject *unicode
);
+#endif /* Py_LIMITED_API */
#ifdef __cplusplus
}
diff --git a/Include/warnings.h b/Include/warnings.h
index c84cb9f..82abb11 100644
--- a/Include/warnings.h
+++ b/Include/warnings.h
@@ -4,7 +4,9 @@
extern "C" {
#endif
+#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject*) _PyWarnings_Init(void);
+#endif
PyAPI_FUNC(int) PyErr_WarnEx(PyObject *, const char *, Py_ssize_t);
PyAPI_FUNC(int) PyErr_WarnFormat(PyObject *, Py_ssize_t, const char *, ...);
@@ -12,7 +14,9 @@
const char *, PyObject *);
/* DEPRECATED: Use PyErr_WarnEx() instead. */
+#ifndef Py_LIMITED_API
#define PyErr_Warn(category, msg) PyErr_WarnEx(category, msg, 1)
+#endif
#ifdef __cplusplus
}
diff --git a/Include/weakrefobject.h b/Include/weakrefobject.h
index b201d08..7258387 100644
--- a/Include/weakrefobject.h
+++ b/Include/weakrefobject.h
@@ -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)
diff --git a/Makefile.pre.in b/Makefile.pre.in
index 28b3001..7193135 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -641,6 +641,9 @@
$(BYTESTR_DEPS) \
$(srcdir)/Objects/stringlib/formatter.h
+Objects/typeobject.o: $(srcdir)/Objects/typeslots.inc
+$(srcdir)/Objects/typeslots.inc: $(srcdir)/Include/typeslots.h $(srcdir)/Objects/typeslots.py
+ $(PYTHON) $(srcdir)/Objects/typeslots.py < $(srcdir)/Include/typeslots.h > $(srcdir)/Objects/typeslots.inc
############################################################################
# Header files
diff --git a/Misc/NEWS b/Misc/NEWS
index cab89de..6b012e3 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -10,6 +10,8 @@
Core and Builtins
-----------------
+- PEP 384 (Defining a Stable ABI) is implemented.
+
- Issue #2690: Range objects support negative indices and slicing
- Issue #9915: Speed up sorting with a key.
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c
index c074574..ed7c66a 100644
--- a/Modules/_ctypes/_ctypes.c
+++ b/Modules/_ctypes/_ctypes.c
@@ -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;
diff --git a/Modules/_ctypes/cfield.c b/Modules/_ctypes/cfield.c
index d2fa005..ccaa3c9 100644
--- a/Modules/_ctypes/cfield.c
+++ b/Modules/_ctypes/cfield.c
@@ -1214,7 +1214,7 @@
} else
Py_INCREF(value);
- len = PyUnicode_AsWideChar((PyUnicodeObject *)value, chars, 2);
+ len = PyUnicode_AsWideChar(value, chars, 2);
if (len != 1) {
Py_DECREF(value);
PyErr_SetString(PyExc_TypeError,
@@ -1292,7 +1292,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;
}
diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c
index 851eed2..4fed46e 100644
--- a/Modules/_elementtree.c
+++ b/Modules/_elementtree.c
@@ -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;
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c
index 8413641..42d0bcd 100644
--- a/Modules/_testcapimodule.c
+++ b/Modules/_testcapimodule.c
@@ -1398,7 +1398,7 @@
if (buffer == NULL)
return PyErr_NoMemory();
- size = PyUnicode_AsWideChar((PyUnicodeObject*)unicode, buffer, buflen);
+ size = PyUnicode_AsWideChar(unicode, buffer, buflen);
if (size == -1) {
PyMem_Free(buffer);
return NULL;
diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c
index 024109a..18e5e66 100644
--- a/Modules/arraymodule.c
+++ b/Modules/arraymodule.c
@@ -2112,7 +2112,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;
}
@@ -2183,7 +2183,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;
diff --git a/Modules/getpath.c b/Modules/getpath.c
index 16b3b2a..59623d7 100644
--- a/Modules/getpath.c
+++ b/Modules/getpath.c
@@ -361,7 +361,7 @@
decoded = PyUnicode_DecodeUTF8(buf, n, "surrogateescape");
if (decoded != NULL) {
Py_ssize_t k;
- k = PyUnicode_AsWideChar((PyUnicodeObject*)decoded,
+ k = PyUnicode_AsWideChar(decoded,
rel_builddir_path, MAXPATHLEN);
Py_DECREF(decoded);
if (k >= 0) {
diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c
index 13d7f55..8a22752 100644
--- a/Modules/mmapmodule.c
+++ b/Modules/mmapmodule.c
@@ -762,7 +762,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;
}
@@ -888,7 +888,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;
diff --git a/Modules/xxlimited.c b/Modules/xxlimited.c
new file mode 100644
index 0000000..bd3f178
--- /dev/null
+++ b/Modules/xxlimited.c
@@ -0,0 +1,283 @@
+
+/* Use this file as a template to start implementing a module that
+ also declares object types. All occurrences of 'Xxo' should be changed
+ to something reasonable for your objects. After that, all other
+ occurrences of 'xx' should be changed to something reasonable for your
+ module. If your module is named foo your sourcefile should be named
+ foomodule.c.
+
+ You will probably want to delete all references to 'x_attr' and add
+ your own types of attributes instead. Maybe you want to name your
+ local variables other than 'self'. If your object type is needed in
+ other files, you'll have to create a file "foobarobject.h"; see
+ floatobject.h for an example. */
+
+/* Xxo objects */
+
+#include "Python.h"
+
+static PyObject *ErrorObject;
+
+typedef struct {
+ PyObject_HEAD
+ PyObject *x_attr; /* Attributes dictionary */
+} XxoObject;
+
+static PyObject *Xxo_Type;
+
+#define XxoObject_Check(v) (Py_TYPE(v) == Xxo_Type)
+
+static XxoObject *
+newXxoObject(PyObject *arg)
+{
+ XxoObject *self;
+ self = PyObject_New(XxoObject, (PyTypeObject*)Xxo_Type);
+ if (self == NULL)
+ return NULL;
+ self->x_attr = NULL;
+ return self;
+}
+
+/* Xxo methods */
+
+static void
+Xxo_dealloc(XxoObject *self)
+{
+ Py_XDECREF(self->x_attr);
+ PyObject_Del(self);
+}
+
+static PyObject *
+Xxo_demo(XxoObject *self, PyObject *args)
+{
+ if (!PyArg_ParseTuple(args, ":demo"))
+ return NULL;
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+static PyMethodDef Xxo_methods[] = {
+ {"demo", (PyCFunction)Xxo_demo, METH_VARARGS,
+ PyDoc_STR("demo() -> None")},
+ {NULL, NULL} /* sentinel */
+};
+
+static PyObject *
+Xxo_getattro(XxoObject *self, PyObject *name)
+{
+ if (self->x_attr != NULL) {
+ PyObject *v = PyDict_GetItem(self->x_attr, name);
+ if (v != NULL) {
+ Py_INCREF(v);
+ return v;
+ }
+ }
+ return PyObject_GenericGetAttr((PyObject *)self, name);
+}
+
+static int
+Xxo_setattr(XxoObject *self, char *name, PyObject *v)
+{
+ if (self->x_attr == NULL) {
+ self->x_attr = PyDict_New();
+ if (self->x_attr == NULL)
+ return -1;
+ }
+ if (v == NULL) {
+ int rv = PyDict_DelItemString(self->x_attr, name);
+ if (rv < 0)
+ PyErr_SetString(PyExc_AttributeError,
+ "delete non-existing Xxo attribute");
+ return rv;
+ }
+ else
+ return PyDict_SetItemString(self->x_attr, name, v);
+}
+
+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},
+};
+
+static PyType_Spec Xxo_Type_spec = {
+ "xxmodule.Xxo",
+ NULL,
+ sizeof(XxoObject),
+ 0,
+ Py_TPFLAGS_DEFAULT,
+ Xxo_Type_slots
+};
+
+/* --------------------------------------------------------------------- */
+
+/* Function of two integers returning integer */
+
+PyDoc_STRVAR(xx_foo_doc,
+"foo(i,j)\n\
+\n\
+Return the sum of i and j.");
+
+static PyObject *
+xx_foo(PyObject *self, PyObject *args)
+{
+ long i, j;
+ long res;
+ if (!PyArg_ParseTuple(args, "ll:foo", &i, &j))
+ return NULL;
+ res = i+j; /* XXX Do something here */
+ return PyLong_FromLong(res);
+}
+
+
+/* Function of no arguments returning new Xxo object */
+
+static PyObject *
+xx_new(PyObject *self, PyObject *args)
+{
+ XxoObject *rv;
+
+ if (!PyArg_ParseTuple(args, ":new"))
+ return NULL;
+ rv = newXxoObject(args);
+ if (rv == NULL)
+ return NULL;
+ return (PyObject *)rv;
+}
+
+/* Test bad format character */
+
+static PyObject *
+xx_roj(PyObject *self, PyObject *args)
+{
+ PyObject *a;
+ long b;
+ if (!PyArg_ParseTuple(args, "O#:roj", &a, &b))
+ return NULL;
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+
+/* ---------- */
+
+static PyType_Slot Str_Type_slots[] = {
+ {Py_tp_base, NULL}, /* filled out in module init function */
+ {0, 0},
+};
+
+static PyType_Spec Str_Type_spec = {
+ "xxlimited.Str",
+ 0,
+ 0,
+ 0,
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+ Str_Type_slots
+};
+
+/* ---------- */
+
+static PyObject *
+null_richcompare(PyObject *self, PyObject *other, int op)
+{
+ Py_INCREF(Py_NotImplemented);
+ return Py_NotImplemented;
+}
+
+static PyType_Slot Null_Type_slots[] = {
+ {Py_tp_base, NULL}, /* filled out in module init */
+ {Py_tp_new, NULL},
+ {Py_tp_richcompare, null_richcompare},
+ {0, 0}
+};
+
+static PyType_Spec Null_Type_spec = {
+ "xxlimited.Null",
+ NULL, /* doc */
+ 0, /* basicsize */
+ 0, /* itemsize */
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+ Null_Type_slots
+};
+
+/* ---------- */
+
+/* List of functions defined in the module */
+
+static PyMethodDef xx_methods[] = {
+ {"roj", xx_roj, METH_VARARGS,
+ PyDoc_STR("roj(a,b) -> None")},
+ {"foo", xx_foo, METH_VARARGS,
+ xx_foo_doc},
+ {"new", xx_new, METH_VARARGS,
+ PyDoc_STR("new() -> new Xx object")},
+ {NULL, NULL} /* sentinel */
+};
+
+PyDoc_STRVAR(module_doc,
+"This is a template module just for instruction.");
+
+/* Initialization function for the module (*must* be called PyInit_xx) */
+
+
+static struct PyModuleDef xxmodule = {
+ PyModuleDef_HEAD_INIT,
+ "xx",
+ module_doc,
+ -1,
+ xx_methods,
+ NULL,
+ NULL,
+ NULL,
+ NULL
+};
+
+PyMODINIT_FUNC
+PyInit_xxlimited(void)
+{
+ PyObject *m = NULL;
+ PyObject *o;
+
+ /* Due to cross platform compiler issues the slots must be filled
+ * here. It's required for portability to Windows without requiring
+ * C++. */
+ Null_Type_slots[0].pfunc = &PyBaseObject_Type;
+ Null_Type_slots[1].pfunc = PyType_GenericNew;
+ Str_Type_slots[0].pfunc = &PyUnicode_Type;
+
+ Xxo_Type = PyType_FromSpec(&Xxo_Type_spec);
+ if (Xxo_Type == NULL)
+ goto fail;
+
+ /* Create the module and add the functions */
+ m = PyModule_Create(&xxmodule);
+ if (m == NULL)
+ goto fail;
+
+ /* Add some symbolic constants to the module */
+ if (ErrorObject == NULL) {
+ ErrorObject = PyErr_NewException("xx.error", NULL, NULL);
+ if (ErrorObject == NULL)
+ goto fail;
+ }
+ Py_INCREF(ErrorObject);
+ PyModule_AddObject(m, "error", ErrorObject);
+
+ /* Add Str */
+ o = PyType_FromSpec(&Str_Type_spec);
+ if (o == NULL)
+ goto fail;
+ PyModule_AddObject(m, "Str", o);
+
+ /* Add Null */
+ o = PyType_FromSpec(&Null_Type_spec);
+ if (o == NULL)
+ goto fail;
+ PyModule_AddObject(m, "Null", o);
+ return m;
+ fail:
+ Py_XDECREF(m);
+ return NULL;
+}
diff --git a/Objects/bytearrayobject.c b/Objects/bytearrayobject.c
index 6ca096a..32b8bb5 100644
--- a/Objects/bytearrayobject.c
+++ b/Objects/bytearrayobject.c
@@ -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;
diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c
index d3b8a4f..4aa0748 100644
--- a/Objects/bytesobject.c
+++ b/Objects/bytesobject.c
@@ -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;
diff --git a/Objects/funcobject.c b/Objects/funcobject.c
index 221f368..45f9f57 100644
--- a/Objects/funcobject.c
+++ b/Objects/funcobject.c
@@ -627,7 +627,7 @@
}
result = PyEval_EvalCodeEx(
- (PyCodeObject *)PyFunction_GET_CODE(func),
+ PyFunction_GET_CODE(func),
PyFunction_GET_GLOBALS(func), (PyObject *)NULL,
&PyTuple_GET_ITEM(arg, 0), PyTuple_GET_SIZE(arg),
k, nk, d, nd,
diff --git a/Objects/listobject.c b/Objects/listobject.c
index fbc05fd..bcc6bc0 100644
--- a/Objects/listobject.c
+++ b/Objects/listobject.c
@@ -2397,7 +2397,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;
}
@@ -2446,7 +2446,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;
}
diff --git a/Objects/memoryobject.c b/Objects/memoryobject.c
index ba9e08b..a05b97b 100644
--- a/Objects/memoryobject.c
+++ b/Objects/memoryobject.c
@@ -599,7 +599,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;
}
@@ -678,7 +678,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;
}
diff --git a/Objects/moduleobject.c b/Objects/moduleobject.c
index 1e3349d..2c095a0 100644
--- a/Objects/moduleobject.c
+++ b/Objects/moduleobject.c
@@ -74,7 +74,7 @@
module->m_base.m_index = max_module_number;
}
name = module->m_name;
- if (module_api_version != PYTHON_API_VERSION) {
+ if (module_api_version != PYTHON_API_VERSION && module_api_version != PYTHON_ABI_VERSION) {
int err;
err = PyErr_WarnFormat(PyExc_RuntimeWarning, 1,
"Python C API version mismatch for module %.100s: "
diff --git a/Objects/object.c b/Objects/object.c
index 082dd78..17e5069 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -1755,7 +1755,6 @@
#endif
-
/* Hack to force loading of pycapsule.o */
PyTypeObject *_PyCapsule_hack = &PyCapsule_Type;
@@ -1900,6 +1899,19 @@
}
}
+#ifndef Py_TRACE_REFS
+/* For Py_LIMITED_API, we need an out-of-line version of _Py_Dealloc.
+ Define this here, so we can undefine the macro. */
+#undef _Py_Dealloc
+PyAPI_FUNC(void) _Py_Dealloc(PyObject *);
+void
+_Py_Dealloc(PyObject *op)
+{
+ _Py_INC_TPFREES(op) _Py_COUNT_ALLOCS_COMMA
+ (*Py_TYPE(op)->tp_dealloc)(op);
+}
+#endif
+
#ifdef __cplusplus
}
#endif
diff --git a/Objects/rangeobject.c b/Objects/rangeobject.c
index bf42b1e..3ac829a 100644
--- a/Objects/rangeobject.c
+++ b/Objects/rangeobject.c
@@ -431,7 +431,6 @@
return range_item(self, i);
}
if (PySlice_Check(item)) {
- PySliceObject *slice = (PySliceObject*)item;
Py_ssize_t start, stop, step, len, rlen;
rangeobject *result;
PyObject *substart = NULL, *substep = NULL, *substop = NULL;
@@ -441,7 +440,7 @@
return NULL;
}
- if (PySlice_GetIndicesEx(slice, rlen,
+ if (PySlice_GetIndicesEx(item, rlen,
&start, &stop, &step, &len) < 0) {
return NULL;
}
@@ -450,7 +449,7 @@
Py_INCREF(substep);
} else {
/* NB: slice step != Py_None here */
- substep = PyNumber_Multiply(self->step, slice->step);
+ substep = PyNumber_Multiply(self->step, ((PySliceObject*)item)->step);
if (substep == NULL)
goto fail;
}
diff --git a/Objects/sliceobject.c b/Objects/sliceobject.c
index b617891..51c53a8 100644
--- a/Objects/sliceobject.c
+++ b/Objects/sliceobject.c
@@ -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;
}
diff --git a/Objects/structseq.c b/Objects/structseq.c
index 75e2250..ef17f49 100644
--- a/Objects/structseq.c
+++ b/Objects/structseq.c
@@ -43,6 +43,18 @@
return (PyObject*)obj;
}
+void
+PyStructSequence_SetItem(PyObject* op, Py_ssize_t i, PyObject* v)
+{
+ PyStructSequence_SET_ITEM(op, i, v);
+}
+
+PyObject*
+PyStructSequence_GetItem(PyObject* op, Py_ssize_t i)
+{
+ return PyStructSequence_GET_ITEM(op, i);
+}
+
static void
structseq_dealloc(PyStructSequence *obj)
{
@@ -365,3 +377,11 @@
SET_DICT_FROM_INT(real_length_key, n_members);
SET_DICT_FROM_INT(unnamed_fields_key, n_unnamed_members);
}
+
+PyTypeObject*
+PyStructSequence_NewType(PyStructSequence_Desc *desc)
+{
+ PyTypeObject *result = (PyTypeObject*)PyType_GenericAlloc(&PyType_Type, 0);
+ PyStructSequence_InitType(result, desc);
+ return result;
+}
diff --git a/Objects/tupleobject.c b/Objects/tupleobject.c
index 390b670..72b79c9 100644
--- a/Objects/tupleobject.c
+++ b/Objects/tupleobject.c
@@ -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;
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index e0001db..a5863dd 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -2304,6 +2304,44 @@
return (PyObject *)type;
}
+static short slotoffsets[] = {
+ -1, /* invalid slot */
+#include "typeslots.inc"
+};
+
+PyObject* PyType_FromSpec(PyType_Spec *spec)
+{
+ PyHeapTypeObject *res = (PyHeapTypeObject*)PyType_GenericAlloc(&PyType_Type, 0);
+ char *res_start = (char*)res;
+ PyType_Slot *slot;
+
+ res->ht_name = PyUnicode_FromString(spec->name);
+ if (!res->ht_name)
+ goto fail;
+ res->ht_type.tp_name = _PyUnicode_AsString(res->ht_name);
+ if (!res->ht_type.tp_name)
+ goto fail;
+
+ res->ht_type.tp_basicsize = spec->basicsize;
+ res->ht_type.tp_itemsize = spec->itemsize;
+ res->ht_type.tp_flags = spec->flags | Py_TPFLAGS_HEAPTYPE;
+
+ for (slot = spec->slots; slot->slot; slot++) {
+ if (slot->slot >= sizeof(slotoffsets)/sizeof(slotoffsets[0])) {
+ PyErr_SetString(PyExc_RuntimeError, "invalid slot offset");
+ goto fail;
+ }
+ *(void**)(res_start + slotoffsets[slot->slot]) = slot->pfunc;
+ }
+
+ return (PyObject*)res;
+
+ fail:
+ Py_DECREF(res);
+ return NULL;
+}
+
+
/* Internal API to look for a name through the MRO.
This returns a borrowed reference, and doesn't set an exception! */
PyObject *
diff --git a/Objects/typeslots.inc b/Objects/typeslots.inc
new file mode 100644
index 0000000..79e3db8
--- /dev/null
+++ b/Objects/typeslots.inc
@@ -0,0 +1,71 @@
+offsetof(PyHeapTypeObject, as_buffer.bf_getbuffer),
+offsetof(PyHeapTypeObject, as_buffer.bf_releasebuffer),
+offsetof(PyHeapTypeObject, as_mapping.mp_ass_subscript),
+offsetof(PyHeapTypeObject, as_mapping.mp_length),
+offsetof(PyHeapTypeObject, as_mapping.mp_subscript),
+offsetof(PyHeapTypeObject, as_number.nb_absolute),
+offsetof(PyHeapTypeObject, as_number.nb_add),
+offsetof(PyHeapTypeObject, as_number.nb_and),
+offsetof(PyHeapTypeObject, as_number.nb_bool),
+offsetof(PyHeapTypeObject, as_number.nb_divmod),
+offsetof(PyHeapTypeObject, as_number.nb_float),
+offsetof(PyHeapTypeObject, as_number.nb_floor_divide),
+offsetof(PyHeapTypeObject, as_number.nb_index),
+offsetof(PyHeapTypeObject, as_number.nb_inplace_add),
+offsetof(PyHeapTypeObject, as_number.nb_inplace_and),
+offsetof(PyHeapTypeObject, as_number.nb_inplace_floor_divide),
+offsetof(PyHeapTypeObject, as_number.nb_inplace_lshift),
+offsetof(PyHeapTypeObject, as_number.nb_inplace_multiply),
+offsetof(PyHeapTypeObject, as_number.nb_inplace_or),
+offsetof(PyHeapTypeObject, as_number.nb_inplace_power),
+offsetof(PyHeapTypeObject, as_number.nb_inplace_remainder),
+offsetof(PyHeapTypeObject, as_number.nb_inplace_rshift),
+offsetof(PyHeapTypeObject, as_number.nb_inplace_subtract),
+offsetof(PyHeapTypeObject, as_number.nb_inplace_true_divide),
+offsetof(PyHeapTypeObject, as_number.nb_inplace_xor),
+offsetof(PyHeapTypeObject, as_number.nb_int),
+offsetof(PyHeapTypeObject, as_number.nb_invert),
+offsetof(PyHeapTypeObject, as_number.nb_lshift),
+offsetof(PyHeapTypeObject, as_number.nb_multiply),
+offsetof(PyHeapTypeObject, as_number.nb_negative),
+offsetof(PyHeapTypeObject, as_number.nb_or),
+offsetof(PyHeapTypeObject, as_number.nb_positive),
+offsetof(PyHeapTypeObject, as_number.nb_power),
+offsetof(PyHeapTypeObject, as_number.nb_remainder),
+offsetof(PyHeapTypeObject, as_number.nb_rshift),
+offsetof(PyHeapTypeObject, as_number.nb_subtract),
+offsetof(PyHeapTypeObject, as_number.nb_true_divide),
+offsetof(PyHeapTypeObject, as_number.nb_xor),
+offsetof(PyHeapTypeObject, as_sequence.sq_ass_item),
+offsetof(PyHeapTypeObject, as_sequence.sq_concat),
+offsetof(PyHeapTypeObject, as_sequence.sq_contains),
+offsetof(PyHeapTypeObject, as_sequence.sq_inplace_concat),
+offsetof(PyHeapTypeObject, as_sequence.sq_inplace_repeat),
+offsetof(PyHeapTypeObject, as_sequence.sq_item),
+offsetof(PyHeapTypeObject, as_sequence.sq_length),
+offsetof(PyHeapTypeObject, as_sequence.sq_repeat),
+offsetof(PyHeapTypeObject, ht_type.tp_alloc),
+offsetof(PyHeapTypeObject, ht_type.tp_base),
+offsetof(PyHeapTypeObject, ht_type.tp_bases),
+offsetof(PyHeapTypeObject, ht_type.tp_call),
+offsetof(PyHeapTypeObject, ht_type.tp_clear),
+offsetof(PyHeapTypeObject, ht_type.tp_dealloc),
+offsetof(PyHeapTypeObject, ht_type.tp_del),
+offsetof(PyHeapTypeObject, ht_type.tp_descr_get),
+offsetof(PyHeapTypeObject, ht_type.tp_descr_set),
+offsetof(PyHeapTypeObject, ht_type.tp_doc),
+offsetof(PyHeapTypeObject, ht_type.tp_getattr),
+offsetof(PyHeapTypeObject, ht_type.tp_getattro),
+offsetof(PyHeapTypeObject, ht_type.tp_hash),
+offsetof(PyHeapTypeObject, ht_type.tp_init),
+offsetof(PyHeapTypeObject, ht_type.tp_is_gc),
+offsetof(PyHeapTypeObject, ht_type.tp_iter),
+offsetof(PyHeapTypeObject, ht_type.tp_iternext),
+offsetof(PyHeapTypeObject, ht_type.tp_methods),
+offsetof(PyHeapTypeObject, ht_type.tp_new),
+offsetof(PyHeapTypeObject, ht_type.tp_repr),
+offsetof(PyHeapTypeObject, ht_type.tp_richcompare),
+offsetof(PyHeapTypeObject, ht_type.tp_setattr),
+offsetof(PyHeapTypeObject, ht_type.tp_setattro),
+offsetof(PyHeapTypeObject, ht_type.tp_str),
+offsetof(PyHeapTypeObject, ht_type.tp_traverse),
diff --git a/Objects/typeslots.py b/Objects/typeslots.py
new file mode 100644
index 0000000..bcc3196
--- /dev/null
+++ b/Objects/typeslots.py
@@ -0,0 +1,24 @@
+#!/usr/bin/python
+# Usage: typeslots.py < Include/typeslots.h > typeslots.inc
+
+import sys, re
+
+res = {}
+for line in sys.stdin:
+ m = re.match("#define Py_([a-z_]+) ([0-9]+)", line)
+ member = m.group(1)
+ if member.startswith("tp_"):
+ member = "ht_type."+member
+ elif member.startswith("nb_"):
+ member = "as_number."+member
+ elif member.startswith("mp_"):
+ member = "as_mapping."+member
+ elif member.startswith("sq_"):
+ member = "as_sequence."+member
+ elif member.startswith("bf_"):
+ member = "as_buffer."+member
+ res[int(m.group(2))] = member
+
+M = max(res.keys())+1
+for i in range(1,M):
+ print "offsetof(PyHeapTypeObject, %s)," % res[i]
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index f66773e..d3a2d1b 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -1263,7 +1263,7 @@
}
Py_ssize_t
-PyUnicode_AsWideChar(PyUnicodeObject *unicode,
+PyUnicode_AsWideChar(PyObject *unicode,
wchar_t *w,
Py_ssize_t size)
{
@@ -1271,7 +1271,7 @@
PyErr_BadInternalCall();
return -1;
}
- return unicode_aswidechar(unicode, w, size);
+ return unicode_aswidechar((PyUnicodeObject*)unicode, w, size);
}
wchar_t*
@@ -9222,7 +9222,7 @@
Py_UNICODE* result_buf;
PyObject* result;
- if (PySlice_GetIndicesEx((PySliceObject*)item, PyUnicode_GET_SIZE(self),
+ if (PySlice_GetIndicesEx(item, PyUnicode_GET_SIZE(self),
&start, &stop, &step, &slicelength) < 0) {
return NULL;
}
diff --git a/PC/getpathp.c b/PC/getpathp.c
index 3a87411..cd3a4b2 100644
--- a/PC/getpathp.c
+++ b/PC/getpathp.c
@@ -707,3 +707,38 @@
calculate_path();
return progpath;
}
+
+/* Load python3.dll before loading any extension module that might refer
+ to it. That way, we can be sure that always the python3.dll corresponding
+ to this python DLL is loaded, not a python3.dll that might be on the path
+ by chance.
+ Return whether the DLL was found.
+*/
+static int python3_checked = 0;
+static HANDLE hPython3;
+int
+_Py_CheckPython3()
+{
+ wchar_t py3path[MAXPATHLEN+1];
+ wchar_t *s;
+ if (python3_checked)
+ return hPython3 != NULL;
+ python3_checked = 1;
+
+ /* If there is a python3.dll next to the python3y.dll,
+ assume this is a build tree; use that DLL */
+ wcscpy(py3path, dllpath);
+ s = wcsrchr(py3path, L'\\');
+ if (!s)
+ s = py3path;
+ wcscpy(s, L"\\python3.dll");
+ hPython3 = LoadLibraryExW(py3path, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
+ if (hPython3 != NULL)
+ return 1;
+
+ /* Check sys.prefix\DLLs\python3.dll */
+ wcscpy(py3path, Py_GetPrefix());
+ wcscat(py3path, L"\\DLLs\\python3.dll");
+ hPython3 = LoadLibraryExW(py3path, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
+ return hPython3 != NULL;
+}
diff --git a/PC/pyconfig.h b/PC/pyconfig.h
index 913b2dc..cbddbd8 100644
--- a/PC/pyconfig.h
+++ b/PC/pyconfig.h
@@ -318,8 +318,10 @@
/* So MSVC users need not specify the .lib file in
their Makefile (other compilers are generally
taken care of by distutils.) */
-# ifdef _DEBUG
+# if defined(_DEBUG)
# pragma comment(lib,"python32_d.lib")
+# elif defined(Py_LIMITED_API)
+# pragma comment(lib,"python3.lib")
# else
# pragma comment(lib,"python32.lib")
# endif /* _DEBUG */
diff --git a/PC/python3.def b/PC/python3.def
new file mode 100644
index 0000000..082d428
--- /dev/null
+++ b/PC/python3.def
@@ -0,0 +1,698 @@
+LIBRARY "python3"
+EXPORTS
+ PyArg_Parse=python32.PyArg_Parse
+ PyArg_ParseTuple=python32.PyArg_ParseTuple
+ PyArg_ParseTupleAndKeywords=python32.PyArg_ParseTupleAndKeywords
+ PyArg_UnpackTuple=python32.PyArg_UnpackTuple
+ PyArg_VaParse=python32.PyArg_VaParse
+ PyArg_VaParseTupleAndKeywords=python32.PyArg_VaParseTupleAndKeywords
+ PyArg_ValidateKeywordArguments=python32.PyArg_ValidateKeywordArguments
+ PyBaseObject_Type=python32.PyBaseObject_Type DATA
+ PyBool_FromLong=python32.PyBool_FromLong
+ PyBool_Type=python32.PyBool_Type DATA
+ PyBuffer_FillContiguousStrides=python32.PyBuffer_FillContiguousStrides
+ PyBuffer_FillInfo=python32.PyBuffer_FillInfo
+ PyBuffer_FromContiguous=python32.PyBuffer_FromContiguous
+ PyBuffer_GetPointer=python32.PyBuffer_GetPointer
+ PyBuffer_IsContiguous=python32.PyBuffer_IsContiguous
+ PyBuffer_Release=python32.PyBuffer_Release
+ PyBuffer_ToContiguous=python32.PyBuffer_ToContiguous
+ PyByteArrayIter_Type=python32.PyByteArrayIter_Type DATA
+ PyByteArray_AsString=python32.PyByteArray_AsString
+ PyByteArray_Concat=python32.PyByteArray_Concat
+ PyByteArray_FromObject=python32.PyByteArray_FromObject
+ PyByteArray_FromStringAndSize=python32.PyByteArray_FromStringAndSize
+ PyByteArray_Resize=python32.PyByteArray_Resize
+ PyByteArray_Size=python32.PyByteArray_Size
+ PyByteArray_Type=python32.PyByteArray_Type DATA
+ PyBytesIter_Type=python32.PyBytesIter_Type DATA
+ PyBytes_AsString=python32.PyBytes_AsString
+ PyBytes_AsStringAndSize=python32.PyBytes_AsStringAndSize
+ PyBytes_Concat=python32.PyBytes_Concat
+ PyBytes_ConcatAndDel=python32.PyBytes_ConcatAndDel
+ PyBytes_DecodeEscape=python32.PyBytes_DecodeEscape
+ PyBytes_FromFormat=python32.PyBytes_FromFormat
+ PyBytes_FromFormatV=python32.PyBytes_FromFormatV
+ PyBytes_FromObject=python32.PyBytes_FromObject
+ PyBytes_FromString=python32.PyBytes_FromString
+ PyBytes_FromStringAndSize=python32.PyBytes_FromStringAndSize
+ PyBytes_Repr=python32.PyBytes_Repr
+ PyBytes_Size=python32.PyBytes_Size
+ PyBytes_Type=python32.PyBytes_Type DATA
+ PyCFunction_Call=python32.PyCFunction_Call
+ PyCFunction_ClearFreeList=python32.PyCFunction_ClearFreeList
+ PyCFunction_GetFlags=python32.PyCFunction_GetFlags
+ PyCFunction_GetFunction=python32.PyCFunction_GetFunction
+ PyCFunction_GetSelf=python32.PyCFunction_GetSelf
+ PyCFunction_NewEx=python32.PyCFunction_NewEx
+ PyCFunction_Type=python32.PyCFunction_Type DATA
+ PyCallIter_New=python32.PyCallIter_New
+ PyCallIter_Type=python32.PyCallIter_Type DATA
+ PyCallable_Check=python32.PyCallable_Check
+ PyCapsule_GetContext=python32.PyCapsule_GetContext
+ PyCapsule_GetDestructor=python32.PyCapsule_GetDestructor
+ PyCapsule_GetName=python32.PyCapsule_GetName
+ PyCapsule_GetPointer=python32.PyCapsule_GetPointer
+ PyCapsule_Import=python32.PyCapsule_Import
+ PyCapsule_IsValid=python32.PyCapsule_IsValid
+ PyCapsule_New=python32.PyCapsule_New
+ PyCapsule_SetContext=python32.PyCapsule_SetContext
+ PyCapsule_SetDestructor=python32.PyCapsule_SetDestructor
+ PyCapsule_SetName=python32.PyCapsule_SetName
+ PyCapsule_SetPointer=python32.PyCapsule_SetPointer
+ PyCapsule_Type=python32.PyCapsule_Type DATA
+ PyClassMethodDescr_Type=python32.PyClassMethodDescr_Type DATA
+ PyCodec_BackslashReplaceErrors=python32.PyCodec_BackslashReplaceErrors
+ PyCodec_Decode=python32.PyCodec_Decode
+ PyCodec_Decoder=python32.PyCodec_Decoder
+ PyCodec_Encode=python32.PyCodec_Encode
+ PyCodec_Encoder=python32.PyCodec_Encoder
+ PyCodec_IgnoreErrors=python32.PyCodec_IgnoreErrors
+ PyCodec_IncrementalDecoder=python32.PyCodec_IncrementalDecoder
+ PyCodec_IncrementalEncoder=python32.PyCodec_IncrementalEncoder
+ PyCodec_KnownEncoding=python32.PyCodec_KnownEncoding
+ PyCodec_LookupError=python32.PyCodec_LookupError
+ PyCodec_Register=python32.PyCodec_Register
+ PyCodec_RegisterError=python32.PyCodec_RegisterError
+ PyCodec_ReplaceErrors=python32.PyCodec_ReplaceErrors
+ PyCodec_StreamReader=python32.PyCodec_StreamReader
+ PyCodec_StreamWriter=python32.PyCodec_StreamWriter
+ PyCodec_StrictErrors=python32.PyCodec_StrictErrors
+ PyCodec_XMLCharRefReplaceErrors=python32.PyCodec_XMLCharRefReplaceErrors
+ PyComplex_FromDoubles=python32.PyComplex_FromDoubles
+ PyComplex_ImagAsDouble=python32.PyComplex_ImagAsDouble
+ PyComplex_RealAsDouble=python32.PyComplex_RealAsDouble
+ PyComplex_Type=python32.PyComplex_Type DATA
+ PyDescr_NewClassMethod=python32.PyDescr_NewClassMethod
+ PyDescr_NewGetSet=python32.PyDescr_NewGetSet
+ PyDescr_NewMember=python32.PyDescr_NewMember
+ PyDescr_NewMethod=python32.PyDescr_NewMethod
+ PyDictItems_Type=python32.PyDictItems_Type DATA
+ PyDictIterItem_Type=python32.PyDictIterItem_Type DATA
+ PyDictIterKey_Type=python32.PyDictIterKey_Type DATA
+ PyDictIterValue_Type=python32.PyDictIterValue_Type DATA
+ PyDictKeys_Type=python32.PyDictKeys_Type DATA
+ PyDictProxy_New=python32.PyDictProxy_New
+ PyDictProxy_Type=python32.PyDictProxy_Type DATA
+ PyDictValues_Type=python32.PyDictValues_Type DATA
+ PyDict_Clear=python32.PyDict_Clear
+ PyDict_Contains=python32.PyDict_Contains
+ PyDict_Copy=python32.PyDict_Copy
+ PyDict_DelItem=python32.PyDict_DelItem
+ PyDict_DelItemString=python32.PyDict_DelItemString
+ PyDict_GetItem=python32.PyDict_GetItem
+ PyDict_GetItemString=python32.PyDict_GetItemString
+ PyDict_GetItemWithError=python32.PyDict_GetItemWithError
+ PyDict_Items=python32.PyDict_Items
+ PyDict_Keys=python32.PyDict_Keys
+ PyDict_Merge=python32.PyDict_Merge
+ PyDict_MergeFromSeq2=python32.PyDict_MergeFromSeq2
+ PyDict_New=python32.PyDict_New
+ PyDict_Next=python32.PyDict_Next
+ PyDict_SetItem=python32.PyDict_SetItem
+ PyDict_SetItemString=python32.PyDict_SetItemString
+ PyDict_Size=python32.PyDict_Size
+ PyDict_Type=python32.PyDict_Type DATA
+ PyDict_Update=python32.PyDict_Update
+ PyDict_Values=python32.PyDict_Values
+ PyEllipsis_Type=python32.PyEllipsis_Type DATA
+ PyEnum_Type=python32.PyEnum_Type DATA
+ PyErr_BadArgument=python32.PyErr_BadArgument
+ PyErr_BadInternalCall=python32.PyErr_BadInternalCall
+ PyErr_CheckSignals=python32.PyErr_CheckSignals
+ PyErr_Clear=python32.PyErr_Clear
+ PyErr_Display=python32.PyErr_Display
+ PyErr_ExceptionMatches=python32.PyErr_ExceptionMatches
+ PyErr_Fetch=python32.PyErr_Fetch
+ PyErr_Format=python32.PyErr_Format
+ PyErr_GivenExceptionMatches=python32.PyErr_GivenExceptionMatches
+ PyErr_NewException=python32.PyErr_NewException
+ PyErr_NewExceptionWithDoc=python32.PyErr_NewExceptionWithDoc
+ PyErr_NoMemory=python32.PyErr_NoMemory
+ PyErr_NormalizeException=python32.PyErr_NormalizeException
+ PyErr_Occurred=python32.PyErr_Occurred
+ PyErr_Print=python32.PyErr_Print
+ PyErr_PrintEx=python32.PyErr_PrintEx
+ PyErr_ProgramText=python32.PyErr_ProgramText
+ PyErr_Restore=python32.PyErr_Restore
+ PyErr_SetFromErrno=python32.PyErr_SetFromErrno
+ PyErr_SetFromErrnoWithFilename=python32.PyErr_SetFromErrnoWithFilename
+ PyErr_SetFromErrnoWithFilenameObject=python32.PyErr_SetFromErrnoWithFilenameObject
+ PyErr_SetInterrupt=python32.PyErr_SetInterrupt
+ PyErr_SetNone=python32.PyErr_SetNone
+ PyErr_SetObject=python32.PyErr_SetObject
+ PyErr_SetString=python32.PyErr_SetString
+ PyErr_SyntaxLocation=python32.PyErr_SyntaxLocation
+ PyErr_WarnEx=python32.PyErr_WarnEx
+ PyErr_WarnExplicit=python32.PyErr_WarnExplicit
+ PyErr_WarnFormat=python32.PyErr_WarnFormat
+ PyErr_WriteUnraisable=python32.PyErr_WriteUnraisable
+ PyEval_AcquireLock=python32.PyEval_AcquireLock
+ PyEval_AcquireThread=python32.PyEval_AcquireThread
+ PyEval_CallFunction=python32.PyEval_CallFunction
+ PyEval_CallMethod=python32.PyEval_CallMethod
+ PyEval_CallObjectWithKeywords=python32.PyEval_CallObjectWithKeywords
+ PyEval_EvalCode=python32.PyEval_EvalCode
+ PyEval_EvalCodeEx=python32.PyEval_EvalCodeEx
+ PyEval_EvalFrame=python32.PyEval_EvalFrame
+ PyEval_EvalFrameEx=python32.PyEval_EvalFrameEx
+ PyEval_GetBuiltins=python32.PyEval_GetBuiltins
+ PyEval_GetCallStats=python32.PyEval_GetCallStats
+ PyEval_GetFrame=python32.PyEval_GetFrame
+ PyEval_GetFuncDesc=python32.PyEval_GetFuncDesc
+ PyEval_GetFuncName=python32.PyEval_GetFuncName
+ PyEval_GetGlobals=python32.PyEval_GetGlobals
+ PyEval_GetLocals=python32.PyEval_GetLocals
+ PyEval_InitThreads=python32.PyEval_InitThreads
+ PyEval_ReInitThreads=python32.PyEval_ReInitThreads
+ PyEval_ReleaseLock=python32.PyEval_ReleaseLock
+ PyEval_ReleaseThread=python32.PyEval_ReleaseThread
+ PyEval_RestoreThread=python32.PyEval_RestoreThread
+ PyEval_SaveThread=python32.PyEval_SaveThread
+ PyEval_ThreadsInitialized=python32.PyEval_ThreadsInitialized
+ PyExc_ArithmeticError=python32.PyExc_ArithmeticError DATA
+ PyExc_AssertionError=python32.PyExc_AssertionError DATA
+ PyExc_AttributeError=python32.PyExc_AttributeError DATA
+ PyExc_BaseException=python32.PyExc_BaseException DATA
+ PyExc_BufferError=python32.PyExc_BufferError DATA
+ PyExc_BytesWarning=python32.PyExc_BytesWarning DATA
+ PyExc_DeprecationWarning=python32.PyExc_DeprecationWarning DATA
+ PyExc_EOFError=python32.PyExc_EOFError DATA
+ PyExc_EnvironmentError=python32.PyExc_EnvironmentError DATA
+ PyExc_Exception=python32.PyExc_Exception DATA
+ PyExc_FloatingPointError=python32.PyExc_FloatingPointError DATA
+ PyExc_FutureWarning=python32.PyExc_FutureWarning DATA
+ PyExc_GeneratorExit=python32.PyExc_GeneratorExit DATA
+ PyExc_IOError=python32.PyExc_IOError DATA
+ PyExc_ImportError=python32.PyExc_ImportError DATA
+ PyExc_ImportWarning=python32.PyExc_ImportWarning DATA
+ PyExc_IndentationError=python32.PyExc_IndentationError DATA
+ PyExc_IndexError=python32.PyExc_IndexError DATA
+ PyExc_KeyError=python32.PyExc_KeyError DATA
+ PyExc_KeyboardInterrupt=python32.PyExc_KeyboardInterrupt DATA
+ PyExc_LookupError=python32.PyExc_LookupError DATA
+ PyExc_MemoryError=python32.PyExc_MemoryError DATA
+ PyExc_MemoryErrorInst=python32.PyExc_MemoryErrorInst DATA
+ PyExc_NameError=python32.PyExc_NameError DATA
+ PyExc_NotImplementedError=python32.PyExc_NotImplementedError DATA
+ PyExc_OSError=python32.PyExc_OSError DATA
+ PyExc_OverflowError=python32.PyExc_OverflowError DATA
+ PyExc_PendingDeprecationWarning=python32.PyExc_PendingDeprecationWarning DATA
+ PyExc_RecursionErrorInst=python32.PyExc_RecursionErrorInst DATA
+ PyExc_ReferenceError=python32.PyExc_ReferenceError DATA
+ PyExc_RuntimeError=python32.PyExc_RuntimeError DATA
+ PyExc_RuntimeWarning=python32.PyExc_RuntimeWarning DATA
+ PyExc_StopIteration=python32.PyExc_StopIteration DATA
+ PyExc_SyntaxError=python32.PyExc_SyntaxError DATA
+ PyExc_SyntaxWarning=python32.PyExc_SyntaxWarning DATA
+ PyExc_SystemError=python32.PyExc_SystemError DATA
+ PyExc_SystemExit=python32.PyExc_SystemExit DATA
+ PyExc_TabError=python32.PyExc_TabError DATA
+ PyExc_TypeError=python32.PyExc_TypeError DATA
+ PyExc_UnboundLocalError=python32.PyExc_UnboundLocalError DATA
+ PyExc_UnicodeDecodeError=python32.PyExc_UnicodeDecodeError DATA
+ PyExc_UnicodeEncodeError=python32.PyExc_UnicodeEncodeError DATA
+ PyExc_UnicodeError=python32.PyExc_UnicodeError DATA
+ PyExc_UnicodeTranslateError=python32.PyExc_UnicodeTranslateError DATA
+ PyExc_UnicodeWarning=python32.PyExc_UnicodeWarning DATA
+ PyExc_UserWarning=python32.PyExc_UserWarning DATA
+ PyExc_ValueError=python32.PyExc_ValueError DATA
+ PyExc_Warning=python32.PyExc_Warning DATA
+ PyExc_ZeroDivisionError=python32.PyExc_ZeroDivisionError DATA
+ PyException_GetCause=python32.PyException_GetCause
+ PyException_GetContext=python32.PyException_GetContext
+ PyException_GetTraceback=python32.PyException_GetTraceback
+ PyException_SetCause=python32.PyException_SetCause
+ PyException_SetContext=python32.PyException_SetContext
+ PyException_SetTraceback=python32.PyException_SetTraceback
+ PyFile_FromFd=python32.PyFile_FromFd
+ PyFile_GetLine=python32.PyFile_GetLine
+ PyFile_WriteObject=python32.PyFile_WriteObject
+ PyFile_WriteString=python32.PyFile_WriteString
+ PyFilter_Type=python32.PyFilter_Type DATA
+ PyFloat_AsDouble=python32.PyFloat_AsDouble
+ PyFloat_FromDouble=python32.PyFloat_FromDouble
+ PyFloat_FromString=python32.PyFloat_FromString
+ PyFloat_GetInfo=python32.PyFloat_GetInfo
+ PyFloat_GetMax=python32.PyFloat_GetMax
+ PyFloat_GetMin=python32.PyFloat_GetMin
+ PyFloat_Type=python32.PyFloat_Type DATA
+ PyFrozenSet_New=python32.PyFrozenSet_New
+ PyFrozenSet_Type=python32.PyFrozenSet_Type DATA
+ PyGC_Collect=python32.PyGC_Collect
+ PyGILState_Ensure=python32.PyGILState_Ensure
+ PyGILState_GetThisThreadState=python32.PyGILState_GetThisThreadState
+ PyGILState_Release=python32.PyGILState_Release
+ PyGetSetDescr_Type=python32.PyGetSetDescr_Type DATA
+ PyImport_AddModule=python32.PyImport_AddModule
+ PyImport_AppendInittab=python32.PyImport_AppendInittab
+ PyImport_Cleanup=python32.PyImport_Cleanup
+ PyImport_ExecCodeModule=python32.PyImport_ExecCodeModule
+ PyImport_ExecCodeModuleEx=python32.PyImport_ExecCodeModuleEx
+ PyImport_ExecCodeModuleWithPathnames=python32.PyImport_ExecCodeModuleWithPathnames
+ PyImport_GetImporter=python32.PyImport_GetImporter
+ PyImport_GetMagicNumber=python32.PyImport_GetMagicNumber
+ PyImport_GetMagicTag=python32.PyImport_GetMagicTag
+ PyImport_GetModuleDict=python32.PyImport_GetModuleDict
+ PyImport_Import=python32.PyImport_Import
+ PyImport_ImportFrozenModule=python32.PyImport_ImportFrozenModule
+ PyImport_ImportModule=python32.PyImport_ImportModule
+ PyImport_ImportModuleLevel=python32.PyImport_ImportModuleLevel
+ PyImport_ImportModuleNoBlock=python32.PyImport_ImportModuleNoBlock
+ PyImport_ReloadModule=python32.PyImport_ReloadModule
+ PyInterpreterState_Clear=python32.PyInterpreterState_Clear
+ PyInterpreterState_Delete=python32.PyInterpreterState_Delete
+ PyInterpreterState_New=python32.PyInterpreterState_New
+ PyIter_Next=python32.PyIter_Next
+ PyListIter_Type=python32.PyListIter_Type DATA
+ PyListRevIter_Type=python32.PyListRevIter_Type DATA
+ PyList_Append=python32.PyList_Append
+ PyList_AsTuple=python32.PyList_AsTuple
+ PyList_GetItem=python32.PyList_GetItem
+ PyList_GetSlice=python32.PyList_GetSlice
+ PyList_Insert=python32.PyList_Insert
+ PyList_New=python32.PyList_New
+ PyList_Reverse=python32.PyList_Reverse
+ PyList_SetItem=python32.PyList_SetItem
+ PyList_SetSlice=python32.PyList_SetSlice
+ PyList_Size=python32.PyList_Size
+ PyList_Sort=python32.PyList_Sort
+ PyList_Type=python32.PyList_Type DATA
+ PyLongRangeIter_Type=python32.PyLongRangeIter_Type DATA
+ PyLong_AsDouble=python32.PyLong_AsDouble
+ PyLong_AsLong=python32.PyLong_AsLong
+ PyLong_AsLongAndOverflow=python32.PyLong_AsLongAndOverflow
+ PyLong_AsLongLong=python32.PyLong_AsLongLong
+ PyLong_AsLongLongAndOverflow=python32.PyLong_AsLongLongAndOverflow
+ PyLong_AsSize_t=python32.PyLong_AsSize_t
+ PyLong_AsSsize_t=python32.PyLong_AsSsize_t
+ PyLong_AsUnsignedLong=python32.PyLong_AsUnsignedLong
+ PyLong_AsUnsignedLongLong=python32.PyLong_AsUnsignedLongLong
+ PyLong_AsUnsignedLongLongMask=python32.PyLong_AsUnsignedLongLongMask
+ PyLong_AsUnsignedLongMask=python32.PyLong_AsUnsignedLongMask
+ PyLong_AsVoidPtr=python32.PyLong_AsVoidPtr
+ PyLong_FromDouble=python32.PyLong_FromDouble
+ PyLong_FromLong=python32.PyLong_FromLong
+ PyLong_FromLongLong=python32.PyLong_FromLongLong
+ PyLong_FromSize_t=python32.PyLong_FromSize_t
+ PyLong_FromSsize_t=python32.PyLong_FromSsize_t
+ PyLong_FromString=python32.PyLong_FromString
+ PyLong_FromUnsignedLong=python32.PyLong_FromUnsignedLong
+ PyLong_FromUnsignedLongLong=python32.PyLong_FromUnsignedLongLong
+ PyLong_FromVoidPtr=python32.PyLong_FromVoidPtr
+ PyLong_GetInfo=python32.PyLong_GetInfo
+ PyLong_Type=python32.PyLong_Type DATA
+ PyMap_Type=python32.PyMap_Type DATA
+ PyMapping_Check=python32.PyMapping_Check
+ PyMapping_GetItemString=python32.PyMapping_GetItemString
+ PyMapping_HasKey=python32.PyMapping_HasKey
+ PyMapping_HasKeyString=python32.PyMapping_HasKeyString
+ PyMapping_Items=python32.PyMapping_Items
+ PyMapping_Keys=python32.PyMapping_Keys
+ PyMapping_Length=python32.PyMapping_Length
+ PyMapping_SetItemString=python32.PyMapping_SetItemString
+ PyMapping_Size=python32.PyMapping_Size
+ PyMapping_Values=python32.PyMapping_Values
+ PyMem_Free=python32.PyMem_Free
+ PyMem_Malloc=python32.PyMem_Malloc
+ PyMem_Realloc=python32.PyMem_Realloc
+ PyMemberDescr_Type=python32.PyMemberDescr_Type DATA
+ PyMemoryView_FromBuffer=python32.PyMemoryView_FromBuffer
+ PyMemoryView_FromObject=python32.PyMemoryView_FromObject
+ PyMemoryView_GetContiguous=python32.PyMemoryView_GetContiguous
+ PyMemoryView_Type=python32.PyMemoryView_Type DATA
+ PyMethodDescr_Type=python32.PyMethodDescr_Type DATA
+ PyModule_AddIntConstant=python32.PyModule_AddIntConstant
+ PyModule_AddObject=python32.PyModule_AddObject
+ PyModule_AddStringConstant=python32.PyModule_AddStringConstant
+ PyModule_Create2=python32.PyModule_Create2
+ PyModule_GetDef=python32.PyModule_GetDef
+ PyModule_GetDict=python32.PyModule_GetDict
+ PyModule_GetFilename=python32.PyModule_GetFilename
+ PyModule_GetFilenameObject=python32.PyModule_GetFilenameObject
+ PyModule_GetName=python32.PyModule_GetName
+ PyModule_GetState=python32.PyModule_GetState
+ PyModule_New=python32.PyModule_New
+ PyModule_Type=python32.PyModule_Type DATA
+ PyNullImporter_Type=python32.PyNullImporter_Type DATA
+ PyNumber_Absolute=python32.PyNumber_Absolute
+ PyNumber_Add=python32.PyNumber_Add
+ PyNumber_And=python32.PyNumber_And
+ PyNumber_AsSsize_t=python32.PyNumber_AsSsize_t
+ PyNumber_Check=python32.PyNumber_Check
+ PyNumber_Divmod=python32.PyNumber_Divmod
+ PyNumber_Float=python32.PyNumber_Float
+ PyNumber_FloorDivide=python32.PyNumber_FloorDivide
+ PyNumber_InPlaceAdd=python32.PyNumber_InPlaceAdd
+ PyNumber_InPlaceAnd=python32.PyNumber_InPlaceAnd
+ PyNumber_InPlaceFloorDivide=python32.PyNumber_InPlaceFloorDivide
+ PyNumber_InPlaceLshift=python32.PyNumber_InPlaceLshift
+ PyNumber_InPlaceMultiply=python32.PyNumber_InPlaceMultiply
+ PyNumber_InPlaceOr=python32.PyNumber_InPlaceOr
+ PyNumber_InPlacePower=python32.PyNumber_InPlacePower
+ PyNumber_InPlaceRemainder=python32.PyNumber_InPlaceRemainder
+ PyNumber_InPlaceRshift=python32.PyNumber_InPlaceRshift
+ PyNumber_InPlaceSubtract=python32.PyNumber_InPlaceSubtract
+ PyNumber_InPlaceTrueDivide=python32.PyNumber_InPlaceTrueDivide
+ PyNumber_InPlaceXor=python32.PyNumber_InPlaceXor
+ PyNumber_Index=python32.PyNumber_Index
+ PyNumber_Invert=python32.PyNumber_Invert
+ PyNumber_Long=python32.PyNumber_Long
+ PyNumber_Lshift=python32.PyNumber_Lshift
+ PyNumber_Multiply=python32.PyNumber_Multiply
+ PyNumber_Negative=python32.PyNumber_Negative
+ PyNumber_Or=python32.PyNumber_Or
+ PyNumber_Positive=python32.PyNumber_Positive
+ PyNumber_Power=python32.PyNumber_Power
+ PyNumber_Remainder=python32.PyNumber_Remainder
+ PyNumber_Rshift=python32.PyNumber_Rshift
+ PyNumber_Subtract=python32.PyNumber_Subtract
+ PyNumber_ToBase=python32.PyNumber_ToBase
+ PyNumber_TrueDivide=python32.PyNumber_TrueDivide
+ PyNumber_Xor=python32.PyNumber_Xor
+ PyOS_AfterFork=python32.PyOS_AfterFork
+ PyOS_InitInterrupts=python32.PyOS_InitInterrupts
+ PyOS_InputHook=python32.PyOS_InputHook DATA
+ PyOS_InterruptOccurred=python32.PyOS_InterruptOccurred
+ PyOS_ReadlineFunctionPointer=python32.PyOS_ReadlineFunctionPointer DATA
+ PyOS_double_to_string=python32.PyOS_double_to_string
+ PyOS_getsig=python32.PyOS_getsig
+ PyOS_mystricmp=python32.PyOS_mystricmp
+ PyOS_mystrnicmp=python32.PyOS_mystrnicmp
+ PyOS_setsig=python32.PyOS_setsig
+ PyOS_snprintf=python32.PyOS_snprintf
+ PyOS_string_to_double=python32.PyOS_string_to_double
+ PyOS_strtol=python32.PyOS_strtol
+ PyOS_strtoul=python32.PyOS_strtoul
+ PyOS_vsnprintf=python32.PyOS_vsnprintf
+ PyObject_ASCII=python32.PyObject_ASCII
+ PyObject_AsCharBuffer=python32.PyObject_AsCharBuffer
+ PyObject_AsFileDescriptor=python32.PyObject_AsFileDescriptor
+ PyObject_AsReadBuffer=python32.PyObject_AsReadBuffer
+ PyObject_AsWriteBuffer=python32.PyObject_AsWriteBuffer
+ PyObject_Bytes=python32.PyObject_Bytes
+ PyObject_Call=python32.PyObject_Call
+ PyObject_CallFunction=python32.PyObject_CallFunction
+ PyObject_CallFunctionObjArgs=python32.PyObject_CallFunctionObjArgs
+ PyObject_CallMethod=python32.PyObject_CallMethod
+ PyObject_CallMethodObjArgs=python32.PyObject_CallMethodObjArgs
+ PyObject_CallObject=python32.PyObject_CallObject
+ PyObject_CheckReadBuffer=python32.PyObject_CheckReadBuffer
+ PyObject_ClearWeakRefs=python32.PyObject_ClearWeakRefs
+ PyObject_CopyData=python32.PyObject_CopyData
+ PyObject_DelItem=python32.PyObject_DelItem
+ PyObject_DelItemString=python32.PyObject_DelItemString
+ PyObject_Dir=python32.PyObject_Dir
+ PyObject_Format=python32.PyObject_Format
+ PyObject_Free=python32.PyObject_Free
+ PyObject_GC_Del=python32.PyObject_GC_Del
+ PyObject_GC_Track=python32.PyObject_GC_Track
+ PyObject_GC_UnTrack=python32.PyObject_GC_UnTrack
+ PyObject_GenericGetAttr=python32.PyObject_GenericGetAttr
+ PyObject_GenericSetAttr=python32.PyObject_GenericSetAttr
+ PyObject_GetAttr=python32.PyObject_GetAttr
+ PyObject_GetAttrString=python32.PyObject_GetAttrString
+ PyObject_GetBuffer=python32.PyObject_GetBuffer
+ PyObject_GetItem=python32.PyObject_GetItem
+ PyObject_GetIter=python32.PyObject_GetIter
+ PyObject_HasAttr=python32.PyObject_HasAttr
+ PyObject_HasAttrString=python32.PyObject_HasAttrString
+ PyObject_Hash=python32.PyObject_Hash
+ PyObject_HashNotImplemented=python32.PyObject_HashNotImplemented
+ PyObject_Init=python32.PyObject_Init
+ PyObject_InitVar=python32.PyObject_InitVar
+ PyObject_IsInstance=python32.PyObject_IsInstance
+ PyObject_IsSubclass=python32.PyObject_IsSubclass
+ PyObject_IsTrue=python32.PyObject_IsTrue
+ PyObject_Length=python32.PyObject_Length
+ PyObject_Malloc=python32.PyObject_Malloc
+ PyObject_Not=python32.PyObject_Not
+ PyObject_Realloc=python32.PyObject_Realloc
+ PyObject_Repr=python32.PyObject_Repr
+ PyObject_RichCompare=python32.PyObject_RichCompare
+ PyObject_RichCompareBool=python32.PyObject_RichCompareBool
+ PyObject_SelfIter=python32.PyObject_SelfIter
+ PyObject_SetAttr=python32.PyObject_SetAttr
+ PyObject_SetAttrString=python32.PyObject_SetAttrString
+ PyObject_SetItem=python32.PyObject_SetItem
+ PyObject_Size=python32.PyObject_Size
+ PyObject_Str=python32.PyObject_Str
+ PyObject_Type=python32.PyObject_Type DATA
+ PyParser_SimpleParseFileFlags=python32.PyParser_SimpleParseFileFlags
+ PyParser_SimpleParseStringFlags=python32.PyParser_SimpleParseStringFlags
+ PyProperty_Type=python32.PyProperty_Type DATA
+ PyRangeIter_Type=python32.PyRangeIter_Type DATA
+ PyRange_Type=python32.PyRange_Type DATA
+ PyReversed_Type=python32.PyReversed_Type DATA
+ PySeqIter_New=python32.PySeqIter_New
+ PySeqIter_Type=python32.PySeqIter_Type DATA
+ PySequence_Check=python32.PySequence_Check
+ PySequence_Concat=python32.PySequence_Concat
+ PySequence_Contains=python32.PySequence_Contains
+ PySequence_Count=python32.PySequence_Count
+ PySequence_DelItem=python32.PySequence_DelItem
+ PySequence_DelSlice=python32.PySequence_DelSlice
+ PySequence_Fast=python32.PySequence_Fast
+ PySequence_GetItem=python32.PySequence_GetItem
+ PySequence_GetSlice=python32.PySequence_GetSlice
+ PySequence_In=python32.PySequence_In
+ PySequence_InPlaceConcat=python32.PySequence_InPlaceConcat
+ PySequence_InPlaceRepeat=python32.PySequence_InPlaceRepeat
+ PySequence_Index=python32.PySequence_Index
+ PySequence_Length=python32.PySequence_Length
+ PySequence_List=python32.PySequence_List
+ PySequence_Repeat=python32.PySequence_Repeat
+ PySequence_SetItem=python32.PySequence_SetItem
+ PySequence_SetSlice=python32.PySequence_SetSlice
+ PySequence_Size=python32.PySequence_Size
+ PySequence_Tuple=python32.PySequence_Tuple
+ PySetIter_Type=python32.PySetIter_Type DATA
+ PySet_Add=python32.PySet_Add
+ PySet_Clear=python32.PySet_Clear
+ PySet_Contains=python32.PySet_Contains
+ PySet_Discard=python32.PySet_Discard
+ PySet_New=python32.PySet_New
+ PySet_Pop=python32.PySet_Pop
+ PySet_Size=python32.PySet_Size
+ PySet_Type=python32.PySet_Type DATA
+ PySlice_GetIndices=python32.PySlice_GetIndices
+ PySlice_GetIndicesEx=python32.PySlice_GetIndicesEx
+ PySlice_New=python32.PySlice_New
+ PySlice_Type=python32.PySlice_Type DATA
+ PySortWrapper_Type=python32.PySortWrapper_Type DATA
+ PyState_FindModule=python32.PyState_FindModule
+ PyStructSequence_GetItem=python32.PyStructSequence_GetItem
+ PyStructSequence_New=python32.PyStructSequence_New
+ PyStructSequence_NewType=python32.PyStructSequence_NewType
+ PyStructSequence_SetItem=python32.PyStructSequence_SetItem
+ PySuper_Type=python32.PySuper_Type DATA
+ PySys_AddWarnOption=python32.PySys_AddWarnOption
+ PySys_AddWarnOptionUnicode=python32.PySys_AddWarnOptionUnicode
+ PySys_FormatStderr=python32.PySys_FormatStderr
+ PySys_FormatStdout=python32.PySys_FormatStdout
+ PySys_GetObject=python32.PySys_GetObject
+ PySys_HasWarnOptions=python32.PySys_HasWarnOptions
+ PySys_ResetWarnOptions=python32.PySys_ResetWarnOptions
+ PySys_SetArgv=python32.PySys_SetArgv
+ PySys_SetArgvEx=python32.PySys_SetArgvEx
+ PySys_SetObject=python32.PySys_SetObject
+ PySys_SetPath=python32.PySys_SetPath
+ PySys_WriteStderr=python32.PySys_WriteStderr
+ PySys_WriteStdout=python32.PySys_WriteStdout
+ PyThreadState_Clear=python32.PyThreadState_Clear
+ PyThreadState_Delete=python32.PyThreadState_Delete
+ PyThreadState_DeleteCurrent=python32.PyThreadState_DeleteCurrent
+ PyThreadState_Get=python32.PyThreadState_Get
+ PyThreadState_GetDict=python32.PyThreadState_GetDict
+ PyThreadState_New=python32.PyThreadState_New
+ PyThreadState_SetAsyncExc=python32.PyThreadState_SetAsyncExc
+ PyThreadState_Swap=python32.PyThreadState_Swap
+ PyTraceBack_Here=python32.PyTraceBack_Here
+ PyTraceBack_Print=python32.PyTraceBack_Print
+ PyTraceBack_Type=python32.PyTraceBack_Type DATA
+ PyTupleIter_Type=python32.PyTupleIter_Type DATA
+ PyTuple_ClearFreeList=python32.PyTuple_ClearFreeList
+ PyTuple_GetItem=python32.PyTuple_GetItem
+ PyTuple_GetSlice=python32.PyTuple_GetSlice
+ PyTuple_New=python32.PyTuple_New
+ PyTuple_Pack=python32.PyTuple_Pack
+ PyTuple_SetItem=python32.PyTuple_SetItem
+ PyTuple_Size=python32.PyTuple_Size
+ PyTuple_Type=python32.PyTuple_Type DATA
+ PyType_ClearCache=python32.PyType_ClearCache
+ PyType_FromSpec=python32.PyType_FromSpec
+ PyType_GenericAlloc=python32.PyType_GenericAlloc
+ PyType_GenericNew=python32.PyType_GenericNew
+ PyType_IsSubtype=python32.PyType_IsSubtype
+ PyType_Modified=python32.PyType_Modified
+ PyType_Ready=python32.PyType_Ready
+ PyType_Type=python32.PyType_Type DATA
+ PyUnicodeDecodeError_Create=python32.PyUnicodeDecodeError_Create
+ PyUnicodeDecodeError_GetEncoding=python32.PyUnicodeDecodeError_GetEncoding
+ PyUnicodeDecodeError_GetEnd=python32.PyUnicodeDecodeError_GetEnd
+ PyUnicodeDecodeError_GetObject=python32.PyUnicodeDecodeError_GetObject
+ PyUnicodeDecodeError_GetReason=python32.PyUnicodeDecodeError_GetReason
+ PyUnicodeDecodeError_GetStart=python32.PyUnicodeDecodeError_GetStart
+ PyUnicodeDecodeError_SetEnd=python32.PyUnicodeDecodeError_SetEnd
+ PyUnicodeDecodeError_SetReason=python32.PyUnicodeDecodeError_SetReason
+ PyUnicodeDecodeError_SetStart=python32.PyUnicodeDecodeError_SetStart
+ PyUnicodeEncodeError_GetEncoding=python32.PyUnicodeEncodeError_GetEncoding
+ PyUnicodeEncodeError_GetEnd=python32.PyUnicodeEncodeError_GetEnd
+ PyUnicodeEncodeError_GetObject=python32.PyUnicodeEncodeError_GetObject
+ PyUnicodeEncodeError_GetReason=python32.PyUnicodeEncodeError_GetReason
+ PyUnicodeEncodeError_GetStart=python32.PyUnicodeEncodeError_GetStart
+ PyUnicodeEncodeError_SetEnd=python32.PyUnicodeEncodeError_SetEnd
+ PyUnicodeEncodeError_SetReason=python32.PyUnicodeEncodeError_SetReason
+ PyUnicodeEncodeError_SetStart=python32.PyUnicodeEncodeError_SetStart
+ PyUnicodeIter_Type=python32.PyUnicodeIter_Type DATA
+ PyUnicodeTranslateError_GetEnd=python32.PyUnicodeTranslateError_GetEnd
+ PyUnicodeTranslateError_GetObject=python32.PyUnicodeTranslateError_GetObject
+ PyUnicodeTranslateError_GetReason=python32.PyUnicodeTranslateError_GetReason
+ PyUnicodeTranslateError_GetStart=python32.PyUnicodeTranslateError_GetStart
+ PyUnicodeTranslateError_SetEnd=python32.PyUnicodeTranslateError_SetEnd
+ PyUnicodeTranslateError_SetReason=python32.PyUnicodeTranslateError_SetReason
+ PyUnicodeTranslateError_SetStart=python32.PyUnicodeTranslateError_SetStart
+ PyUnicode_Append=python32.PyUnicodeUCS2_Append
+ PyUnicode_AppendAndDel=python32.PyUnicodeUCS2_AppendAndDel
+ PyUnicode_AsASCIIString=python32.PyUnicodeUCS2_AsASCIIString
+ PyUnicode_AsCharmapString=python32.PyUnicodeUCS2_AsCharmapString
+ PyUnicode_AsDecodedObject=python32.PyUnicodeUCS2_AsDecodedObject
+ PyUnicode_AsDecodedUnicode=python32.PyUnicodeUCS2_AsDecodedUnicode
+ PyUnicode_AsEncodedObject=python32.PyUnicodeUCS2_AsEncodedObject
+ PyUnicode_AsEncodedString=python32.PyUnicodeUCS2_AsEncodedString
+ PyUnicode_AsEncodedUnicode=python32.PyUnicodeUCS2_AsEncodedUnicode
+ PyUnicode_AsLatin1String=python32.PyUnicodeUCS2_AsLatin1String
+ PyUnicode_AsRawUnicodeEscapeString=python32.PyUnicodeUCS2_AsRawUnicodeEscapeString
+ PyUnicode_AsUTF16String=python32.PyUnicodeUCS2_AsUTF16String
+ PyUnicode_AsUTF32String=python32.PyUnicodeUCS2_AsUTF32String
+ PyUnicode_AsUTF8String=python32.PyUnicodeUCS2_AsUTF8String
+ PyUnicode_AsUnicodeEscapeString=python32.PyUnicodeUCS2_AsUnicodeEscapeString
+ PyUnicode_AsWideChar=python32.PyUnicodeUCS2_AsWideChar
+ PyUnicode_ClearFreelist=python32.PyUnicodeUCS2_ClearFreelist
+ PyUnicode_Compare=python32.PyUnicodeUCS2_Compare
+ PyUnicode_Concat=python32.PyUnicodeUCS2_Concat
+ PyUnicode_Contains=python32.PyUnicodeUCS2_Contains
+ PyUnicode_Count=python32.PyUnicodeUCS2_Count
+ PyUnicode_Decode=python32.PyUnicodeUCS2_Decode
+ PyUnicode_DecodeASCII=python32.PyUnicodeUCS2_DecodeASCII
+ PyUnicode_DecodeCharmap=python32.PyUnicodeUCS2_DecodeCharmap
+ PyUnicode_DecodeFSDefault=python32.PyUnicodeUCS2_DecodeFSDefault
+ PyUnicode_DecodeFSDefaultAndSize=python32.PyUnicodeUCS2_DecodeFSDefaultAndSize
+ PyUnicode_DecodeLatin1=python32.PyUnicodeUCS2_DecodeLatin1
+ PyUnicode_DecodeRawUnicodeEscape=python32.PyUnicodeUCS2_DecodeRawUnicodeEscape
+ PyUnicode_DecodeUTF16=python32.PyUnicodeUCS2_DecodeUTF16
+ PyUnicode_DecodeUTF16Stateful=python32.PyUnicodeUCS2_DecodeUTF16Stateful
+ PyUnicode_DecodeUTF32=python32.PyUnicodeUCS2_DecodeUTF32
+ PyUnicode_DecodeUTF32Stateful=python32.PyUnicodeUCS2_DecodeUTF32Stateful
+ PyUnicode_DecodeUTF8=python32.PyUnicodeUCS2_DecodeUTF8
+ PyUnicode_DecodeUTF8Stateful=python32.PyUnicodeUCS2_DecodeUTF8Stateful
+ PyUnicode_DecodeUnicodeEscape=python32.PyUnicodeUCS2_DecodeUnicodeEscape
+ PyUnicode_FSConverter=python32.PyUnicodeUCS2_FSConverter
+ PyUnicode_FSDecoder=python32.PyUnicodeUCS2_FSDecoder
+ PyUnicode_Find=python32.PyUnicodeUCS2_Find
+ PyUnicode_Format=python32.PyUnicodeUCS2_Format
+ PyUnicode_FromEncodedObject=python32.PyUnicodeUCS2_FromEncodedObject
+ PyUnicode_FromFormat=python32.PyUnicodeUCS2_FromFormat
+ PyUnicode_FromFormatV=python32.PyUnicodeUCS2_FromFormatV
+ PyUnicode_FromObject=python32.PyUnicodeUCS2_FromObject
+ PyUnicode_FromOrdinal=python32.PyUnicodeUCS2_FromOrdinal
+ PyUnicode_FromString=python32.PyUnicodeUCS2_FromString
+ PyUnicode_FromStringAndSize=python32.PyUnicodeUCS2_FromStringAndSize
+ PyUnicode_FromWideChar=python32.PyUnicodeUCS2_FromWideChar
+ PyUnicode_GetDefaultEncoding=python32.PyUnicodeUCS2_GetDefaultEncoding
+ PyUnicode_GetSize=python32.PyUnicodeUCS2_GetSize
+ PyUnicode_IsIdentifier=python32.PyUnicodeUCS2_IsIdentifier
+ PyUnicode_Join=python32.PyUnicodeUCS2_Join
+ PyUnicode_Partition=python32.PyUnicodeUCS2_Partition
+ PyUnicode_RPartition=python32.PyUnicodeUCS2_RPartition
+ PyUnicode_RSplit=python32.PyUnicodeUCS2_RSplit
+ PyUnicode_Replace=python32.PyUnicodeUCS2_Replace
+ PyUnicode_Resize=python32.PyUnicodeUCS2_Resize
+ PyUnicode_RichCompare=python32.PyUnicodeUCS2_RichCompare
+ PyUnicode_SetDefaultEncoding=python32.PyUnicodeUCS2_SetDefaultEncoding
+ PyUnicode_Split=python32.PyUnicodeUCS2_Split
+ PyUnicode_Splitlines=python32.PyUnicodeUCS2_Splitlines
+ PyUnicode_Tailmatch=python32.PyUnicodeUCS2_Tailmatch
+ PyUnicode_Translate=python32.PyUnicodeUCS2_Translate
+ PyUnicode_BuildEncodingMap=python32.PyUnicode_BuildEncodingMap
+ PyUnicode_CompareWithASCIIString=python32.PyUnicode_CompareWithASCIIString
+ PyUnicode_DecodeUTF7=python32.PyUnicode_DecodeUTF7
+ PyUnicode_DecodeUTF7Stateful=python32.PyUnicode_DecodeUTF7Stateful
+ PyUnicode_EncodeFSDefault=python32.PyUnicode_EncodeFSDefault
+ PyUnicode_InternFromString=python32.PyUnicode_InternFromString
+ PyUnicode_InternImmortal=python32.PyUnicode_InternImmortal
+ PyUnicode_InternInPlace=python32.PyUnicode_InternInPlace
+ PyUnicode_Type=python32.PyUnicode_Type DATA
+ PyWeakref_GetObject=python32.PyWeakref_GetObject DATA
+ PyWeakref_NewProxy=python32.PyWeakref_NewProxy
+ PyWeakref_NewRef=python32.PyWeakref_NewRef
+ PyWrapperDescr_Type=python32.PyWrapperDescr_Type DATA
+ PyWrapper_New=python32.PyWrapper_New
+ PyZip_Type=python32.PyZip_Type DATA
+ Py_AddPendingCall=python32.Py_AddPendingCall
+ Py_AtExit=python32.Py_AtExit
+ Py_BuildValue=python32.Py_BuildValue
+ Py_CompileStringFlags=python32.Py_CompileStringFlags
+ Py_DecRef=python32.Py_DecRef
+ Py_EndInterpreter=python32.Py_EndInterpreter
+ Py_Exit=python32.Py_Exit
+ Py_FatalError=python32.Py_FatalError
+ Py_FileSystemDefaultEncoding=python32.Py_FileSystemDefaultEncoding DATA
+ Py_Finalize=python32.Py_Finalize
+ Py_GetBuildInfo=python32.Py_GetBuildInfo
+ Py_GetCompiler=python32.Py_GetCompiler
+ Py_GetCopyright=python32.Py_GetCopyright
+ Py_GetExecPrefix=python32.Py_GetExecPrefix
+ Py_GetPath=python32.Py_GetPath
+ Py_GetPlatform=python32.Py_GetPlatform
+ Py_GetPrefix=python32.Py_GetPrefix
+ Py_GetProgramFullPath=python32.Py_GetProgramFullPath
+ Py_GetProgramName=python32.Py_GetProgramName
+ Py_GetPythonHome=python32.Py_GetPythonHome
+ Py_GetRecursionLimit=python32.Py_GetRecursionLimit
+ Py_GetVersion=python32.Py_GetVersion
+ Py_HasFileSystemDefaultEncoding=python32.Py_HasFileSystemDefaultEncoding DATA
+ Py_IncRef=python32.Py_IncRef
+ Py_Initialize=python32.Py_Initialize
+ Py_InitializeEx=python32.Py_InitializeEx
+ Py_IsInitialized=python32.Py_IsInitialized
+ Py_Main=python32.Py_Main
+ Py_MakePendingCalls=python32.Py_MakePendingCalls
+ Py_NewInterpreter=python32.Py_NewInterpreter
+ Py_ReprEnter=python32.Py_ReprEnter
+ Py_ReprLeave=python32.Py_ReprLeave
+ Py_SetProgramName=python32.Py_SetProgramName
+ Py_SetPythonHome=python32.Py_SetPythonHome
+ Py_SetRecursionLimit=python32.Py_SetRecursionLimit
+ Py_SymtableString=python32.Py_SymtableString
+ Py_VaBuildValue=python32.Py_VaBuildValue
+ _PyErr_BadInternalCall=python32._PyErr_BadInternalCall
+ _PyObject_CallFunction_SizeT=python32._PyObject_CallFunction_SizeT
+ _PyObject_CallMethod_SizeT=python32._PyObject_CallMethod_SizeT
+ _PyObject_GC_Malloc=python32._PyObject_GC_Malloc
+ _PyObject_GC_New=python32._PyObject_GC_New
+ _PyObject_GC_NewVar=python32._PyObject_GC_NewVar
+ _PyObject_GC_Resize=python32._PyObject_GC_Resize
+ _PyObject_New=python32._PyObject_New
+ _PyObject_NewVar=python32._PyObject_NewVar
+ _PyState_AddModule=python32._PyState_AddModule
+ _PyThreadState_Init=python32._PyThreadState_Init
+ _PyThreadState_Prealloc=python32._PyThreadState_Prealloc
+ _PyTrash_delete_later=python32._PyTrash_delete_later DATA
+ _PyTrash_delete_nesting=python32._PyTrash_delete_nesting DATA
+ _PyTrash_deposit_object=python32._PyTrash_deposit_object
+ _PyTrash_destroy_chain=python32._PyTrash_destroy_chain
+ _PyWeakref_CallableProxyType=python32._PyWeakref_CallableProxyType DATA
+ _PyWeakref_ProxyType=python32._PyWeakref_ProxyType DATA
+ _PyWeakref_RefType=python32._PyWeakref_RefType DATA
+ _Py_BuildValue_SizeT=python32._Py_BuildValue_SizeT
+ _Py_CheckRecursionLimit=python32._Py_CheckRecursionLimit DATA
+ _Py_CheckRecursiveCall=python32._Py_CheckRecursiveCall
+ _Py_Dealloc=python32._Py_Dealloc
+ _Py_EllipsisObject=python32._Py_EllipsisObject DATA
+ _Py_FalseStruct=python32._Py_FalseStruct DATA
+ _Py_NoneStruct=python32.Py_GetCopyright
+ _Py_NotImplementedStruct=python32._Py_NotImplementedStruct DATA
+ _Py_SwappedOp=python32._Py_SwappedOp DATA
+ _Py_TrueStruct=python32._Py_TrueStruct DATA
+ _Py_VaBuildValue_SizeT=python32._Py_VaBuildValue_SizeT
diff --git a/PC/python3dll.c b/PC/python3dll.c
new file mode 100644
index 0000000..b171fca
--- /dev/null
+++ b/PC/python3dll.c
@@ -0,0 +1,9 @@
+#include <windows.h>
+
+BOOL WINAPI
+DllMain(HINSTANCE hInstDLL,
+ DWORD fdwReason,
+ LPVOID lpReserved)
+{
+ return TRUE;
+}
\ No newline at end of file
diff --git a/PCbuild/pcbuild.sln b/PCbuild/pcbuild.sln
index 956a7ea..9e103a1 100644
--- a/PCbuild/pcbuild.sln
+++ b/PCbuild/pcbuild.sln
@@ -133,6 +133,13 @@
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "kill_python", "kill_python.vcproj", "{6DE10744-E396-40A5-B4E2-1B69AA7C8D31}"
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "python3dll", "python3dll.vcproj", "{885D4898-D08D-4091-9C40-C700CFE3FC5A}"
+ ProjectSection(ProjectDependencies) = postProject
+ {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xxlimited", "xxlimited.vcproj", "{F749B822-B489-4CA5-A3AD-CE078F5F338A}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@@ -553,6 +560,32 @@
{6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.Release|Win32.Build.0 = Release|Win32
{6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.Release|x64.ActiveCfg = Release|x64
{6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.Release|x64.Build.0 = Release|x64
+ {885D4898-D08D-4091-9C40-C700CFE3FC5A}.Debug|Win32.ActiveCfg = PGUpdate|Win32
+ {885D4898-D08D-4091-9C40-C700CFE3FC5A}.Debug|x64.ActiveCfg = PGUpdate|x64
+ {885D4898-D08D-4091-9C40-C700CFE3FC5A}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32
+ {885D4898-D08D-4091-9C40-C700CFE3FC5A}.PGInstrument|Win32.Build.0 = PGInstrument|Win32
+ {885D4898-D08D-4091-9C40-C700CFE3FC5A}.PGInstrument|x64.ActiveCfg = PGInstrument|x64
+ {885D4898-D08D-4091-9C40-C700CFE3FC5A}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32
+ {885D4898-D08D-4091-9C40-C700CFE3FC5A}.PGUpdate|Win32.Build.0 = PGUpdate|Win32
+ {885D4898-D08D-4091-9C40-C700CFE3FC5A}.PGUpdate|x64.ActiveCfg = PGUpdate|x64
+ {885D4898-D08D-4091-9C40-C700CFE3FC5A}.Release|Win32.ActiveCfg = Release|Win32
+ {885D4898-D08D-4091-9C40-C700CFE3FC5A}.Release|Win32.Build.0 = Release|Win32
+ {885D4898-D08D-4091-9C40-C700CFE3FC5A}.Release|x64.ActiveCfg = Release|x64
+ {F749B822-B489-4CA5-A3AD-CE078F5F338A}.Debug|Win32.ActiveCfg = PGUpdate|x64
+ {F749B822-B489-4CA5-A3AD-CE078F5F338A}.Debug|x64.ActiveCfg = PGUpdate|x64
+ {F749B822-B489-4CA5-A3AD-CE078F5F338A}.Debug|x64.Build.0 = PGUpdate|x64
+ {F749B822-B489-4CA5-A3AD-CE078F5F338A}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32
+ {F749B822-B489-4CA5-A3AD-CE078F5F338A}.PGInstrument|Win32.Build.0 = PGInstrument|Win32
+ {F749B822-B489-4CA5-A3AD-CE078F5F338A}.PGInstrument|x64.ActiveCfg = PGInstrument|x64
+ {F749B822-B489-4CA5-A3AD-CE078F5F338A}.PGInstrument|x64.Build.0 = PGInstrument|x64
+ {F749B822-B489-4CA5-A3AD-CE078F5F338A}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32
+ {F749B822-B489-4CA5-A3AD-CE078F5F338A}.PGUpdate|Win32.Build.0 = PGUpdate|Win32
+ {F749B822-B489-4CA5-A3AD-CE078F5F338A}.PGUpdate|x64.ActiveCfg = PGUpdate|x64
+ {F749B822-B489-4CA5-A3AD-CE078F5F338A}.PGUpdate|x64.Build.0 = PGUpdate|x64
+ {F749B822-B489-4CA5-A3AD-CE078F5F338A}.Release|Win32.ActiveCfg = Release|Win32
+ {F749B822-B489-4CA5-A3AD-CE078F5F338A}.Release|Win32.Build.0 = Release|Win32
+ {F749B822-B489-4CA5-A3AD-CE078F5F338A}.Release|x64.ActiveCfg = Release|x64
+ {F749B822-B489-4CA5-A3AD-CE078F5F338A}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/PCbuild/python3dll.vcproj b/PCbuild/python3dll.vcproj
new file mode 100644
index 0000000..8dcd90a
--- /dev/null
+++ b/PCbuild/python3dll.vcproj
@@ -0,0 +1,434 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9,00"
+ Name="python3dll"
+ ProjectGUID="{885D4898-D08D-4091-9C40-C700CFE3FC5A}"
+ RootNamespace="python3dll"
+ Keyword="Win32Proj"
+ TargetFrameworkVersion="196613"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ <Platform
+ Name="x64"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Release|Win32"
+ ConfigurationType="2"
+ InheritedPropertySheets=".\pyproject.vsprops;.\release.vsprops"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PYTHON3DLL_EXPORTS"
+ RuntimeLibrary="2"
+ BufferSecurityCheck="false"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="..\PC\python32.lib"
+ OutputFile="$(OutDir)\python3.dll"
+ LinkIncremental="1"
+ IgnoreAllDefaultLibraries="true"
+ ModuleDefinitionFile="..\PC\python3.def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ EntryPointSymbol="DllMain"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|x64"
+ ConfigurationType="2"
+ InheritedPropertySheets=".\pyproject.vsprops;.\x64.vsprops;.\release.vsprops"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="$(OutDir)\python3.dll"
+ ModuleDefinitionFile="..\PC\python3.def"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="PGInstrument|Win32"
+ ConfigurationType="2"
+ InheritedPropertySheets=".\pyproject.vsprops;.\release.vsprops;.\pginstrument.vsprops"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="python32.lib"
+ OutputFile="$(OutDir)\python3.dll"
+ ModuleDefinitionFile="..\PC\python3.def"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="PGInstrument|x64"
+ ConfigurationType="2"
+ InheritedPropertySheets=".\pyproject.vsprops;.\x64.vsprops;.\release.vsprops;.\pginstrument.vsprops"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="$(OutDir)\python3.dll"
+ ModuleDefinitionFile="..\PC\python3.def"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="PGUpdate|Win32"
+ ConfigurationType="2"
+ InheritedPropertySheets=".\pyproject.vsprops;.\release.vsprops;.\pgupdate.vsprops"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="python32.lib"
+ OutputFile="$(OutDir)\python3.dll"
+ ModuleDefinitionFile="..\PC\python3.def"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="PGUpdate|x64"
+ ConfigurationType="2"
+ InheritedPropertySheets=".\pyproject.vsprops;.\x64.vsprops;.\release.vsprops;.\pgupdate.vsprops"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="$(OutDir)\python3.dll"
+ ModuleDefinitionFile="..\PC\python3.def"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath="..\PC\python3.def"
+ >
+ </File>
+ <File
+ RelativePath="..\PC\python3dll.c"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+ >
+ <File
+ RelativePath="..\PC\python_nt.rc"
+ >
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/PCbuild/xxlimited.vcproj b/PCbuild/xxlimited.vcproj
new file mode 100644
index 0000000..dc923e8
--- /dev/null
+++ b/PCbuild/xxlimited.vcproj
@@ -0,0 +1,417 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9,00"
+ Name="xxlimited"
+ ProjectGUID="{F749B822-B489-4CA5-A3AD-CE078F5F338A}"
+ RootNamespace="xxlimited"
+ Keyword="Win32Proj"
+ TargetFrameworkVersion="196613"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ <Platform
+ Name="x64"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Release|Win32"
+ ConfigurationType="2"
+ InheritedPropertySheets=".\pyd.vsprops"
+ CharacterSet="0"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions="NDEBUG;_WIN32;_WINDLL;Py_LIMITED_API;$(NOINHERIT)"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="wsock32.lib"
+ IgnoreDefaultLibraryNames="libc"
+ BaseAddress="0x1D110000"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|x64"
+ ConfigurationType="2"
+ InheritedPropertySheets=".\pyd.vsprops;.\x64.vsprops"
+ CharacterSet="0"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="wsock32.lib"
+ IgnoreDefaultLibraryNames="libc"
+ BaseAddress="0x1D110000"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="PGInstrument|Win32"
+ ConfigurationType="2"
+ InheritedPropertySheets=".\pyd.vsprops;.\pginstrument.vsprops"
+ CharacterSet="0"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions="Py_LIMITED_API"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="wsock32.lib"
+ IgnoreDefaultLibraryNames="libc"
+ BaseAddress="0x1D110000"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="PGInstrument|x64"
+ ConfigurationType="2"
+ InheritedPropertySheets=".\pyd.vsprops;.\x64.vsprops;.\pginstrument.vsprops"
+ CharacterSet="0"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="wsock32.lib"
+ IgnoreDefaultLibraryNames="libc"
+ BaseAddress="0x1D110000"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="PGUpdate|Win32"
+ ConfigurationType="2"
+ InheritedPropertySheets=".\pyd.vsprops;.\pgupdate.vsprops"
+ CharacterSet="0"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions="Py_LIMITED_API"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="wsock32.lib"
+ IgnoreDefaultLibraryNames="libc"
+ BaseAddress="0x1D110000"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="PGUpdate|x64"
+ ConfigurationType="2"
+ InheritedPropertySheets=".\pyd.vsprops;.\x64.vsprops;.\pgupdate.vsprops"
+ CharacterSet="0"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="wsock32.lib"
+ IgnoreDefaultLibraryNames="libc"
+ BaseAddress="0x1D110000"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ >
+ <File
+ RelativePath="..\Modules\xxlimited.c"
+ >
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index f300ab2..765464a 100644
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -727,7 +727,7 @@
"code object passed to eval() may not contain free variables");
return NULL;
}
- return PyEval_EvalCode((PyCodeObject *) cmd, globals, locals);
+ return PyEval_EvalCode(cmd, globals, locals);
}
cf.cf_flags = PyCF_SOURCE_IS_UTF8;
@@ -803,7 +803,7 @@
"contain free variables");
return NULL;
}
- v = PyEval_EvalCode((PyCodeObject *) prog, globals, locals);
+ v = PyEval_EvalCode(prog, globals, locals);
}
else {
char *str;
diff --git a/Python/ceval.c b/Python/ceval.c
index 140112f..684c6c2 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -755,7 +755,7 @@
PyObject *
-PyEval_EvalCode(PyCodeObject *co, PyObject *globals, PyObject *locals)
+PyEval_EvalCode(PyObject *co, PyObject *globals, PyObject *locals)
{
return PyEval_EvalCodeEx(co,
globals, locals,
@@ -3059,10 +3059,11 @@
the test in the if statements in Misc/gdbinit (pystack and pystackv). */
PyObject *
-PyEval_EvalCodeEx(PyCodeObject *co, PyObject *globals, PyObject *locals,
+PyEval_EvalCodeEx(PyObject *_co, PyObject *globals, PyObject *locals,
PyObject **args, int argcount, PyObject **kws, int kwcount,
PyObject **defs, int defcount, PyObject *kwdefs, PyObject *closure)
{
+ PyCodeObject* co = (PyCodeObject*)_co;
register PyFrameObject *f;
register PyObject *retval = NULL;
register PyObject **fastlocals, **freevars;
@@ -3968,7 +3969,7 @@
d = &PyTuple_GET_ITEM(argdefs, 0);
nd = Py_SIZE(argdefs);
}
- return PyEval_EvalCodeEx(co, globals,
+ return PyEval_EvalCodeEx((PyObject*)co, globals,
(PyObject *)NULL, (*pp_stack)-n, na,
(*pp_stack)-2*nk, nk, d, nd, kwdefs,
PyFunction_GET_CLOSURE(func));
diff --git a/Python/dynload_shlib.c b/Python/dynload_shlib.c
index 3d0fb5e..7ea510e 100644
--- a/Python/dynload_shlib.c
+++ b/Python/dynload_shlib.c
@@ -53,6 +53,8 @@
#else /* !__VMS */
{"." SOABI ".so", "rb", C_EXTENSION},
{"module." SOABI ".so", "rb", C_EXTENSION},
+ {".abi" PYTHON_ABI_STRING ".so", "rb", C_EXTENSION},
+ {"module.abi" PYTHON_ABI_STRING ".so", "rb", C_EXTENSION},
{".so", "rb", C_EXTENSION},
{"module.so", "rb", C_EXTENSION},
#endif /* __VMS */
diff --git a/Python/dynload_win.c b/Python/dynload_win.c
index e7d61ce..73a1dcf 100644
--- a/Python/dynload_win.c
+++ b/Python/dynload_win.c
@@ -134,6 +134,15 @@
!strncmp(import_name,"python",6)) {
char *pch;
+#ifndef _DEBUG
+ /* In a release version, don't claim that python3.dll is
+ a Python DLL. */
+ if (strcmp(import_name, "python3.dll") == 0) {
+ import_data += 20;
+ continue;
+ }
+#endif
+
/* Ensure python prefix is followed only
by numbers to the end of the basename */
pch = import_name + 6;
@@ -162,13 +171,16 @@
return NULL;
}
-
dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname,
const char *pathname, FILE *fp)
{
dl_funcptr p;
char funcname[258], *import_python;
+#ifndef _DEBUG
+ _Py_CheckPython3();
+#endif
+
PyOS_snprintf(funcname, sizeof(funcname), "PyInit_%.200s", shortname);
{
diff --git a/Python/import.c b/Python/import.c
index ce7cbc2..23752ee 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -806,7 +806,7 @@
PyErr_Clear(); /* Not important enough to report */
Py_DECREF(v);
- v = PyEval_EvalCode((PyCodeObject *)co, d, d);
+ v = PyEval_EvalCode(co, d, d);
if (v == NULL)
goto error;
Py_DECREF(v);
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index de8e9da..3f6385d 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -1755,7 +1755,7 @@
co = PyAST_Compile(mod, filename, flags, arena);
if (co == NULL)
return NULL;
- v = PyEval_EvalCode(co, globals, locals);
+ v = PyEval_EvalCode((PyObject*)co, globals, locals);
Py_DECREF(co);
return v;
}
@@ -1785,7 +1785,7 @@
return NULL;
}
co = (PyCodeObject *)v;
- v = PyEval_EvalCode(co, globals, locals);
+ v = PyEval_EvalCode((PyObject*)co, globals, locals);
if (v && flags)
flags->cf_flags |= (co->co_flags & PyCF_MASK);
Py_DECREF(co);
@@ -1817,6 +1817,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)
{
diff --git a/Tools/scripts/abitype.py b/Tools/scripts/abitype.py
new file mode 100644
index 0000000..afb104b
--- /dev/null
+++ b/Tools/scripts/abitype.py
@@ -0,0 +1,200 @@
+# This script converts a C file to use the PEP 384 type definition API
+# Usage: abitype.py < old_code > new_code
+import re, sys
+
+############ Simplistic C scanner ##################################
+tokenizer = re.compile(
+ r"(?P<preproc>#.*\n)"
+ r"|(?P<comment>/\*.*?\*/)"
+ r"|(?P<ident>[a-zA-Z_][a-zA-Z0-9_]*)"
+ r"|(?P<ws>[ \t\n]+)"
+ r"|(?P<other>.)",
+ re.MULTILINE)
+
+tokens = []
+source = sys.stdin.read()
+pos = 0
+while pos != len(source):
+ m = tokenizer.match(source, pos)
+ tokens.append([m.lastgroup, m.group()])
+ pos += len(tokens[-1][1])
+ if tokens[-1][0] == 'preproc':
+ # continuation lines are considered
+ # only in preprocess statements
+ while tokens[-1][1].endswith('\\\n'):
+ nl = source.find('\n', pos)
+ if nl == -1:
+ line = source[pos:]
+ else:
+ line = source[pos:nl+1]
+ tokens[-1][1] += line
+ pos += len(line)
+
+###### Replacement of PyTypeObject static instances ##############
+
+# classify each token, giving it a one-letter code:
+# S: static
+# T: PyTypeObject
+# I: ident
+# W: whitespace
+# =, {, }, ; : themselves
+def classify():
+ res = []
+ for t,v in tokens:
+ if t == 'other' and v in "={};":
+ res.append(v)
+ elif t == 'ident':
+ if v == 'PyTypeObject':
+ res.append('T')
+ elif v == 'static':
+ res.append('S')
+ else:
+ res.append('I')
+ elif t == 'ws':
+ res.append('W')
+ else:
+ res.append('.')
+ return ''.join(res)
+
+# Obtain a list of fields of a PyTypeObject, in declaration order,
+# skipping ob_base
+# All comments are dropped from the variable (which are typically
+# just the slot names, anyway), and information is discarded whether
+# the original type was static.
+def get_fields(start, real_end):
+ pos = start
+ # static?
+ if tokens[pos][1] == 'static':
+ pos += 2
+ # PyTypeObject
+ pos += 2
+ # name
+ name = tokens[pos][1]
+ pos += 1
+ while tokens[pos][1] != '{':
+ pos += 1
+ pos += 1
+ # PyVarObject_HEAD_INIT
+ while tokens[pos][0] in ('ws', 'comment'):
+ pos += 1
+ if tokens[pos][1] != 'PyVarObject_HEAD_INIT':
+ raise Exception, '%s has no PyVarObject_HEAD_INIT' % name
+ while tokens[pos][1] != ')':
+ pos += 1
+ pos += 1
+ # field definitions: various tokens, comma-separated
+ fields = []
+ while True:
+ while tokens[pos][0] in ('ws', 'comment'):
+ pos += 1
+ end = pos
+ while tokens[end][1] not in ',}':
+ if tokens[end][1] == '(':
+ nesting = 1
+ while nesting:
+ end += 1
+ if tokens[end][1] == '(': nesting+=1
+ if tokens[end][1] == ')': nesting-=1
+ end += 1
+ assert end < real_end
+ # join field, excluding separator and trailing ws
+ end1 = end-1
+ while tokens[end1][0] in ('ws', 'comment'):
+ end1 -= 1
+ fields.append(''.join(t[1] for t in tokens[pos:end1+1]))
+ if tokens[end][1] == '}':
+ break
+ pos = end+1
+ return name, fields
+
+# List of type slots as of Python 3.2, omitting ob_base
+typeslots = [
+ 'tp_name',
+ 'tp_basicsize',
+ 'tp_itemsize',
+ 'tp_dealloc',
+ 'tp_print',
+ 'tp_getattr',
+ 'tp_setattr',
+ 'tp_reserved',
+ 'tp_repr',
+ 'tp_as_number',
+ 'tp_as_sequence',
+ 'tp_as_mapping',
+ 'tp_hash',
+ 'tp_call',
+ 'tp_str',
+ 'tp_getattro',
+ 'tp_setattro',
+ 'tp_as_buffer',
+ 'tp_flags',
+ 'tp_doc',
+ 'tp_traverse',
+ 'tp_clear',
+ 'tp_richcompare',
+ 'tp_weaklistoffset',
+ 'tp_iter',
+ 'iternextfunc',
+ 'tp_methods',
+ 'tp_members',
+ 'tp_getset',
+ 'tp_base',
+ 'tp_dict',
+ 'tp_descr_get',
+ 'tp_descr_set',
+ 'tp_dictoffset',
+ 'tp_init',
+ 'tp_alloc',
+ 'tp_new',
+ 'tp_free',
+ 'tp_is_gc',
+ 'tp_bases',
+ 'tp_mro',
+ 'tp_cache',
+ 'tp_subclasses',
+ 'tp_weaklist',
+ 'tp_del'
+ 'tp_version_tag'
+]
+
+# Generate a PyType_Spec definition
+def make_slots(name, fields):
+ res = []
+ res.append('static PyType_Slot %s_slots[] = {' % name)
+ # defaults for spec
+ spec = { 'tp_doc':'NULL', 'tp_itemsize':'0' }
+ for i, val in enumerate(fields):
+ if val.endswith('0'):
+ continue
+ if typeslots[i] in ('tp_name', 'tp_doc', 'tp_basicsize',
+ 'tp_itemsize', 'tp_flags'):
+ spec[typeslots[i]] = val
+ continue
+ res.append(' {Py_%s, %s},' % (typeslots[i], val))
+ res.append('};')
+ res.append('static PyType_Spec %s_spec = {' % name)
+ res.append(' %s,' % spec['tp_name'])
+ res.append(' %s,' % spec['tp_doc'])
+ res.append(' %s,' % spec['tp_basicsize'])
+ res.append(' %s,' % spec['tp_itemsize'])
+ res.append(' %s,' % spec['tp_flags'])
+ res.append(' %s_slots,' % name)
+ res.append('};\n')
+ return '\n'.join(res)
+
+
+# Main loop: replace all static PyTypeObjects until
+# there are none left.
+while 1:
+ c = classify()
+ m = re.search('(SW)?TWIW?=W?{.*?};', c)
+ if not m:
+ break
+ start = m.start()
+ end = m.end()
+ name, fields = get_fields(start, m)
+ tokens[start:end] = [('',make_slots(name, fields))]
+
+# Output result to stdout
+for t, v in tokens:
+ sys.stdout.write(v)
diff --git a/setup.py b/setup.py
index d4e981b..6d2d3ac 100644
--- a/setup.py
+++ b/setup.py
@@ -1579,6 +1579,9 @@
## # Uncomment these lines if you want to play with xxmodule.c
## ext = Extension('xx', ['xxmodule.c'])
## self.extensions.append(ext)
+ ext = Extension('xxlimited', ['xxlimited.c'],
+ define_macros=[('Py_LIMITED_API', 1)])
+ self.extensions.append(ext)
# XXX handle these, but how to detect?
# *** Uncomment and edit for PIL (TkImaging) extension only: