[Python-checkins] python/dist/src/Include abstract.h, 2.44.2.2, 2.44.2.3 ceval.h, 2.44.18.2, 2.44.18.3 errcode.h, 2.14.28.1, 2.14.28.2 floatobject.h, 2.20.14.1, 2.20.14.2 graminit.h, 2.19.2.2, 2.19.2.3 import.h, 2.27.28.2, 2.27.28.3 marshal.h, 2.11.26.2, 2.11.26.3 modsupport.h, 2.38.10.2, 2.38.10.3 object.h, 2.101.2.2, 2.101.2.3 objimpl.h, 2.55.2.2, 2.55.2.3 pyerrors.h, 2.54.2.3, 2.54.2.4 pyport.h, 2.51.2.3, 2.51.2.4 pystate.h, 2.18.18.2, 2.18.18.3 pythonrun.h, 2.49.2.8, 2.49.2.9 setobject.h, 2.5.4.1, 2.5.4.2 structmember.h, 2.19.8.2, 2.19.8.3 unicodeobject.h, 2.38.2.2, 2.38.2.3

jhylton@users.sourceforge.net jhylton at users.sourceforge.net
Sun Oct 16 07:24:33 CEST 2005


Update of /cvsroot/python/python/dist/src/Include
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27718/Include

Modified Files:
      Tag: ast-branch
	abstract.h ceval.h errcode.h floatobject.h graminit.h import.h 
	marshal.h modsupport.h object.h objimpl.h pyerrors.h pyport.h 
	pystate.h pythonrun.h setobject.h structmember.h 
	unicodeobject.h 
Log Message:
Merge head to branch (for the last time)


Index: abstract.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/abstract.h,v
retrieving revision 2.44.2.2
retrieving revision 2.44.2.3
diff -u -d -r2.44.2.2 -r2.44.2.3
--- abstract.h	7 Jan 2005 06:57:41 -0000	2.44.2.2
+++ abstract.h	16 Oct 2005 05:23:59 -0000	2.44.2.3
@@ -422,6 +422,21 @@
      PyAPI_FUNC(int) PyObject_Length(PyObject *o);
 #define PyObject_Length PyObject_Size
 
+     PyAPI_FUNC(int) _PyObject_LengthCue(PyObject *o);
+
+       /*
+         Return the size of object o.  If the object, o, provides
+	 both sequence and mapping protocols, the sequence size is
+	 returned. On error, -1 is returned.  If the object provides
+	 a _length_cue() method, its value is returned.  This is the 
+	 equivalent to the Python expression: 
+		try:
+			return len(o)
+		except (AttributeError, TypeError):
+			if hasattr(o, '_length_cue'):
+				return o._length_cue()
+			raise
+       */
 
      PyAPI_FUNC(PyObject *) PyObject_GetItem(PyObject *o, PyObject *key);
 

Index: ceval.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/ceval.h,v
retrieving revision 2.44.18.2
retrieving revision 2.44.18.3
diff -u -d -r2.44.18.2 -r2.44.18.3
--- ceval.h	7 Jan 2005 06:57:41 -0000	2.44.18.2
+++ ceval.h	16 Oct 2005 05:23:59 -0000	2.44.18.3
@@ -65,6 +65,7 @@
 
 PyAPI_FUNC(PyObject *) PyEval_GetCallStats(PyObject *);
 PyAPI_FUNC(PyObject *) PyEval_EvalFrame(struct _frame *);
+PyAPI_FUNC(PyObject *) PyEval_EvalFrameEx(struct _frame *f, int exc);
 
 /* this used to be handled on a per-thread basis - now just two globals */
 PyAPI_DATA(volatile int) _Py_Ticker;

Index: errcode.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/errcode.h,v
retrieving revision 2.14.28.1
retrieving revision 2.14.28.2
diff -u -d -r2.14.28.1 -r2.14.28.2
--- errcode.h	28 Apr 2003 17:32:58 -0000	2.14.28.1
+++ errcode.h	16 Oct 2005 05:23:59 -0000	2.14.28.2
@@ -28,6 +28,7 @@
 #define E_DECODE	22	/* Error in decoding into Unicode */
 #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 */
 
 #ifdef __cplusplus
 }

Index: floatobject.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/floatobject.h,v
retrieving revision 2.20.14.1
retrieving revision 2.20.14.2
diff -u -d -r2.20.14.1 -r2.20.14.2
--- floatobject.h	28 Apr 2003 17:32:58 -0000	2.20.14.1
+++ floatobject.h	16 Oct 2005 05:23:59 -0000	2.20.14.2
@@ -55,13 +55,18 @@
  * routines produce a C double from such a string.  The suffix (4 or 8)
  * specifies the number of bytes in the string.
  *
