16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-18 00:49:19 +02:00

modify and cleanup python headers and libs

This commit is contained in:
milek7
2019-01-19 00:06:48 +01:00
parent 1314f09c4d
commit 09f1efd376
78 changed files with 454 additions and 176 deletions

View File

@@ -43,6 +43,9 @@
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_CRYPT_H
#include <crypt.h>
#endif
/* For size_t? */
#ifdef HAVE_STDDEF_H

View File

@@ -94,7 +94,7 @@ Proposal
numeric, sequence, and mapping. Each protocol consists of a
collection of related operations. If an operation that is not
provided by a particular type is invoked, then a standard exception,
NotImplementedError is raised with a operation name as an argument.
NotImplementedError is raised with an operation name as an argument.
In addition, for convenience this interface defines a set of
constructors for building objects of built-in types. This is needed
so new objects can be returned from C functions that otherwise treat
@@ -191,8 +191,8 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
int PyObject_SetAttrString(PyObject *o, char *attr_name, PyObject *v);
Set the value of the attribute named attr_name, for object o,
to the value, v. Returns -1 on failure. This is
the equivalent of the Python statement: o.attr_name=v.
to the value v. Raise an exception and return -1 on failure; return 0 on
success. This is the equivalent of the Python statement o.attr_name=v.
*/
@@ -201,8 +201,8 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
int PyObject_SetAttr(PyObject *o, PyObject *attr_name, PyObject *v);
Set the value of the attribute named attr_name, for object o,
to the value, v. Returns -1 on failure. This is
the equivalent of the Python statement: o.attr_name=v.
to the value v. Raise an exception and return -1 on failure; return 0 on
success. This is the equivalent of the Python statement o.attr_name=v.
*/
@@ -453,9 +453,9 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
PyAPI_FUNC(int) PyObject_SetItem(PyObject *o, PyObject *key, PyObject *v);
/*
Map the object, key, to the value, v. Returns
-1 on failure. This is the equivalent of the Python
statement: o[key]=v.
Map the object key to the value v. Raise an exception and return -1
on failure; return 0 on success. This is the equivalent of the Python
statement o[key]=v.
*/
PyAPI_FUNC(int) PyObject_DelItemString(PyObject *o, char *key);
@@ -1102,10 +1102,9 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
PyAPI_FUNC(int) PySequence_SetItem(PyObject *o, Py_ssize_t i, PyObject *v);
/*
Assign object v to the ith element of o. Returns
-1 on failure. This is the equivalent of the Python
statement: o[i]=v.
Assign object v to the ith element of o. Raise an exception and return
-1 on failure; return 0 on success. This is the equivalent of the
Python statement o[i]=v.
*/
PyAPI_FUNC(int) PySequence_DelItem(PyObject *o, Py_ssize_t i);
@@ -1121,7 +1120,8 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
/*
Assign the sequence object, v, to the slice in sequence
object, o, from i1 to i2. Returns -1 on failure. This is the
object, o, from i1 to i2. Raise an exception and return
-1 on failure; return 0 on success. This is the
equivalent of the Python statement: o[i1:i2]=v.
*/
@@ -1149,7 +1149,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
PyAPI_FUNC(PyObject *) PySequence_Fast(PyObject *o, const char* m);
/*
Returns the sequence, o, as a tuple, unless it's already a
Return the sequence, o, as a list, unless it's already a
tuple or list. Use PySequence_Fast_GET_ITEM to access the
members of this list, and PySequence_Fast_GET_SIZE to get its length.

View File

@@ -7,7 +7,7 @@ extern "C" {
This header provides access to cStringIO objects from C.
Functions are provided for calling cStringIO objects and
macros are provided for testing whether you have cStringIO
macros are provided for testing whether you have cStringIO
objects.
Before calling any of the functions or macros, you must initialize
@@ -28,7 +28,7 @@ extern "C" {
/* Basic functions to manipulate cStringIO objects from C */
static struct PycStringIO_CAPI {
/* Read a string from an input object. If the last argument
is -1, the remainder will be read.
*/

View File

@@ -50,7 +50,7 @@ PyAPI_FUNC(int) Py_GetRecursionLimit(void);
_Py_CheckRecursiveCall(where))
#define Py_LeaveRecursiveCall() \
(--PyThreadState_GET()->recursion_depth)
PyAPI_FUNC(int) _Py_CheckRecursiveCall(char *where);
PyAPI_FUNC(int) _Py_CheckRecursiveCall(const char *where);
PyAPI_DATA(int) _Py_CheckRecursionLimit;
#ifdef USE_STACKCHECK
# define _Py_MakeRecCheck(x) (++(x) > --_Py_CheckRecursionLimit)
@@ -145,6 +145,7 @@ PyAPI_FUNC(void) PyEval_ReInitThreads(void);
#endif /* !WITH_THREAD */
PyAPI_FUNC(int) _PyEval_SliceIndex(PyObject *, Py_ssize_t *);
PyAPI_FUNC(int) _PyEval_SliceIndexNotNone(PyObject *, Py_ssize_t *);
#ifdef __cplusplus

View File