- * Excepting NaNs and infinities (which aren't handled correctly), the 4-
- * byte format is identical to the IEEE-754 single precision format, and
- * the 8-byte format to the IEEE-754 double precision format.  On non-
- * IEEE platforms with more precision, or larger dynamic range, than
- * 754 supports, not all values can be packed; on non-IEEE platforms with
- * less precision, or smaller dynamic range, not all values can be
- * unpacked.  What happens in such cases is partly accidental (alas).
+ * On platforms that appear to use (see _PyFloat_Init()) IEEE-754 formats
+ * these functions work by copying bits.  On other platforms, the formats the
+ * 4- byte format is identical to the IEEE-754 single precision format, and
+ * the 8-byte format to the IEEE-754 double precision format, although the
+ * packing of INFs and NaNs (if such things exist on the platform) isn't
+ * handled correctly, and attempting to unpack a string containing an IEEE
+ * INF or NaN will raise an exception.
+ *
+ * On non-IEEE platforms with more precision, or larger dynamic range, than
+ * 754 supports, not all values can be packed; on non-IEEE platforms with less
+ * precision, or smaller dynamic range, not all values can be unpacked.  What
+ * happens in such cases is partly accidental (alas).
  */
 
 /* The pack routines write 4 or 8 bytes, starting at p.  le is a bool
@@ -70,8 +75,9 @@
  * first, at p).
  * Return value:  0 if all is OK, -1 if error (and an exception is
  * set, most likely OverflowError).
- * Bug:  What this does is undefined if x is a NaN or infinity.
- * Bug:  -0.0 and +0.0 produce the same string.
+ * There are two problems on non-IEEE platforms:
+ * 1):  What this does is undefined if x is a NaN or infinity.
+ * 2):  -0.0 and +0.0 produce the same string.
  */
 PyAPI_FUNC(int) _PyFloat_Pack4(double x, unsigned char *p, int le);
 PyAPI_FUNC(int) _PyFloat_Pack8(double x, unsigned char *p, int le);
@@ -81,9 +87,8 @@
  * last, at p+3 or p+7), false if big-endian (exponent first, at p).
  * Return value:  The unpacked double.  On error, this is -1.0 and
  * PyErr_Occurred() is true (and an exception is set, most likely
- * OverflowError).
- * Bug:  What this does is undefined if the string represents a NaN or
- * infinity.
+ * OverflowError).  Note that on a non-IEEE platform this will refuse
+ * to unpack a string that represents a NaN or infinity.
  */
 PyAPI_FUNC(double) _PyFloat_Unpack4(const unsigned char *p, int le);
 PyAPI_FUNC(double) _PyFloat_Unpack8(const unsigned char *p, int le);

Index: graminit.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/graminit.h,v
retrieving revision 2.19.2.2
retrieving revision 2.19.2.3
diff -u -d -r2.19.2.2 -r2.19.2.3
--- graminit.h	7 Jan 2005 06:57:41 -0000	2.19.2.2
+++ graminit.h	16 Oct 2005 05:23:59 -0000	2.19.2.3
@@ -76,3 +76,4 @@
 #define gen_if 331
 #define testlist1 332
 #define encoding_decl 333
+#define yield_expr 334

Index: import.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/import.h,v
retrieving revision 2.27.28.2
retrieving revision 2.27.28.3
diff -u -d -r2.27.28.2 -r2.27.28.3
--- import.h	7 Jan 2005 06:57:41 -0000	2.27.28.2
+++ import.h	16 Oct 2005 05:23:59 -0000	2.27.28.3
@@ -24,6 +24,7 @@
 PyAPI_FUNC(struct filedescr *) _PyImport_FindModule(
 	const char *, PyObject *, char *, size_t, FILE **, PyObject **);
 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 *);

Index: marshal.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/marshal.h,v
retrieving revision 2.11.26.2
retrieving revision 2.11.26.3
diff -u -d -r2.11.26.2 -r2.11.26.3
--- marshal.h	7 Jan 2005 06:57:42 -0000	2.11.26.2
+++ marshal.h	16 Oct 2005 05:23:59 -0000	2.11.26.3
@@ -7,7 +7,7 @@
 extern "C" {
 #endif
 
-#define Py_MARSHAL_VERSION 1
+#define Py_MARSHAL_VERSION 2
 
 PyAPI_FUNC(void) PyMarshal_WriteLongToFile(long, FILE *, int);
 PyAPI_FUNC(void) PyMarshal_WriteObjectToFile(PyObject *, FILE *, int);

Index: modsupport.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/modsupport.h,v
retrieving revision 2.38.10.2
retrieving revision 2.38.10.3
diff -u -d -r2.38.10.2 -r2.38.10.3
--- modsupport.h	7 Jan 2005 06:57:42 -0000	2.38.10.2
+++ modsupport.h	16 Oct 2005 05:23:59 -0000	2.38.10.3
@@ -15,6 +15,7 @@
                                                   char *, char **, ...);
 PyAPI_FUNC(int) PyArg_UnpackTuple(PyObject *, char *, int, int, ...);
 PyAPI_FUNC(PyObject *) Py_BuildValue(char *, ...);