@@ -70,7 +70,7 @@ PyAPI_DATA(PyTypeObject) PyCode_Type;
/* Public interface */
PyAPI_FUNC(PyCodeObject *) PyCode_New(
int, int, int, int, PyObject *, PyObject *, PyObject *, PyObject *,
PyObject *, PyObject *, PyObject *, PyObject *, int, PyObject *);
PyObject *, PyObject *, PyObject *, PyObject *, int, PyObject *);
/* same as struct above */
/* Creates a new empty code object with the specified source location. */
@@ -98,6 +98,15 @@ typedef struct _addr_pair {
PyAPI_FUNC(int) _PyCode_CheckLineNumber(PyCodeObject* co,
int lasti, PyAddrPair *bounds);
/* Create a comparable key used to compare constants taking in account the
* object type. It is used to make sure types are not coerced (e.g., float and
* complex) _and_ to distinguish 0.0 from -0.0 e.g. on IEEE platforms
*
* Return (type(obj), obj, ...): a tuple with variable size (at least 2 items)
* depending on the type and the value. The type is the first item to not
* compare bytes and str which can raise a BytesWarning exception. */
PyAPI_FUNC(PyObject*) _PyCode_ConstantKey(PyObject *obj);
PyAPI_FUNC(PyObject*) PyCode_Optimize(PyObject *code, PyObject* consts,
PyObject *names, PyObject *lineno_obj);

View File

@@ -81,6 +81,51 @@ PyAPI_FUNC(PyObject *) PyCodec_Decode(
const char *errors
);
/* Text codec specific encoding and decoding API.
Checks the encoding against a list of codecs which do not
implement a unicode<->bytes encoding before attempting the
operation.
Please note that these APIs are internal and should not
be used in Python C extensions.
XXX (ncoghlan): should we make these, or something like them, public
in Python 3.5+?
*/
PyAPI_FUNC(PyObject *) _PyCodec_LookupTextEncoding(
const char *encoding,
const char *alternate_command
);
PyAPI_FUNC(PyObject *) _PyCodec_EncodeText(
PyObject *object,
const char *encoding,
const char *errors
);
PyAPI_FUNC(PyObject *) _PyCodec_DecodeText(
PyObject *object,
const char *encoding,
const char *errors
);
/* These two aren't actually text encoding specific, but _io.TextIOWrapper
* is the only current API consumer.
*/
PyAPI_FUNC(PyObject *) _PyCodecInfo_GetIncrementalDecoder(
PyObject *codec_info,
const char *errors
);
PyAPI_FUNC(PyObject *) _PyCodecInfo_GetIncrementalEncoder(
PyObject *codec_info,
const char *errors
);
/* --- Codec Lookup APIs --------------------------------------------------
All APIs return a codec object with incremented refcount and are
@@ -101,14 +146,14 @@ PyAPI_FUNC(PyObject *) PyCodec_Decoder(
const char *encoding
);
/* Get a IncrementalEncoder object for the given encoding. */
/* Get an IncrementalEncoder object for the given encoding. */
PyAPI_FUNC(PyObject *) PyCodec_IncrementalEncoder(
const char *encoding,
const char *errors
);
/* Get a IncrementalDecoder object function for the given encoding. */
/* Get an IncrementalDecoder object function for the given encoding. */
PyAPI_FUNC(PyObject *) PyCodec_IncrementalDecoder(
const char *encoding,

View File

@@ -42,7 +42,7 @@ typedef struct
typedef struct
{
PyObject_HEAD /* a pure abstract base clase */
PyObject_HEAD /* a pure abstract base class */
} PyDateTime_TZInfo;

View File

@@ -108,8 +108,12 @@ PyAPI_DATA(PyTypeObject) PyDictValues_Type;
PyAPI_FUNC(PyObject *) PyDict_New(void);
PyAPI_FUNC(PyObject *) PyDict_GetItem(PyObject *mp, PyObject *key);
PyAPI_FUNC(PyObject *) _PyDict_GetItemWithError(PyObject *mp, PyObject *key);
PyAPI_FUNC(int) PyDict_SetItem(PyObject *mp, PyObject *key, PyObject *item);
PyAPI_FUNC(int) PyDict_DelItem(PyObject *mp, PyObject *key);
PyAPI_FUNC(int) _PyDict_DelItemIf(PyObject *mp, PyObject *key,
int (*predicate)(PyObject *value));
PyAPI_FUNC(void) PyDict_Clear(PyObject *mp);
PyAPI_FUNC(int) PyDict_Next(
PyObject *mp, Py_ssize_t *pos, PyObject **key, PyObject **value);

View File

@@ -29,6 +29,7 @@ extern "C" {
#define E_EOFS 23 /* EOF in triple-quoted string */
#define E_EOLS 24 /* EOL in single-quoted string */
#define E_LINECONT 25 /* Unexpected characters after a line continuation */
#define E_IO 26 /* I/O error */
#ifdef __cplusplus
}

View File

@@ -70,14 +70,14 @@ size_t Py_UniversalNewlineFread(char *, size_t, FILE *, PyObject *);
*/
int _PyFile_SanitizeMode(char *mode);
#if defined _MSC_VER && _MSC_VER >= 1400
#if defined _MSC_VER && _MSC_VER >= 1400 && _MSC_VER < 1900
/* A routine to check if a file descriptor is valid on Windows. Returns 0
* and sets errno to EBADF if it isn't. This is to avoid Assertions
* from various functions in the Windows CRT beginning with
* Visual Studio 2005
*/
int _PyVerify_fd(int fd);
#elif defined _MSC_VER && _MSC_VER >= 1200
#elif defined _MSC_VER && _MSC_VER >= 1200 && _MSC_VER < 1900
/* fdopen doesn't set errno EBADF and crashes for large fd on debug build */
#define _PyVerify_fd(fd) (_get_osfhandle(fd) >= 0)
#else

View File

@@ -54,9 +54,9 @@ typedef struct _frame {
PyAPI_DATA(PyTypeObject) PyFrame_Type;
#define PyFrame_Check(op) ((op)->ob_type == &PyFrame_Type)
#define PyFrame_Check(op) (Py_TYPE(op) == &PyFrame_Type)
#define PyFrame_IsRestricted(f) \
((f)->f_builtins != (f)->f_tstate->interp->builtins)
((f)->f_tstate && (f)->f_builtins != (f)->f_tstate->interp->builtins)
PyAPI_FUNC(PyFrameObject *) PyFrame_New(PyThreadState *, PyCodeObject *,
PyObject *, PyObject *);

View File

@@ -69,6 +69,7 @@ typedef struct {
/* FUNCTIONS */
grammar *newgrammar(int start);
void freegrammar(grammar *g);
dfa *adddfa(grammar *g, int type, char *name);
int addstate(dfa *d);
void addarc(dfa *d, int from, int to, int lbl);

View File

@@ -40,8 +40,8 @@ PyAPI_FUNC(struct filedescr *) _PyImport_FindModule(
PyAPI_FUNC(int) _PyImport_IsScript(struct filedescr *);
PyAPI_FUNC(void) _PyImport_ReInitLock(void);
PyAPI_FUNC(PyObject *)_PyImport_FindExtension(char *, char *);
PyAPI_FUNC(PyObject *)_PyImport_FixupExtension(char *, char *);
PyAPI_FUNC(PyObject *) _PyImport_FindExtension(char *, char *);
PyAPI_FUNC(PyObject *) _PyImport_FixupExtension(char *, char *);
struct _inittab {
char *name;

View File

@@ -28,8 +28,11 @@ typedef struct {
PyAPI_DATA(PyTypeObject) PyInt_Type;
#define PyInt_Check(op) \
PyType_FastSubclass((op)->ob_type, Py_TPFLAGS_INT_SUBCLASS)
#define PyInt_CheckExact(op) ((op)->ob_type == &PyInt_Type)
PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_INT_SUBCLASS)
#define PyInt_CheckExact(op) (Py_TYPE(op) == &PyInt_Type)
#define _PyAnyInt_Check(op) (PyInt_Check(op) || PyLong_Check(op))
#define _PyAnyInt_CheckExact(op) (PyInt_CheckExact(op) || PyLong_CheckExact(op))
PyAPI_FUNC(PyObject *) PyInt_FromString(char*, char**, int);
#ifdef Py_USING_UNICODE
@@ -40,6 +43,7 @@ PyAPI_FUNC(PyObject *) PyInt_FromSize_t(size_t);
PyAPI_FUNC(PyObject *) PyInt_FromSsize_t(Py_ssize_t);
PyAPI_FUNC(long) PyInt_AsLong(PyObject *);
PyAPI_FUNC(Py_ssize_t) PyInt_AsSsize_t(PyObject *);
PyAPI_FUNC(int) _PyInt_AsInt(PyObject *);
PyAPI_FUNC(unsigned long) PyInt_AsUnsignedLongMask(PyObject *);
#ifdef HAVE_LONG_LONG
PyAPI_FUNC(unsigned PY_LONG_LONG) PyInt_AsUnsignedLongLongMask(PyObject *);

View File

@@ -2,7 +2,7 @@
/* List object interface */
/*
Another generally useful object type is an list of object pointers.
Another generally useful object type is a list of object pointers.
This is a mutable type: the list items can be changed, and items can be
added or removed. Out-of-range indices or non-list objects are ignored.
@@ -41,7 +41,7 @@ typedef struct {
PyAPI_DATA(PyTypeObject) PyList_Type;
#define PyList_Check(op) \
PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_LIST_SUBCLASS)
PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_LIST_SUBCLASS)
#define PyList_CheckExact(op) (Py_TYPE(op) == &PyList_Type)
PyAPI_FUNC(PyObject *) PyList_New(Py_ssize_t size);

View File

@@ -25,6 +25,7 @@ PyAPI_FUNC(long) PyLong_AsLongAndOverflow(PyObject *, int *);
PyAPI_FUNC(unsigned long) PyLong_AsUnsignedLong(PyObject *);
PyAPI_FUNC(unsigned long) PyLong_AsUnsignedLongMask(PyObject *);
PyAPI_FUNC(Py_ssize_t) PyLong_AsSsize_t(PyObject *);
PyAPI_FUNC(int) _PyLong_AsInt(PyObject *);
PyAPI_FUNC(PyObject *) PyLong_GetInfo(void);
/* For use by intobject.c only */
@@ -109,7 +110,7 @@ PyAPI_FUNC(PyObject *) _PyLong_FromByteArray(
example, if is_signed is 0 and there are more digits in the v than
fit in n; or if is_signed is 1, v < 0, and n is just 1 bit shy of
being large enough to hold a sign bit. OverflowError is set in this
case, but bytes holds the least-signficant n bytes of the true value.
case, but bytes holds the least-significant n bytes of the true value.
*/
PyAPI_FUNC(int) _PyLong_AsByteArray(PyLongObject* v,
unsigned char* bytes, size_t n,

View File

@@ -33,7 +33,7 @@ PyAPI_FUNC(PyObject *) PyMemoryView_GetContiguous(PyObject *base,
original buffer if a copy must be made. If buffertype is
PyBUF_WRITE and the buffer is not contiguous an error will
be raised. In this circumstance, the user can use
PyBUF_SHADOW to ensure that a a writable temporary
PyBUF_SHADOW to ensure that a writable temporary
contiguous buffer is returned. The contents of this
contiguous buffer will be copied back into the original
object after the memoryview object is deleted as long as

View File

@@ -20,6 +20,7 @@ PyAPI_FUNC(node *) PyNode_New(int type);
PyAPI_FUNC(int) PyNode_AddChild(node *n, int type,
char *str, int lineno, int col_offset);
PyAPI_FUNC(void) PyNode_Free(node *n);
PyAPI_FUNC(Py_ssize_t) _PyNode_SizeOf(node *n);
/* Node access functions */
#define NCH(n) ((n)->n_nchildren)

View File

@@ -527,7 +527,9 @@ PyAPI_DATA(_Py_HashSecret_t) _Py_HashSecret;
PyAPI_DATA(int) _Py_HashSecret_Initialized;
#endif
/* Helper for passing objects to printf and the like */
/* Helper for passing objects to printf and the like.
Leaks refcounts. Don't use it!
*/
#define PyObject_REPR(obj) PyString_AS_STRING(PyObject_Repr(obj))
/* Flag bits for printing: */
@@ -776,7 +778,7 @@ PyAPI_FUNC(void) _Py_AddToAllObjects(PyObject *, int force);
} while (0)
/* Safely decref `op` and set `op` to NULL, especially useful in tp_clear
* and tp_dealloc implementatons.
* and tp_dealloc implementations.
*
* Note that "the obvious" code can be deadly:
*
@@ -822,6 +824,39 @@ PyAPI_FUNC(void) _Py_AddToAllObjects(PyObject *, int force);
#define Py_XINCREF(op) do { if ((op) == NULL) ; else Py_INCREF(op); } while (0)
#define Py_XDECREF(op) do { if ((op) == NULL) ; else Py_DECREF(op); } while (0)
/* Safely decref `op` and set `op` to `op2`.
*
* As in case of Py_CLEAR "the obvious" code can be deadly:
*
* Py_DECREF(op);
* op = op2;
*
* The safe way is:
*
* Py_SETREF(op, op2);
*
* That arranges to set `op` to `op2` _before_ decref'ing, so that any code
* triggered as a side-effect of `op` getting torn down no longer believes
* `op` points to a valid object.
*
* Py_XSETREF is a variant of Py_SETREF that uses Py_XDECREF instead of
* Py_DECREF.
*/
#define Py_SETREF(op, op2) \
do { \
PyObject *_py_tmp = (PyObject *)(op); \
(op) = (op2); \
Py_DECREF(_py_tmp); \
} while (0)
#define Py_XSETREF(op, op2) \
do { \
PyObject *_py_tmp = (PyObject *)(op); \
(op) = (op2); \
Py_XDECREF(_py_tmp); \
} while (0)
/*
These are provided as conveniences to Python runtime embedders, so that
they can have object code that is not dependent on Python compilation flags.
@@ -971,24 +1006,39 @@ chain of N deallocations is broken into N / PyTrash_UNWIND_LEVEL pieces,
with the call stack never exceeding a depth of PyTrash_UNWIND_LEVEL.
*/
/* This is the old private API, invoked by the macros before 2.7.4.
Kept for binary compatibility of extensions. */
PyAPI_FUNC(void) _PyTrash_deposit_object(PyObject*);
PyAPI_FUNC(void) _PyTrash_destroy_chain(void);
PyAPI_DATA(int) _PyTrash_delete_nesting;
PyAPI_DATA(PyObject *) _PyTrash_delete_later;
/* The new thread-safe private API, invoked by the macros below. */
PyAPI_FUNC(void) _PyTrash_thread_deposit_object(PyObject*);
PyAPI_FUNC(void) _PyTrash_thread_destroy_chain(void);
#define PyTrash_UNWIND_LEVEL 50
/* Note the workaround for when the thread state is NULL (issue #17703) */
#define Py_TRASHCAN_SAFE_BEGIN(op) \
if (_PyTrash_delete_nesting < PyTrash_UNWIND_LEVEL) { \
++_PyTrash_delete_nesting;
/* The body of the deallocator is here. */
do { \
PyThreadState *_tstate = PyThreadState_GET(); \
if (!_tstate || \
_tstate->trash_delete_nesting < PyTrash_UNWIND_LEVEL) { \
if (_tstate) \
++_tstate->trash_delete_nesting;
/* The body of the deallocator is here. */
#define Py_TRASHCAN_SAFE_END(op) \
--_PyTrash_delete_nesting; \
if (_PyTrash_delete_later && _PyTrash_delete_nesting <= 0) \
_PyTrash_destroy_chain(); \
} \
else \
_PyTrash_deposit_object((PyObject*)op);
if (_tstate) { \
--_tstate->trash_delete_nesting; \
if (_tstate->trash_delete_later \
&& _tstate->trash_delete_nesting <= 0) \
_PyTrash_thread_destroy_chain(); \
} \
} \
else \
_PyTrash_thread_deposit_object((PyObject*)op); \
} while (0);
#ifdef __cplusplus
}

View File

@@ -56,7 +56,7 @@ must use the platform malloc heap(s), or shared memory, or C++ local storage or
operator new), you must first allocate the object with your custom allocator,
then pass its pointer to PyObject_{Init, InitVar} for filling in its Python-
specific fields: reference count, type pointer, possibly others. You should
be aware that Python no control over these objects because they don't
be aware that Python has no control over these objects because they don't
cooperate with the Python memory manager. Such objects may not be eligible
for automatic garbage collection and you have to make sure that they are
released accordingly whenever their destructor gets called (cf. the specific
@@ -248,6 +248,20 @@ PyAPI_FUNC(PyVarObject *) _PyObject_GC_Resize(PyVarObject *, Py_ssize_t);
/* for source compatibility with 2.2 */
#define _PyObject_GC_Del PyObject_GC_Del
/*
* Former over-aligned definition of PyGC_Head, used to compute the size of the
* padding for the new version below.
*/
union _gc_head;
union _gc_head_old {
struct {
union _gc_head_old *gc_next;
union _gc_head_old *gc_prev;
Py_ssize_t gc_refs;
} gc;
long double dummy;
};
/* GC information is stored BEFORE the object structure. */
typedef union _gc_head {
struct {
@@ -255,7 +269,8 @@ typedef union _gc_head {
union _gc_head *gc_prev;
Py_ssize_t gc_refs;
} gc;
long double dummy; /* force worst-case alignment */
double dummy; /* Force at least 8-byte alignment. */
char dummy_padding[sizeof(union _gc_head_old)];
} PyGC_Head;
extern PyGC_Head *_PyGC_generation0;

View File

@@ -37,12 +37,21 @@ extern "C" {
#define SLICE 30
/* Also uses 31-33 */
#define SLICE_1 31
#define SLICE_2 32
#define SLICE_3 33
#define STORE_SLICE 40
/* Also uses 41-43 */
#define STORE_SLICE_1 41
#define STORE_SLICE_2 42
#define STORE_SLICE_3 43
#define DELETE_SLICE 50
/* Also uses 51-53 */
#define DELETE_SLICE_1 51
#define DELETE_SLICE_2 52
#define DELETE_SLICE_3 53
#define STORE_MAP 54
#define INPLACE_ADD 55

View File

@@ -36,6 +36,14 @@ extern "C" {
#endif
/* Max pathname length */
#ifdef __hpux
#include <sys/param.h>
#include <limits.h>
#ifndef PATH_MAX
#define PATH_MAX MAXPATHLEN
#endif
#endif
#ifndef MAXPATHLEN
#if defined(PATH_MAX) && PATH_MAX > 1024
#define MAXPATHLEN PATH_MAX

View File

@@ -6,7 +6,7 @@
defined(PY_MAJOR_VERSION).
When the major or minor version changes, the VERSION variable in
configure.in must also be changed.
configure.ac must also be changed.
There is also (independent) API version information in modsupport.h.
*/
@@ -22,12 +22,12 @@
/*--start constants--*/
#define PY_MAJOR_VERSION 2
#define PY_MINOR_VERSION 7
#define PY_MICRO_VERSION 3
#define PY_MICRO_VERSION 15
#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL
#define PY_RELEASE_SERIAL 0
/* Version as a string */
#define PY_VERSION "2.7.3"
#define PY_VERSION "2.7.15+"
/*--end constants--*/
/* Subversion Revision number of this file (not of the repository). Empty

View File

@@ -23,6 +23,7 @@ PyAPI_FUNC(void) PySys_WriteStderr(const char *format, ...)
#define delbitset _Py_delbitset
#define dumptree _Py_dumptree
#define findlabel _Py_findlabel
#define freegrammar _Py_freegrammar
#define mergebitset _Py_mergebitset
#define meta_grammar _Py_meta_grammar
#define newbitset _Py_newbitset

View File

@@ -7,14 +7,9 @@
** On Mac OS X 10.2 [n]curses.h and stdlib.h use different guards
** against multiple definition of wchar_t.
*/
#ifdef _BSD_WCHAR_T_DEFINED_
#ifdef _BSD_WCHAR_T_DEFINED_
#define _WCHAR_T
#endif
/* the following define is necessary for OS X 10.6; without it, the
Apple-supplied ncurses.h sets NCURSES_OPAQUE to 1, and then Python
can't get at the WINDOW flags field. */
#define NCURSES_OPAQUE 0
#endif /* __APPLE__ */
#ifdef __FreeBSD__
@@ -22,7 +17,7 @@
** On FreeBSD, [n]curses.h and stdlib.h/wchar.h use different guards
** against multiple definition of wchar_t and wint_t.
*/
#ifdef _XOPEN_SOURCE_EXTENDED
#ifdef _XOPEN_SOURCE_EXTENDED
#ifndef __FreeBSD_version
#include <osreldate.h>
#endif
@@ -44,22 +39,28 @@
#endif
#endif
#if !defined(HAVE_CURSES_IS_PAD) && defined(WINDOW_HAS_FLAGS)
/* The following definition is necessary for ncurses 5.7; without it,
some of [n]curses.h set NCURSES_OPAQUE to 1, and then Python
can't get at the WINDOW flags field. */
#define NCURSES_OPAQUE 0
#endif
#ifdef HAVE_NCURSES_H
#include <ncurses.h>
#else
#include <curses.h>
#ifdef HAVE_TERM_H
/* for tigetstr, which is not declared in SysV curses */
#include <term.h>
#endif
#endif
#ifdef HAVE_NCURSES_H
/* configure was checking <curses.h>, but we will
use <ncurses.h>, which has all these features. */
#ifndef WINDOW_HAS_FLAGS
use <ncurses.h>, which has some or all these features. */
#if !defined(WINDOW_HAS_FLAGS) && !(NCURSES_OPAQUE+0)
#define WINDOW_HAS_FLAGS 1
#endif
#if !defined(HAVE_CURSES_IS_PAD) && NCURSES_VERSION_PATCH+0 >= 20090906
#define HAVE_CURSES_IS_PAD 1
#endif
#ifndef MVWDELCH_IS_EXPRESSION
#define MVWDELCH_IS_EXPRESSION 1
#endif
@@ -74,11 +75,11 @@ extern "C" {
/* Type declarations */
typedef struct {
PyObject_HEAD
WINDOW *win;
PyObject_HEAD
WINDOW *win;
} PyCursesWindowObject;
#define PyCursesWindow_Check(v) (Py_TYPE(v) == &PyCursesWindow_Type)
#define PyCursesWindow_Check(v) (Py_TYPE(v) == &PyCursesWindow_Type)
#define PyCurses_CAPSULE_NAME "_curses._C_API"

View File

@@ -148,7 +148,11 @@ WIN32 is still required for the locale module.
#define COMPILER _Py_PASTE_VERSION("64 bit (Itanium)")
#define MS_WINI64
#elif defined(_M_X64) || defined(_M_AMD64)
#ifdef __INTEL_COMPILER
#define COMPILER ("[ICC v." _Py_STRINGIZE(__INTEL_COMPILER) " 64 bit (amd64) with MSC v." _Py_STRINGIZE(_MSC_VER) " CRT]")
#else
#define COMPILER _Py_PASTE_VERSION("64 bit (AMD64)")
#endif /* __INTEL_COMPILER */
#define MS_WINX64
#else
#define COMPILER _Py_PASTE_VERSION("64 bit (Unknown)")
@@ -156,19 +160,9 @@ WIN32 is still required for the locale module.
#endif /* MS_WIN64 */
/* set the version macros for the windows headers */
#ifdef MS_WINX64
/* 64 bit only runs on XP or greater */
#define Py_WINVER _WIN32_WINNT_WINXP
#define Py_NTDDI NTDDI_WINXP
#else
/* Python 2.6+ requires Windows 2000 or greater */
#ifdef _WIN32_WINNT_WIN2K
#define Py_WINVER _WIN32_WINNT_WIN2K
#else
#define Py_WINVER 0x0500
#endif
#define Py_NTDDI NTDDI_WIN2KSP4
#endif
/* We require at least windows vista */
#define Py_WINVER 0x0600 /* _WIN32_WINNT_VISTA */
#define Py_NTDDI NTDDI_VISTA
/* We only set these values when building Python - we don't want to force
these values on extensions, as that will affect the prototypes and
@@ -204,7 +198,11 @@ typedef _W64 int ssize_t;
#if defined(MS_WIN32) && !defined(MS_WIN64)
#ifdef _M_IX86
#ifdef __INTEL_COMPILER
#define COMPILER ("[ICC v." _Py_STRINGIZE(__INTEL_COMPILER) " 32 bit (Intel) with MSC v." _Py_STRINGIZE(_MSC_VER) " CRT]")
#else
#define COMPILER _Py_PASTE_VERSION("32 bit (Intel)")
#endif /* __INTEL_COMPILER */
#else
#define COMPILER _Py_PASTE_VERSION("32 bit (Unknown)")
#endif
@@ -217,7 +215,6 @@ typedef int pid_t;
#define Py_IS_INFINITY(X) (!_finite(X) && !_isnan(X))
#define Py_IS_FINITE(X) _finite(X)
#define copysign _copysign
#define hypot _hypot
#endif /* _MSC_VER */
@@ -270,7 +267,6 @@ typedef int pid_t;
#endif
#define COMPILER "[gcc]"
#define hypot _hypot
#define PY_LONG_LONG long long
#define PY_LLONG_MIN LLONG_MIN
#define PY_LLONG_MAX LLONG_MAX
@@ -342,7 +338,7 @@ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */
# define SIZEOF_FPOS_T 8
# define SIZEOF_HKEY 8
# define SIZEOF_SIZE_T 8
/* configure.in defines HAVE_LARGEFILE_SUPPORT iff HAVE_LONG_LONG,
/* configure.ac defines HAVE_LARGEFILE_SUPPORT iff HAVE_LONG_LONG,
sizeof(off_t) > sizeof(long), and sizeof(PY_LONG_LONG) >= sizeof(off_t).
On Win64 the second condition is not true, but if fpos_t replaces off_t
then this is true. The uses of HAVE_LARGEFILE_SUPPORT imply that Win64
@@ -356,7 +352,7 @@ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */
# define SIZEOF_FPOS_T 8
# define SIZEOF_HKEY 4
# define SIZEOF_SIZE_T 4
/* MS VS2005 changes time_t to an 64-bit type on all platforms */
/* MS VS2005 changes time_t to a 64-bit type on all platforms */
# if defined(_MSC_VER) && _MSC_VER >= 1400
# define SIZEOF_TIME_T 8
# else
@@ -435,6 +431,11 @@ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */
/* Define to 1 if you have the `copysign' function. */
#define HAVE_COPYSIGN 1
/* Define to 1 if you have the `round' function. */
#if _MSC_VER >= 1800
#define HAVE_ROUND 1
#endif
/* Define to 1 if you have the `isinf' macro. */
#define HAVE_DECL_ISINF 1

View File

@@ -91,6 +91,7 @@ PyAPI_FUNC(void) PyErr_Restore(PyObject *, PyObject *, PyObject *);
PyAPI_FUNC(int) PyErr_GivenExceptionMatches(PyObject *, PyObject *);
PyAPI_FUNC(int) PyErr_ExceptionMatches(PyObject *);
PyAPI_FUNC(void) PyErr_NormalizeException(PyObject**, PyObject**, PyObject**);
PyAPI_FUNC(void) _PyErr_ReplaceException(PyObject *, PyObject *, PyObject *);
/* */
@@ -214,7 +215,7 @@ PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErr(PyObject *, int);
/* Export the old function so that the existing API remains available: */
PyAPI_FUNC(void) PyErr_BadInternalCall(void);
PyAPI_FUNC(void) _PyErr_BadInternalCall(char *filename, int lineno);
PyAPI_FUNC(void) _PyErr_BadInternalCall(const char *filename, int lineno);
/* Mask the old API with a call to the new API for code compiled under
Python 2.0: */
#define PyErr_BadInternalCall() _PyErr_BadInternalCall(__FILE__, __LINE__)

View File

@@ -3,7 +3,7 @@
/* note: you must import expat.h before importing this module! */
#define PyExpat_CAPI_MAGIC "pyexpat.expat_CAPI 1.0"
#define PyExpat_CAPI_MAGIC "pyexpat.expat_CAPI 1.1"
#define PyExpat_CAPSULE_NAME "pyexpat.expat_CAPI"
struct PyExpat_CAPI
@@ -43,6 +43,8 @@ struct PyExpat_CAPI
XML_Parser parser, XML_UnknownEncodingHandler handler,
void *encodingHandlerData);
void (*SetUserData)(XML_Parser parser, void *userData);
/* might be none for expat < 2.1.0 */
int (*SetHashSalt)(XML_Parser parser, unsigned long hash_salt);
/* always add new stuff to the end! */
};

View File

@@ -4,8 +4,8 @@
extern "C" {
#endif
/*
---------------------------------------------------------------------
/ Copyright (c) 1996. \
---------------------------------------------------------------------
/ Copyright (c) 1996. \
| The Regents of the University of California. |
| All rights reserved. |
| |
@@ -37,18 +37,18 @@ extern "C" {
| opinions of authors expressed herein do not necessarily state or |
| reflect those of the United States Government or the University |
| of California, and shall not be used for advertising or product |
\ endorsement purposes. /
---------------------------------------------------------------------
\ endorsement purposes. /
---------------------------------------------------------------------
*/
/*
* Define macros for handling SIGFPE.
* Lee Busby, LLNL, November, 1996
* busby1@llnl.gov
*
*
*********************************************
* Overview of the system for handling SIGFPE:
*
*
* This file (Include/pyfpe.h) defines a couple of "wrapper" macros for
* insertion into your Python C code of choice. Their proper use is
* discussed below. The file Python/pyfpe.c defines a pair of global
@@ -59,33 +59,33 @@ extern "C" {
* named fpectl. This module is standard in every respect. It can be loaded
* either statically or dynamically as you choose, and like any other
* Python module, has no effect until you import it.
*
*
* In the general case, there are three steps toward handling SIGFPE in any
* Python code:
*
*
* 1) Add the *_PROTECT macros to your C code as required to protect
* dangerous floating point sections.
*
*
* 2) Turn on the inclusion of the code by adding the ``--with-fpectl''
* flag at the time you run configure. If the fpectl or other modules
* which use the *_PROTECT macros are to be dynamically loaded, be
* sure they are compiled with WANT_SIGFPE_HANDLER defined.
*
*
* 3) When python is built and running, import fpectl, and execute
* fpectl.turnon_sigfpe(). This sets up the signal handler and enables
* generation of SIGFPE whenever an exception occurs. From this point
* on, any properly trapped SIGFPE should result in the Python
* FloatingPointError exception.
*
*
* Step 1 has been done already for the Python kernel code, and should be
* done soon for the NumPy array package. Step 2 is usually done once at
* python install time. Python's behavior with respect to SIGFPE is not
* changed unless you also do step 3. Thus you can control this new
* facility at compile time, or run time, or both.
*
********************************
*
********************************
* Using the macros in your code:
*
*
* static PyObject *foobar(PyObject *self,PyObject *args)
* {
* ....
@@ -94,17 +94,17 @@ extern "C" {
* PyFPE_END_PROTECT(result)
* ....
* }
*
*
* If a floating point error occurs in dangerous_op, foobar returns 0 (NULL),
* after setting the associated value of the FloatingPointError exception to
* "Error in foobar". ``Dangerous_op'' can be a single operation, or a block
* of code, function calls, or any combination, so long as no alternate
* return is possible before the PyFPE_END_PROTECT macro is reached.
*
*
* The macros can only be used in a function context where an error return
* can be recognized as signaling a Python exception. (Generally, most
* functions that return a PyObject * will qualify.)
*
*
* Guido's original design suggestion for PyFPE_START_PROTECT and
* PyFPE_END_PROTECT had them open and close a local block, with a locally
* defined jmp_buf and jmp_buf pointer. This would allow recursive nesting
@@ -112,17 +112,17 @@ extern "C" {
* variables need to be declared with the "volatile" type qualifier to keep
* setjmp from corrupting their values. Some current implementations seem
* to be more restrictive. For example, the HPUX man page for setjmp says
*
*
* Upon the return from a setjmp() call caused by a longjmp(), the
* values of any non-static local variables belonging to the routine
* from which setjmp() was called are undefined. Code which depends on
* such values is not guaranteed to be portable.
*
*
* I therefore decided on a more limited form of nesting, using a counter
* variable (PyFPE_counter) to keep track of any recursion. If an exception
* occurs in an ``inner'' pair of macros, the return will apparently
* come from the outermost level.
*
*
*/
#ifdef WANT_SIGFPE_HANDLER
@@ -146,14 +146,14 @@ if (!PyFPE_counter++ && setjmp(PyFPE_jbuf)) { \
* this statement so that it gets executed *before* the unsafe expression
* which we're trying to protect. That pretty well messes things up,
* of course.
*
*
* If the expression(s) you're trying to protect don't happen to return a
* value, you will need to manufacture a dummy result just to preserve the
* correct ordering of statements. Note that the macro passes the address
* of its argument (so you need to give it something which is addressable).
* If your expression returns multiple results, pass the last such result
* to PyFPE_END_PROTECT.
*
*
* Note that PyFPE_dummy returns a double, which is cast to int.
* This seeming insanity is to tickle the Floating Point Unit (FPU).
* If an exception has occurred in a preceding floating point operation,

View File

@@ -63,10 +63,10 @@
# if defined(__LP64__)
/* MacOSX 10.4 (the first release to support 64-bit code
* at all) only supports 64-bit in the UNIX layer.
* Therefore surpress the toolbox-glue in 64-bit mode.
* Therefore suppress the toolbox-glue in 64-bit mode.
*/
/* In 64-bit mode setpgrp always has no argments, in 32-bit
/* In 64-bit mode setpgrp always has no arguments, in 32-bit
* mode that depends on the compilation environment
*/
# undef SETPGRP_HAVE_ARG
@@ -91,7 +91,7 @@
*
* Specifically: OSX 10.4 has limited supported for '%zd', while
* 10.5 has full support for '%zd'. A binary built on 10.5 won't
* work properly on 10.4 unless we surpress the definition
* work properly on 10.4 unless we suppress the definition
* of PY_FORMAT_SIZE_T
*/
#undef PY_FORMAT_SIZE_T

View File

@@ -9,9 +9,24 @@
#include <Carbon/Carbon.h>
#ifndef __LP64__
/*
** Issue #27806: Workaround for gcc 4.x which does not have _has_include.
*/
#ifndef __has_include
#define __has_include(x) 0
#endif
/* Workaround */
#if __has_include(<Availability.h>)
#include <Availability.h>
#define APPLE_SUPPORTS_QUICKTIME (__MAC_OS_X_VERSION_MAX_ALLOWED < 101200) && !__LP64__
#else
#define APPLE_SUPPORTS_QUICKTIME !__LP64__
#endif
#if APPLE_SUPPORTS_QUICKTIME
#include <QuickTime/QuickTime.h>
#endif /* !__LP64__ */
#endif /* APPLE_SUPPORTS_QUICKTIME */
/*
** Helper routines for error codes and such.
@@ -21,10 +36,10 @@ extern PyObject *PyMac_OSErrException; /* Exception for OSErr */
PyObject *PyMac_GetOSErrException(void); /* Initialize & return it */
PyObject *PyErr_Mac(PyObject *, int); /* Exception with a mac error */
PyObject *PyMac_Error(OSErr); /* Uses PyMac_GetOSErrException */
#ifndef __LP64__
#if APPLE_SUPPORTS_QUICKTIME
extern OSErr PyMac_GetFullPathname(FSSpec *, char *, int); /* convert
fsspec->path */
#endif /* __LP64__ */
#endif /* APPLE_SUPPORTS_QUICKTIME */
/*
** These conversion routines are defined in mactoolboxglue.c itself.
@@ -109,54 +124,54 @@ extern PyObject *CmpInstObj_New(ComponentInstance);
extern int CmpInstObj_Convert(PyObject *, ComponentInstance *);
/* Ctl exports */
#ifndef __LP64__
#if APPLE_SUPPORTS_QUICKTIME
extern PyObject *CtlObj_New(ControlHandle);
extern int CtlObj_Convert(PyObject *, ControlHandle *);
#endif /* !__LP64__ */
#endif /* APPLE_SUPPORTS_QUICKTIME */
/* Dlg exports */
#ifndef __LP64__
#if APPLE_SUPPORTS_QUICKTIME
extern PyObject *DlgObj_New(DialogPtr);
extern int DlgObj_Convert(PyObject *, DialogPtr *);
extern PyObject *DlgObj_WhichDialog(DialogPtr);
#endif /* !__LP64__ */
#endif /* APPLE_SUPPORTS_QUICKTIME */
/* Drag exports */
#ifndef __LP64__
#if APPLE_SUPPORTS_QUICKTIME
extern PyObject *DragObj_New(DragReference);
extern int DragObj_Convert(PyObject *, DragReference *);
#endif /* !__LP64__ */
#endif /* APPLE_SUPPORTS_QUICKTIME */
/* List exports */
#ifndef __LP64__
#if APPLE_SUPPORTS_QUICKTIME
extern PyObject *ListObj_New(ListHandle);
extern int ListObj_Convert(PyObject *, ListHandle *);
#endif /* !__LP64__ */
#endif /* APPLE_SUPPORTS_QUICKTIME */
/* Menu exports */
#ifndef __LP64__
#if APPLE_SUPPORTS_QUICKTIME
extern PyObject *MenuObj_New(MenuHandle);
extern int MenuObj_Convert(PyObject *, MenuHandle *);
#endif /* !__LP64__ */
#endif /* APPLE_SUPPORTS_QUICKTIME */
/* Qd exports */
#ifndef __LP64__
#if APPLE_SUPPORTS_QUICKTIME
extern PyObject *GrafObj_New(GrafPtr);
extern int GrafObj_Convert(PyObject *, GrafPtr *);
extern PyObject *BMObj_New(BitMapPtr);
extern int BMObj_Convert(PyObject *, BitMapPtr *);
extern PyObject *QdRGB_New(RGBColor *);
extern int QdRGB_Convert(PyObject *, RGBColor *);
#endif /* !__LP64__ */
#endif /* APPLE_SUPPORTS_QUICKTIME */
/* Qdoffs exports */
#ifndef __LP64__
#if APPLE_SUPPORTS_QUICKTIME
extern PyObject *GWorldObj_New(GWorldPtr);
extern int GWorldObj_Convert(PyObject *, GWorldPtr *);
#endif /* !__LP64__ */
#endif /* APPLE_SUPPORTS_QUICKTIME */
/* Qt exports */
#ifndef __LP64__
#if APPLE_SUPPORTS_QUICKTIME
extern PyObject *TrackObj_New(Track);
extern int TrackObj_Convert(PyObject *, Track *);
extern PyObject *MovieObj_New(Movie);
@@ -169,7 +184,7 @@ extern PyObject *UserDataObj_New(UserData);
extern int UserDataObj_Convert(PyObject *, UserData *);
extern PyObject *MediaObj_New(Media);
extern int MediaObj_Convert(PyObject *, Media *);
#endif /* !__LP64__ */
#endif /* APPLE_SUPPORTS_QUICKTIME */
/* Res exports */
extern PyObject *ResObj_New(Handle);
@@ -178,17 +193,17 @@ extern PyObject *OptResObj_New(Handle);
extern int OptResObj_Convert(PyObject *, Handle *);
/* TE exports */
#ifndef __LP64__
#if APPLE_SUPPORTS_QUICKTIME
extern PyObject *TEObj_New(TEHandle);
extern int TEObj_Convert(PyObject *, TEHandle *);
#endif /* !__LP64__ */
#endif /* APPLE_SUPPORTS_QUICKTIME */
/* Win exports */
#ifndef __LP64__
#if APPLE_SUPPORTS_QUICKTIME
extern PyObject *WinObj_New(WindowPtr);
extern int WinObj_Convert(PyObject *, WindowPtr *);
extern PyObject *WinObj_WhichWindow(WindowPtr);
#endif /* !__LP64__ */
#endif /* APPLE_SUPPORTS_QUICKTIME */
/* CF exports */
extern PyObject *CFObj_New(CFTypeRef);

View File

@@ -29,11 +29,11 @@ extern double hypot(double, double);
/* extra declarations */
#ifndef _MSC_VER
#ifndef __STDC__
//extern double fmod (double, double);
//extern double frexp (double, int *);
//extern double ldexp (double, int);
//extern double modf (double, double *);
//extern double pow(double, double);
extern double fmod (double, double);
extern double frexp (double, int *);
extern double ldexp (double, int);
extern double modf (double, double *);
extern double pow(double, double);
#endif /* __STDC__ */
#endif /* _MSC_VER */
@@ -43,7 +43,7 @@ extern int finite(double);
extern double copysign(double, double);
#endif
/* High precision defintion of pi and e (Euler)
/* High precision definition of pi and e (Euler)
* The values are taken from libc6's math.h.
*/
#ifndef Py_MATH_PIl
@@ -152,7 +152,29 @@ PyAPI_FUNC(void) _Py_set_387controlword(unsigned short);
* doesn't support NaNs.
*/
#if !defined(Py_NAN) && !defined(Py_NO_NAN)
#define Py_NAN (Py_HUGE_VAL * 0.)
#if !defined(__INTEL_COMPILER)
#define Py_NAN (Py_HUGE_VAL * 0.)
#else /* __INTEL_COMPILER */
#if defined(ICC_NAN_STRICT)
#pragma float_control(push)
#pragma float_control(precise, on)
#pragma float_control(except, on)
#if defined(_MSC_VER)
__declspec(noinline)
#else /* Linux */
__attribute__((noinline))
#endif /* _MSC_VER */
static double __icc_nan()
{
return sqrt(-1.0);
}
#pragma float_control (pop)
#define Py_NAN __icc_nan()
#else /* ICC_NAN_RELAXED as default for Intel Compiler */
static union { unsigned char buf[8]; double __icc_nan; } __nan_store = {0,0,0,0,0,0,0xf8,0x7f};
#define Py_NAN (__nan_store.__icc_nan)
#endif /* ICC_NAN_STRICT */
#endif /* __INTEL_COMPILER */
#endif
/* Py_OVERFLOWED(X)

View File

@@ -72,9 +72,9 @@ PyAPI_FUNC(void) PyMem_Free(void *);
/* Returns NULL to indicate error if a negative size or size larger than
Py_ssize_t can represent is supplied. Helps prevents security holes. */
#define PyMem_MALLOC(n) ((size_t)(n) > (size_t)PY_SSIZE_T_MAX ? NULL \
: malloc((n) ? (n) : 1))
: malloc(((n) != 0) ? (n) : 1))
#define PyMem_REALLOC(p, n) ((size_t)(n) > (size_t)PY_SSIZE_T_MAX ? NULL \
: realloc((p), (n) ? (n) : 1))
: realloc((p), ((n) != 0) ? (n) : 1))
#define PyMem_FREE free
#endif /* PYMALLOC_DEBUG */

View File

@@ -93,9 +93,12 @@ Used in: PY_LONG_LONG
* uint32_t to be such a type unless stdint.h or inttypes.h defines uint32_t.
* However, it doesn't set HAVE_UINT32_T, so we do that here.
*/
#if (defined UINT32_MAX || defined uint32_t)
#ifndef PY_UINT32_T
#ifdef uint32_t
#define HAVE_UINT32_T 1
#endif
#ifdef HAVE_UINT32_T
#ifndef PY_UINT32_T
#define PY_UINT32_T uint32_t
#endif
#endif
@@ -103,23 +106,33 @@ Used in: PY_LONG_LONG
/* Macros for a 64-bit unsigned integer type; used for type 'twodigits' in the
* long integer implementation, when 30-bit digits are enabled.
*/
#if (defined UINT64_MAX || defined uint64_t)
#ifndef PY_UINT64_T
#ifdef uint64_t
#define HAVE_UINT64_T 1
#endif
#ifdef HAVE_UINT64_T
#ifndef PY_UINT64_T
#define PY_UINT64_T uint64_t
#endif
#endif
/* Signed variants of the above */
#if (defined INT32_MAX || defined int32_t)
#ifndef PY_INT32_T
#ifdef int32_t
#define HAVE_INT32_T 1
#endif
#ifdef HAVE_INT32_T
#ifndef PY_INT32_T
#define PY_INT32_T int32_t
#endif
#endif
#if (defined INT64_MAX || defined int64_t)
#ifndef PY_INT64_T
#ifdef int64_t
#define HAVE_INT64_T 1
#endif
#ifdef HAVE_INT64_T
#ifndef PY_INT64_T
#define PY_INT64_T int64_t
#endif
#endif
@@ -252,7 +265,7 @@ typedef Py_intptr_t Py_ssize_t;
* for platforms that support that.
*
* If PY_LOCAL_AGGRESSIVE is defined before python.h is included, more
* "aggressive" inlining/optimizaion is enabled for the entire module. This
* "aggressive" inlining/optimization is enabled for the entire module. This
* may lead to code bloat, and may slow things down for those reasons. It may
* also lead to errors, if the code relies on pointer aliasing. Use with
* care.
@@ -272,8 +285,8 @@ typedef Py_intptr_t Py_ssize_t;
/* ignore warnings if the compiler decides not to inline a function */
#pragma warning(disable: 4710)
/* fastest possible local call under MSVC */
#define Py_LOCAL(type) static type
#define Py_LOCAL_INLINE(type) static __inline type
#define Py_LOCAL(type) static type __fastcall
#define Py_LOCAL_INLINE(type) static __inline type __fastcall
#elif defined(USE_INLINE)
#define Py_LOCAL(type) static type
#define Py_LOCAL_INLINE(type) static inline type
@@ -549,6 +562,30 @@ extern "C" {
_Py_set_387controlword(old_387controlword)
#endif
/* get and set x87 control word for VisualStudio/x86 */
#if defined(_MSC_VER) && !defined(_WIN64) /* x87 not supported in 64-bit */
#define HAVE_PY_SET_53BIT_PRECISION 1
#define _Py_SET_53BIT_PRECISION_HEADER \
unsigned int old_387controlword, new_387controlword, out_387controlword
/* We use the __control87_2 function to set only the x87 control word.
The SSE control word is unaffected. */
#define _Py_SET_53BIT_PRECISION_START \
do { \
__control87_2(0, 0, &old_387controlword, NULL); \
new_387controlword = \
(old_387controlword & ~(_MCW_PC | _MCW_RC)) | (_PC_53 | _RC_NEAR); \
if (new_387controlword != old_387controlword) \
__control87_2(new_387controlword, _MCW_PC | _MCW_RC, \
&out_387controlword, NULL); \
} while (0)
#define _Py_SET_53BIT_PRECISION_END \
do { \
if (new_387controlword != old_387controlword) \
__control87_2(old_387controlword, _MCW_PC | _MCW_RC, \
&out_387controlword, NULL); \
} while (0)
#endif
/* default definitions are empty */
#ifndef HAVE_PY_SET_53BIT_PRECISION
#define _Py_SET_53BIT_PRECISION_HEADER
@@ -622,7 +659,7 @@ extern char * _getpty(int *, int, mode_t, int);
/* On QNX 6, struct termio must be declared by including sys/termio.h
if TCGETA, TCSETA, TCSETAW, or TCSETAF are used. sys/termio.h must
be included before termios.h or it will generate an error. */
#ifdef HAVE_SYS_TERMIO_H
#if defined(HAVE_SYS_TERMIO_H) && !defined(__hpux)
#include <sys/termio.h>
#endif
@@ -665,7 +702,9 @@ extern int fdatasync(int);
#ifdef __FreeBSD__
#include <osreldate.h>
#if __FreeBSD_version > 500039
#if (__FreeBSD_version >= 500040 && __FreeBSD_version < 602113) || \
(__FreeBSD_version >= 700000 && __FreeBSD_version < 700054) || \
(__FreeBSD_version >= 800000 && __FreeBSD_version < 800001)
# define _PY_PORT_CTYPE_UTF8_ISSUE
#endif
#endif
@@ -676,6 +715,12 @@ extern int fdatasync(int);
#endif
#ifdef _PY_PORT_CTYPE_UTF8_ISSUE
#ifndef __cplusplus
/* The workaround below is unsafe in C++ because
* the <locale> defines these symbols as real functions,
* with a slightly different signature.
* See issue #10910
*/
#include <ctype.h>
#include <wctype.h>
#undef isalnum
@@ -693,6 +738,7 @@ extern int fdatasync(int);
#undef toupper
#define toupper(c) towupper(btowc(c))
#endif
#endif
/* Declarations for symbol visibility.
@@ -900,5 +946,24 @@ typedef struct fd_set {
#ifndef Py_ULL
#define Py_ULL(x) Py_LL(x##U)
#endif
#ifdef Py_BUILD_CORE
/*
* Macros to protect CRT calls against instant termination when passed an
* invalid parameter (issue23524).
*/
#if defined _MSC_VER && _MSC_VER >= 1900
extern _invalid_parameter_handler _Py_silent_invalid_parameter_handler;
#define _Py_BEGIN_SUPPRESS_IPH { _invalid_parameter_handler _Py_old_handler = \
_set_thread_local_invalid_parameter_handler(_Py_silent_invalid_parameter_handler);
#define _Py_END_SUPPRESS_IPH _set_thread_local_invalid_parameter_handler(_Py_old_handler); }
#else
#define _Py_BEGIN_SUPPRESS_IPH
#define _Py_END_SUPPRESS_IPH
#endif /* _MSC_VER >= 1900 */
#endif /* Py_BUILD_CORE */
#endif /* Py_PYPORT_H */

View File

@@ -95,6 +95,9 @@ typedef struct _ts {
PyObject *async_exc; /* Asynchronous exception to raise */
long thread_id; /* Thread id where this tstate was created */
int trash_delete_nesting;
PyObject *trash_delete_later;
/* XXX signal handlers should also be here */
} PyThreadState;

View File

@@ -111,11 +111,10 @@ PyAPI_FUNC(const char *) Py_GetPlatform(void);
PyAPI_FUNC(const char *) Py_GetCopyright(void);
PyAPI_FUNC(const char *) Py_GetCompiler(void);
PyAPI_FUNC(const char *) Py_GetBuildInfo(void);
PyAPI_FUNC(const char *) _Py_svnversion(void);
PyAPI_FUNC(const char *) Py_SubversionRevision(void);
PyAPI_FUNC(const char *) Py_SubversionShortBranch(void);
PyAPI_FUNC(const char *) _Py_hgidentifier(void);
PyAPI_FUNC(const char *) _Py_hgversion(void);
PyAPI_FUNC(const char *) _Py_gitidentifier(void);
PyAPI_FUNC(const char *) _Py_gitversion(void);
/* Internal -- various one-time initializations */
PyAPI_FUNC(PyObject *) _PyBuiltin_Init(void);
@@ -145,6 +144,7 @@ PyAPI_FUNC(void) PyInt_Fini(void);
PyAPI_FUNC(void) PyFloat_Fini(void);
PyAPI_FUNC(void) PyOS_FiniInterrupts(void);
PyAPI_FUNC(void) PyByteArray_Fini(void);
PyAPI_FUNC(void) _PyRandom_Fini(void);
/* Stuff with no proper home (yet) */
PyAPI_FUNC(char *) PyOS_Readline(FILE *, FILE *, char *);
@@ -154,7 +154,7 @@ PyAPI_DATA(PyThreadState*) _PyOS_ReadlineTState;
/* Stack size, in "pointers" (so we get extra safety margins
on 64-bit platforms). On a 32-bit platform, this translates
to a 8k margin. */
to an 8k margin. */
#define PYOS_STACK_MARGIN 2048
#if defined(WIN32) && !defined(MS_WIN64) && defined(_MSC_VER) && _MSC_VER >= 1300

View File

@@ -38,6 +38,12 @@ PyAPI_FUNC(int) PySlice_GetIndicesEx(PySliceObject *r, Py_ssize_t length,
Py_ssize_t *start, Py_ssize_t *stop,
Py_ssize_t *step, Py_ssize_t *slicelength);
PyAPI_FUNC(int) _PySlice_Unpack(PyObject *slice,
Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step);
PyAPI_FUNC(Py_ssize_t) _PySlice_AdjustIndices(Py_ssize_t length,
Py_ssize_t *start, Py_ssize_t *stop,
Py_ssize_t step);
#ifdef __cplusplus
}
#endif

View File

@@ -129,7 +129,7 @@ PyAPI_FUNC(PyObject*) PyString_AsEncodedObject(
/* Encodes a string object and returns the result as Python string
object.
If the codec returns an Unicode object, the object is converted
If the codec returns a Unicode object, the object is converted
back to a string using the default encoding.
DEPRECATED - use PyString_AsEncodedObject() instead. */
@@ -152,7 +152,7 @@ PyAPI_FUNC(PyObject*) PyString_AsDecodedObject(
/* Decodes a string object and returns the result as Python string
object.
If the codec returns an Unicode object, the object is converted
If the codec returns a Unicode object, the object is converted
back to a string using the default encoding.
DEPRECATED - use PyString_AsDecodedObject() instead. */
@@ -164,7 +164,7 @@ PyAPI_FUNC(PyObject*) PyString_AsDecodedString(
);
/* Provides access to the internal data buffer and size of a string
object or the default encoded version of an Unicode object. Passing
object or the default encoded version of a Unicode object. Passing
NULL as *len parameter will force the string buffer to be
0-terminated (passing a string with embedded NULL characters will
cause an exception). */

View File

@@ -19,13 +19,12 @@ PyAPI_FUNC(void) PySys_WriteStdout(const char *format, ...)
PyAPI_FUNC(void) PySys_WriteStderr(const char *format, ...)
Py_GCC_ATTRIBUTE((format(printf, 1, 2)));
PyAPI_DATA(PyObject *) _PySys_TraceFunc, *_PySys_ProfileFunc;
PyAPI_DATA(int) _PySys_CheckInterval;
PyAPI_FUNC(void) PySys_ResetWarnOptions(void);
PyAPI_FUNC(void) PySys_AddWarnOption(char *);
PyAPI_FUNC(int) PySys_HasWarnOptions(void);
PyAPI_FUNC(size_t) _PySys_GetSizeOf(PyObject *);
#ifdef __cplusplus
}
#endif

View File

@@ -16,6 +16,9 @@ extern "C" {
*/
PyAPI_FUNC(time_t) _PyTime_DoubleToTimet(double x);
/* Get the current time since the epoch in seconds */
PyAPI_FUNC(double) _PyTime_FloatTime(void);
#ifdef __cplusplus
}

View File

@@ -395,7 +395,7 @@ typedef PY_UNICODE_TYPE Py_UNICODE;
#define Py_UNICODE_FILL(target, value, length) \
do {Py_ssize_t i_; Py_UNICODE *t_ = (target); Py_UNICODE v_ = (value);\
for (i_ = 0; i_ < (length); i_++) t_[i_] = v_;\
for (i_ = 0; i_ < (length); i_++) t_[i_] = v_;\
} while (0)
/* Check if substring matches at given offset. the offset must be
@@ -513,7 +513,7 @@ PyAPI_FUNC(int) PyUnicode_Resize(
Py_ssize_t length /* New length */
);
/* Coerce obj to an Unicode object and return a reference with
/* Coerce obj to a Unicode object and return a reference with
*incremented* refcount.
Coercion is done in the following way:
@@ -536,7 +536,7 @@ PyAPI_FUNC(PyObject*) PyUnicode_FromEncodedObject(
const char *errors /* error handling */
);
/* Coerce obj to an Unicode object and return a reference with
/* Coerce obj to a Unicode object and return a reference with
*incremented* refcount.
Unicode objects are passed back as-is (subclasses are converted to
@@ -1138,7 +1138,7 @@ PyAPI_FUNC(int) PyUnicode_EncodeDecimal(
These are capable of handling Unicode objects and strings on input
(we refer to them as strings in the descriptions) and return
Unicode objects or integers as apporpriate. */
Unicode objects or integers as appropriate. */
/* Concat two strings giving a new Unicode string. */
@@ -1288,7 +1288,7 @@ PyAPI_FUNC(int) PyUnicode_Compare(
/* Rich compare two strings and return one of the following:
- NULL in case an exception was raised
- Py_True or Py_False for successfuly comparisons
- Py_True or Py_False for successful comparisons
- Py_NotImplemented in case the type combination is unknown
Note that Py_EQ and Py_NE comparisons can cause a UnicodeWarning in
@@ -1307,7 +1307,7 @@ PyAPI_FUNC(PyObject *) PyUnicode_RichCompare(
int op /* Operation: Py_EQ, Py_NE, Py_GT, etc. */
);
/* Apply a argument tuple or dictionary to a format string and return
/* Apply an argument tuple or dictionary to a format string and return
the resulting Unicode string. */
PyAPI_FUNC(PyObject *) PyUnicode_Format(
@@ -1318,7 +1318,7 @@ PyAPI_FUNC(PyObject *) PyUnicode_Format(
/* Checks whether element is contained in container and return 1/0
accordingly.
element has to coerce to an one element Unicode string. -1 is
element has to coerce to a one element Unicode string. -1 is
returned in case of an error. */
PyAPI_FUNC(int) PyUnicode_Contains(

View File

@@ -49,9 +49,6 @@ PyAPI_DATA(PyTypeObject) _PyWeakref_CallableProxyType;
((Py_TYPE(op) == &_PyWeakref_ProxyType) || \
(Py_TYPE(op) == &_PyWeakref_CallableProxyType))
/* This macro calls PyWeakref_CheckRef() last since that can involve a
function call; this makes it more likely that the function call
will be avoided. */
#define PyWeakref_Check(op) \
(PyWeakref_CheckRef(op) || PyWeakref_CheckProxy(op))
@@ -66,7 +63,17 @@ PyAPI_FUNC(Py_ssize_t) _PyWeakref_GetWeakrefCount(PyWeakReference *head);
PyAPI_FUNC(void) _PyWeakref_ClearRef(PyWeakReference *self);
#define PyWeakref_GET_OBJECT(ref) (((PyWeakReference *)(ref))->wr_object)
/* Explanation for the Py_REFCNT() check: when a weakref's target is part
of a long chain of deallocations which triggers the trashcan mechanism,
clearing the weakrefs can be delayed long after the target's refcount
has dropped to zero. In the meantime, code accessing the weakref will
be able to "see" the target object even though it is supposed to be
unreachable. See issue #16602. */
#define PyWeakref_GET_OBJECT(ref) \
(Py_REFCNT(((PyWeakReference *)(ref))->wr_object) > 0 \
? ((PyWeakReference *)(ref))->wr_object \
: Py_None)
#ifdef __cplusplus

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.