+PyAPI_FUNC(int) _PyArg_NoKeywords(char *funcname, PyObject *kw);
 
 PyAPI_FUNC(int) PyArg_VaParse(PyObject *, char *, va_list);
 PyAPI_FUNC(int) PyArg_VaParseTupleAndKeywords(PyObject *, PyObject *,

Index: object.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/object.h,v
retrieving revision 2.101.2.2
retrieving revision 2.101.2.3
diff -u -d -r2.101.2.2 -r2.101.2.3
--- object.h	7 Jan 2005 06:57:42 -0000	2.101.2.2
+++ object.h	16 Oct 2005 05:23:59 -0000	2.101.2.3
@@ -371,6 +371,7 @@
 PyAPI_FUNC(int) PyObject_Print(PyObject *, FILE *, int);
 PyAPI_FUNC(void) _PyObject_Dump(PyObject *);
 PyAPI_FUNC(PyObject *) PyObject_Repr(PyObject *);
+PyAPI_FUNC(PyObject *) _PyObject_Str(PyObject *);
 PyAPI_FUNC(PyObject *) PyObject_Str(PyObject *);
 #ifdef Py_USING_UNICODE
 PyAPI_FUNC(PyObject *) PyObject_Unicode(PyObject *);

Index: objimpl.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/objimpl.h,v
retrieving revision 2.55.2.2
retrieving revision 2.55.2.3
diff -u -d -r2.55.2.2 -r2.55.2.3
--- objimpl.h	7 Jan 2005 06:57:42 -0000	2.55.2.2
+++ objimpl.h	16 Oct 2005 05:23:59 -0000	2.55.2.3
@@ -124,7 +124,7 @@
 #else	/* ! WITH_PYMALLOC */
 #define PyObject_MALLOC		PyMem_MALLOC
 #define PyObject_REALLOC	PyMem_REALLOC
-/* This is an odd one!  For backward compatability with old extensions, the
+/* This is an odd one!  For backward compatibility with old extensions, the
    PyMem "release memory" functions have to invoke the object allocator's
    free() function.  When pymalloc isn't enabled, that leaves us using
    the platform free(). */

Index: pyerrors.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/pyerrors.h,v
retrieving revision 2.54.2.3
retrieving revision 2.54.2.4
diff -u -d -r2.54.2.3 -r2.54.2.4
--- pyerrors.h	7 Jan 2005 06:57:42 -0000	2.54.2.3
+++ pyerrors.h	16 Oct 2005 05:23:59 -0000	2.54.2.4
@@ -15,6 +15,12 @@
 PyAPI_FUNC(void) PyErr_Fetch(PyObject **, PyObject **, PyObject **);
 PyAPI_FUNC(void) PyErr_Restore(PyObject *, PyObject *, PyObject *);
 
+#ifdef Py_DEBUG
+#define _PyErr_OCCURRED() PyErr_Occurred()
+#else
+#define _PyErr_OCCURRED() (_PyThreadState_Current->curexc_type)
+#endif
+
 /* Error testing and normalization */
 PyAPI_FUNC(int) PyErr_GivenExceptionMatches(PyObject *, PyObject *);
 PyAPI_FUNC(int) PyErr_ExceptionMatches(PyObject *);
@@ -25,6 +31,7 @@
 
 PyAPI_DATA(PyObject *) PyExc_Exception;
 PyAPI_DATA(PyObject *) PyExc_StopIteration;
+PyAPI_DATA(PyObject *) PyExc_GeneratorExit;
 PyAPI_DATA(PyObject *) PyExc_StandardError;
 PyAPI_DATA(PyObject *) PyExc_ArithmeticError;
 PyAPI_DATA(PyObject *) PyExc_LookupError;

Index: pyport.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/pyport.h,v
retrieving revision 2.51.2.3
retrieving revision 2.51.2.4
diff -u -d -r2.51.2.3 -r2.51.2.4
--- pyport.h	7 Jan 2005 06:57:42 -0000	2.51.2.3
+++ pyport.h	16 Oct 2005 05:23:59 -0000	2.51.2.4
@@ -297,7 +297,7 @@
  *    This isn't reliable.  See Py_OVERFLOWED comments.
  *    X is evaluated more than once.
  */
-#if defined(__FreeBSD__) || defined(__OpenBSD__)
+#if defined(__FreeBSD__) || defined(__OpenBSD__) || (defined(__hpux) && defined(__ia64))
 #define _Py_SET_EDOM_FOR_NAN(X) if (isnan(X)) errno = EDOM;
 #else
 #define _Py_SET_EDOM_FOR_NAN(X) ;

Index: pystate.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/pystate.h,v
retrieving revision 2.18.18.2
retrieving revision 2.18.18.3
diff -u -d -r2.18.18.2 -r2.18.18.3
--- pystate.h	7 Jan 2005 06:57:42 -0000	2.18.18.2
+++ pystate.h	16 Oct 2005 05:23:59 -0000	2.18.18.3
@@ -53,12 +53,16 @@
 #define PyTrace_C_RETURN 6
 
 typedef struct _ts {
+    /* See Python/ceval.c for comments explaining most fields */
 
     struct _ts *next;
     PyInterpreterState *interp;
 
     struct _frame *frame;
     int recursion_depth;
+    /* 'tracing' keeps track of the execution depth when tracing/profiling.
+       This is to prevent the actual trace/profile code from being recorded in
+       the trace/profile. */
     int tracing;
     int use_tracing;
 
@@ -75,7 +79,7 @@
     PyObject *exc_value;
     PyObject *exc_traceback;
 
-    PyObject *dict;
+    PyObject *dict;  /* Stores per-thread state */
 
     /* tick_counter is incremented whenever the check_interval ticker
      * reaches zero. The purpose is to give a useful measure of the number

Index: pythonrun.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/pythonrun.h,v
retrieving revision 2.49.2.8
retrieving revision 2.49.2.9
diff -u -d -r2.49.2.8 -r2.49.2.9
--- pythonrun.h	11 Oct 2005 22:03:13 -0000	2.49.2.8
+++ pythonrun.h	16 Oct 2005 05:23:59 -0000	2.49.2.9
@@ -115,6 +115,7 @@
 PyAPI_FUNC(void) _PyImportHooks_Init(void);
 PyAPI_FUNC(int) _PyFrame_Init(void);
 PyAPI_FUNC(int) _PyInt_Init(void);
+PyAPI_FUNC(void) _PyFloat_Init(void);
 
 /* Various internal finalizers */
 PyAPI_FUNC(void) _PyExc_Fini(void);
@@ -124,6 +125,7 @@
 PyAPI_FUNC(void) PyCFunction_Fini(void);
 PyAPI_FUNC(void) PyTuple_Fini(void);
 PyAPI_FUNC(void) PyList_Fini(void);
+PyAPI_FUNC(void) PySet_Fini(void);
 PyAPI_FUNC(void) PyString_Fini(void);
 PyAPI_FUNC(void) PyInt_Fini(void);
 PyAPI_FUNC(void) PyFloat_Fini(void);

Index: setobject.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/setobject.h,v
retrieving revision 2.5.4.1
retrieving revision 2.5.4.2
diff -u -d -r2.5.4.1 -r2.5.4.2
--- setobject.h	7 Jan 2005 06:57:42 -0000	2.5.4.1
+++ setobject.h	16 Oct 2005 05:23:59 -0000	2.5.4.2
@@ -1,4 +1,3 @@
-
 /* Set object interface */
 
 #ifndef Py_SETOBJECT_H
@@ -7,34 +6,83 @@
 extern "C" {
 #endif
 
+
 /*
-This data structure is shared by set and frozenset objects.
+There are three kinds of slots in the table:
+
+1. Unused:  key == NULL
+2. Active:  key != NULL and key != dummy
+3. Dummy:   key == dummy
+
+Note: .pop() abuses the hash field of an Unused or Dummy slot to
+hold a search finger.  The hash field of Unused or Dummy slots has
+no meaning otherwise.
 */
 
+#define PySet_MINSIZE 8
+
 typedef struct {
+	long hash;      /* cached hash code for the entry key */
+	PyObject *key;
+} setentry;
+
+
+/*
+This data structure is shared by set and frozenset objects.
+*/
+
+typedef struct _setobject PySetObject;
+struct _setobject {
 	PyObject_HEAD
-	PyObject *data;
-	long hash;	/* only used by frozenset objects */
-	PyObject *weakreflist; /* List of weak references */
 
-	/* Invariants:
-	 *     data is a dictionary whose values are all True.
-	 *     data points to the same dict for the whole life of the set.
-	 * For frozensets only:
-	 *     data is immutable.
-	 *     hash is the hash of the frozenset or -1 if not computed yet.
+	int fill;  /* # Active + # Dummy */
+	int used;  /* # Active */
+
+	/* The table contains mask + 1 slots, and that's a power of 2.
+	 * We store the mask instead of the size because the mask is more
+	 * frequently needed.
 	 */
-} PySetObject;
+	int mask;
+
+	/* table points to smalltable for small tables, else to
+	 * additional malloc'ed memory.  table is never NULL!  This rule
+	 * saves repeated runtime null-tests.
+	 */
+	setentry *table;
+	setentry *(*lookup)(PySetObject *so, PyObject *key, long hash);
+	setentry smalltable[PySet_MINSIZE];
+
+	long hash;		/* only used by frozenset objects */
+	PyObject *weakreflist;	/* List of weak references */
+};
 
 PyAPI_DATA(PyTypeObject) PySet_Type;
 PyAPI_DATA(PyTypeObject) PyFrozenSet_Type;
 
+/* Invariants for frozensets:
+ *     data is immutable.
+ *     hash is the hash of the frozenset or -1 if not computed yet.
+ * Invariants for sets:
+ *     hash is -1
+ */
+
 #define PyFrozenSet_CheckExact(ob) ((ob)->ob_type == &PyFrozenSet_Type)
+#define PyAnySet_CheckExact(ob) \
+	((ob)->ob_type == &PySet_Type || (ob)->ob_type == &PyFrozenSet_Type)
 #define PyAnySet_Check(ob) \
 	((ob)->ob_type == &PySet_Type || (ob)->ob_type == &PyFrozenSet_Type || \
 	  PyType_IsSubtype((ob)->ob_type, &PySet_Type) || \
 	  PyType_IsSubtype((ob)->ob_type, &PyFrozenSet_Type))
 
+PyAPI_FUNC(PyObject *) PySet_New(PyObject *);
+PyAPI_FUNC(PyObject *) PyFrozenSet_New(PyObject *);
+PyAPI_FUNC(int) PySet_Size(PyObject *anyset);
+#define PySet_GET_SIZE(so) (((PySetObject *)(so))->used)
+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);
+PyAPI_FUNC(PyObject *) PySet_Pop(PyObject *set);
+
 #ifdef __cplusplus
 }
 #endif

Index: structmember.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/structmember.h,v
retrieving revision 2.19.8.2
retrieving revision 2.19.8.3
diff -u -d -r2.19.8.2 -r2.19.8.3
--- structmember.h	7 Jan 2005 06:57:42 -0000	2.19.8.2
+++ structmember.h	16 Oct 2005 05:23:59 -0000	2.19.8.3
@@ -65,6 +65,10 @@
 #define T_OBJECT_EX	16	/* Like T_OBJECT, but raises AttributeError
 				   when the value is NULL, instead of
 				   converting to None. */
+#ifdef HAVE_LONG_LONG
+#define T_LONGLONG      17  
+#define T_ULONGLONG      18
+#endif /* HAVE_LONG_LONG */
 
 /* Flags */
 #define READONLY	1

Index: unicodeobject.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/unicodeobject.h,v
retrieving revision 2.38.2.2
retrieving revision 2.38.2.3
diff -u -d -r2.38.2.2 -r2.38.2.3
--- unicodeobject.h	7 Jan 2005 06:57:43 -0000	2.38.2.2
+++ unicodeobject.h	16 Oct 2005 05:23:59 -0000	2.38.2.3
@@ -797,6 +797,16 @@
     int length	 		/* Number of Py_UNICODE chars to encode */
     );
 
+/* --- Unicode Internal Codec ---------------------------------------------
+
+    Only for internal use in _codecsmodule.c */
+
+PyObject *_PyUnicode_DecodeUnicodeInternal(
+    const char *string,
+    int length,
+    const char *errors
+    );
+
 /* --- Latin-1 Codecs ----------------------------------------------------- 
 
    Note: Latin-1 corresponds to the first 256 Unicode ordinals.



More information about the Python-checkins mailing list