[Python-checkins] r46296 - in python/branches/blais-bytebuf: Include/pyport.h Lib/UserString.py Lib/test/string_tests.py Mac/OSX/BuildScript/scripts/postflight.patch-profile Makefile.pre.in Modules/itertoolsmodule.c Objects/stringobject.c Objects/unicodeobject.c Python/ceval.c Tools/unicode/gencodec.py configure configure.in setup.py

martin.blais python-checkins at python.org
Fri May 26 13:48:32 CEST 2006


Author: martin.blais
Date: Fri May 26 13:48:16 2006
New Revision: 46296

Modified:
   python/branches/blais-bytebuf/Include/pyport.h
   python/branches/blais-bytebuf/Lib/UserString.py
   python/branches/blais-bytebuf/Lib/test/string_tests.py
   python/branches/blais-bytebuf/Mac/OSX/BuildScript/scripts/postflight.patch-profile
   python/branches/blais-bytebuf/Makefile.pre.in
   python/branches/blais-bytebuf/Modules/itertoolsmodule.c
   python/branches/blais-bytebuf/Objects/stringobject.c
   python/branches/blais-bytebuf/Objects/unicodeobject.c
   python/branches/blais-bytebuf/Python/ceval.c
   python/branches/blais-bytebuf/Tools/unicode/gencodec.py
   python/branches/blais-bytebuf/configure
   python/branches/blais-bytebuf/configure.in
   python/branches/blais-bytebuf/setup.py
Log:
Updated blais-bytebuf to 46295

Modified: python/branches/blais-bytebuf/Include/pyport.h
==============================================================================
--- python/branches/blais-bytebuf/Include/pyport.h	(original)
+++ python/branches/blais-bytebuf/Include/pyport.h	Fri May 26 13:48:16 2006
@@ -137,6 +137,28 @@
 #   endif
 #endif
 
+/* PY_LOCAL can be used instead of static to get the fastest possible calling
+ * convention for functions that are local to a given module.  It also enables
+ * inlining, where suitable.
+ *
+ * NOTE: You can only use this for functions that are entirely local to a
+ * module; functions that are exported via method tables, callbacks, etc,
+ * should keep using static.
+ */
+
+#undef USE_INLINE /* XXX - set via configure? */
+
+#if defined(_MSC_VER)
+/* 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 __inline type __fastcall
+#elif defined(USE_INLINE)
+#define Py_LOCAL(type) static inline type
+#else
+#define Py_LOCAL(type) static type
+#endif
+
 #include <stdlib.h>
 
 #include <math.h> /* Moved here from the math section, before extern "C" */

Modified: python/branches/blais-bytebuf/Lib/UserString.py
==============================================================================
--- python/branches/blais-bytebuf/Lib/UserString.py	(original)
+++ python/branches/blais-bytebuf/Lib/UserString.py	Fri May 26 13:48:16 2006
@@ -102,6 +102,7 @@
         return self.__class__(self.data.ljust(width, *args))
     def lower(self): return self.__class__(self.data.lower())
     def lstrip(self, chars=None): return self.__class__(self.data.lstrip(chars))
+    def partition(self, sep): return self.data.partition(sep)
     def replace(self, old, new, maxsplit=-1):
         return self.__class__(self.data.replace(old, new, maxsplit))
     def rfind(self, sub, start=0, end=sys.maxint):

Modified: python/branches/blais-bytebuf/Lib/test/string_tests.py
==============================================================================
--- python/branches/blais-bytebuf/Lib/test/string_tests.py	(original)
+++ python/branches/blais-bytebuf/Lib/test/string_tests.py	Fri May 26 13:48:16 2006
@@ -246,6 +246,14 @@
         self.checkequal(['a b c d'], 'a b c d', 'split', None, 0)
         self.checkequal(['a', 'b', 'c  d'], 'a  b  c  d', 'split', None, 2)
 
+        self.checkequal([], '         ', 'split')
+        self.checkequal(['a'], '  a    ', 'split')
+        self.checkequal(['a', 'b'], '  a    b   ', 'split')
+        self.checkequal(['a', 'b   '], '  a    b   ', 'split', None, 1)
+        self.checkequal(['a', 'b   c   '], '  a    b   c   ', 'split', None, 1)
+        self.checkequal(['a', 'b', 'c   '], '  a    b   c   ', 'split', None, 2)
+        self.checkequal(['a', 'b'], '\n\ta \t\r b \v ', 'split')
+
         # by a char
         self.checkequal(['a', 'b', 'c', 'd'], 'a|b|c|d', 'split', '|')
         self.checkequal(['a', 'b|c|d'], 'a|b|c|d', 'split', '|', 1)

Modified: python/branches/blais-bytebuf/Mac/OSX/BuildScript/scripts/postflight.patch-profile
==============================================================================
--- python/branches/blais-bytebuf/Mac/OSX/BuildScript/scripts/postflight.patch-profile	(original)
+++ python/branches/blais-bytebuf/Mac/OSX/BuildScript/scripts/postflight.patch-profile	Fri May 26 13:48:16 2006
@@ -41,7 +41,7 @@
 	echo "" >> "${HOME}/.cshrc"
 	echo "# Setting PATH for MacPython ${PYVER}" >> "${HOME}/.cshrc"
 	echo "# The orginal version is saved in .cshrc.pysave" >> "${HOME}/.cshrc"
-	echo "setenv path=(${PYTHON_ROOT}/bin "'$path'")" >> "${HOME}/.cshrc"
+	echo "set path=(${PYTHON_ROOT}/bin "'$path'")" >> "${HOME}/.cshrc"
 	exit 0
 	;;
 bash)

Modified: python/branches/blais-bytebuf/Makefile.pre.in
==============================================================================
--- python/branches/blais-bytebuf/Makefile.pre.in	(original)
+++ python/branches/blais-bytebuf/Makefile.pre.in	Fri May 26 13:48:16 2006
@@ -614,7 +614,7 @@
 		$(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
 
 # Install everything
-install:	altinstall bininstall maninstall
+install:	@FRAMEWORKINSTALLFIRST@ altinstall bininstall maninstall @FRAMEWORKINSTALLLAST@
 
 # Install almost everything without disturbing previous versions
 altinstall:	altbininstall libinstall inclinstall libainstall \
@@ -899,8 +899,10 @@
 # subtargets install specific parts. Much of the actual work is offloaded to
 # the Makefile in Mac/OSX
 #
-frameworkinstall: frameworkinstallframework \
-	frameworkinstallapps frameworkinstallunixtools
+#
+# This target is here for backward compatiblity, previous versions of Python
+# hadn't integrated framework installation in the normal install process.
+frameworkinstall: install
 
 # On install, we re-make the framework
 # structure in the install location, /Library/Frameworks/ or the argument to

Modified: python/branches/blais-bytebuf/Modules/itertoolsmodule.c
==============================================================================
--- python/branches/blais-bytebuf/Modules/itertoolsmodule.c	(original)
+++ python/branches/blais-bytebuf/Modules/itertoolsmodule.c	Fri May 26 13:48:16 2006
@@ -1093,10 +1093,10 @@
 typedef struct {
 	PyObject_HEAD
 	PyObject *it;
-	long	next;
-	long	stop;
-	long	step;
-	long	cnt;
+	Py_ssize_t next;
+	Py_ssize_t stop;
+	Py_ssize_t step;
+	Py_ssize_t cnt;
 } isliceobject;
 
 static PyTypeObject islice_type;
@@ -1105,7 +1105,7 @@
 islice_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
 {
 	PyObject *seq;
-	long start=0, stop=-1, step=1;
+	Py_ssize_t start=0, stop=-1, step=1;
 	PyObject *it, *a1=NULL, *a2=NULL, *a3=NULL;
 	Py_ssize_t numargs;
 	isliceobject *lz;
@@ -1119,7 +1119,7 @@
 	numargs = PyTuple_Size(args);
 	if (numargs == 2) {
 		if (a1 != Py_None) {
-			stop = PyInt_AsLong(a1);
+			stop = PyInt_AsSsize_t(a1);
 			if (stop == -1) {
 				if (PyErr_Occurred())
 					PyErr_Clear();
@@ -1130,11 +1130,11 @@
 		}
 	} else {
 		if (a1 != Py_None)
-			start = PyInt_AsLong(a1);
+			start = PyInt_AsSsize_t(a1);
 		if (start == -1 && PyErr_Occurred())
 			PyErr_Clear();
 		if (a2 != Py_None) {
-			stop = PyInt_AsLong(a2);
+			stop = PyInt_AsSsize_t(a2);
 			if (stop == -1) {
 				if (PyErr_Occurred())
 					PyErr_Clear();
@@ -1152,7 +1152,7 @@
 
 	if (a3 != NULL) {
 		if (a3 != Py_None)
-			step = PyInt_AsLong(a3);
+			step = PyInt_AsSsize_t(a3);
 		if (step == -1 && PyErr_Occurred())
 			PyErr_Clear();
 	}
@@ -1202,7 +1202,7 @@
 {
 	PyObject *item;
 	PyObject *it = lz->it;
-	long oldnext;
+	Py_ssize_t oldnext;
 	PyObject *(*iternext)(PyObject *);
 
 	assert(PyIter_Check(it));
@@ -1600,8 +1600,8 @@
 
 typedef struct {
 	PyObject_HEAD
-	Py_ssize_t	tuplesize;
-	long	iternum;		/* which iterator is active */
+	Py_ssize_t tuplesize;
+	Py_ssize_t iternum;		/* which iterator is active */
 	PyObject *ittuple;		/* tuple of iterators */
 } chainobject;
 
@@ -1612,7 +1612,7 @@
 {
 	chainobject *lz;
 	Py_ssize_t tuplesize = PySequence_Length(args);
-	int i;
+	Py_ssize_t i;
 	PyObject *ittuple;
 
 	if (!_PyArg_NoKeywords("chain()", kwds))
@@ -2033,7 +2033,7 @@
 
 typedef struct {
 	PyObject_HEAD
-	long	cnt;
+	Py_ssize_t cnt;
 } countobject;
 
 static PyTypeObject count_type;
@@ -2042,12 +2042,12 @@
 count_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
 {
 	countobject *lz;
-	long cnt = 0;
+	Py_ssize_t cnt = 0;
 
 	if (!_PyArg_NoKeywords("count()", kwds))
 		return NULL;
 
-	if (!PyArg_ParseTuple(args, "|l:count", &cnt))
+	if (!PyArg_ParseTuple(args, "|n:count", &cnt))
 		return NULL;
 
 	/* create countobject structure */
@@ -2062,13 +2062,13 @@
 static PyObject *
 count_next(countobject *lz)
 {
-	return PyInt_FromLong(lz->cnt++);
+	return PyInt_FromSize_t(lz->cnt++);
 }
 
 static PyObject *
 count_repr(countobject *lz)
 {
-	return PyString_FromFormat("count(%ld)", lz->cnt);
+	return PyString_FromFormat("count(%zd)", lz->cnt);
 }
 
 PyDoc_STRVAR(count_doc,
@@ -2138,7 +2138,7 @@
 izip_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
 {
 	izipobject *lz;
-	int i;
+	Py_ssize_t i;
 	PyObject *ittuple;  /* tuple of iterators */
 	PyObject *result;
 	Py_ssize_t tuplesize = PySequence_Length(args);
@@ -2212,7 +2212,7 @@
 static PyObject *
 izip_next(izipobject *lz)
 {
-	int i;
+	Py_ssize_t i;
 	Py_ssize_t tuplesize = lz->tuplesize;
 	PyObject *result = lz->result;
 	PyObject *it;
@@ -2314,7 +2314,7 @@
 typedef struct {
 	PyObject_HEAD
 	PyObject *element;
-	long cnt;
+	Py_ssize_t cnt;
 } repeatobject;
 
 static PyTypeObject repeat_type;
@@ -2324,12 +2324,12 @@
 {
 	repeatobject *ro;
 	PyObject *element;
-	long cnt = -1;
+	Py_ssize_t cnt = -1;
 
 	if (!_PyArg_NoKeywords("repeat()", kwds))
 		return NULL;
 
-	if (!PyArg_ParseTuple(args, "O|l:repeat", &element, &cnt))
+	if (!PyArg_ParseTuple(args, "O|n:repeat", &element, &cnt))
 		return NULL;
 
 	if (PyTuple_Size(args) == 2 && cnt < 0)
@@ -2383,7 +2383,7 @@
 		result = PyString_FromFormat("repeat(%s)",
 			PyString_AS_STRING(objrepr));
 	else
-		result = PyString_FromFormat("repeat(%s, %ld)",
+		result = PyString_FromFormat("repeat(%s, %zd)",
 			PyString_AS_STRING(objrepr), ro->cnt);
 	Py_DECREF(objrepr);
 	return result;
@@ -2396,7 +2396,7 @@
                 PyErr_SetString(PyExc_TypeError, "len() of unsized object");
 		return NULL;
 	}
-        return PyInt_FromLong(ro->cnt);
+        return PyInt_FromSize_t(ro->cnt);
 }
 
 PyDoc_STRVAR(length_hint_doc, "Private method returning an estimate of len(list(it)).");

Modified: python/branches/blais-bytebuf/Objects/stringobject.c
==============================================================================
--- python/branches/blais-bytebuf/Objects/stringobject.c	(original)
+++ python/branches/blais-bytebuf/Objects/stringobject.c	Fri May 26 13:48:16 2006
@@ -5,18 +5,6 @@
 
 #include <ctype.h>
 
-#undef USE_INLINE /* XXX - set via configure? */
-
-#if defined(_MSC_VER) /* this is taken from _sre.c */
-#pragma warning(disable: 4710)
-/* fastest possible local call under MSVC */
-#define LOCAL(type) static __inline type __fastcall
-#elif defined(USE_INLINE)
-#define LOCAL(type) static inline type
-#else
-#define LOCAL(type) static type
-#endif
-
 #ifdef COUNT_ALLOCS
 int null_strings, one_strings;
 #endif
@@ -798,7 +786,7 @@
 #define FAST_COUNT 0
 #define FAST_SEARCH 1
 
-LOCAL(Py_ssize_t)
+Py_LOCAL(Py_ssize_t)
 fastsearch(const char* s, Py_ssize_t n, const char* p, Py_ssize_t m, int mode)
 {
 	long mask;

Modified: python/branches/blais-bytebuf/Objects/unicodeobject.c
==============================================================================
--- python/branches/blais-bytebuf/Objects/unicodeobject.c	(original)
+++ python/branches/blais-bytebuf/Objects/unicodeobject.c	Fri May 26 13:48:16 2006
@@ -49,18 +49,6 @@
 #include <windows.h>
 #endif
 
-#undef USE_INLINE /* XXX - set via configure? */
-
-#if defined(_MSC_VER) /* this is taken from _sre.c */
-#pragma warning(disable: 4710)
-/* fastest possible local call under MSVC */
-#define LOCAL(type) static __inline type __fastcall
-#elif defined(USE_INLINE)
-#define LOCAL(type) static inline type
-#else
-#define LOCAL(type) static type
-#endif
-
 /* Limit for the Unicode object free list */
 
 #define MAX_UNICODE_FREELIST_SIZE       1024
@@ -153,7 +141,7 @@
 #define BLOOM_LINEBREAK(ch)\
     (BLOOM(bloom_linebreak, (ch)) && Py_UNICODE_ISLINEBREAK((ch)))
 
-LOCAL(BLOOM_MASK) make_bloom_mask(Py_UNICODE* ptr, Py_ssize_t len)
+Py_LOCAL(BLOOM_MASK) make_bloom_mask(Py_UNICODE* ptr, Py_ssize_t len)
 {
     /* calculate simple bloom-style bitmask for a given unicode string */
 
@@ -167,7 +155,7 @@
     return mask;
 }
 
-LOCAL(int) unicode_member(Py_UNICODE chr, Py_UNICODE* set, Py_ssize_t setlen)
+Py_LOCAL(int) unicode_member(Py_UNICODE chr, Py_UNICODE* set, Py_ssize_t setlen)
 {
     Py_ssize_t i;
 
@@ -2027,9 +2015,9 @@
 
 */
 
-LOCAL(const Py_UNICODE *) findchar(const Py_UNICODE *s,
-                                   Py_ssize_t size,
-                                   Py_UNICODE ch)
+Py_LOCAL(const Py_UNICODE *) findchar(const Py_UNICODE *s,
+                                      Py_ssize_t size,
+                                      Py_UNICODE ch)
 {
     /* like wcschr, but doesn't stop at NULL characters */
 
@@ -3880,7 +3868,7 @@
 #define FAST_COUNT 0
 #define FAST_SEARCH 1
 
-LOCAL(Py_ssize_t)
+Py_LOCAL(Py_ssize_t)
 fastsearch(Py_UNICODE* s, Py_ssize_t n, Py_UNICODE* p, Py_ssize_t m, int mode)
 {
     long mask;
@@ -3955,10 +3943,10 @@
     return count;
 }
 
-LOCAL(Py_ssize_t) count(PyUnicodeObject *self,
-		 Py_ssize_t start,
-		 Py_ssize_t end,
-		 PyUnicodeObject *substring)
+Py_LOCAL(Py_ssize_t) count(PyUnicodeObject *self,
+                           Py_ssize_t start,
+                           Py_ssize_t end,
+                           PyUnicodeObject *substring)
 {
     Py_ssize_t count = 0;
 

Modified: python/branches/blais-bytebuf/Python/ceval.c
==============================================================================
--- python/branches/blais-bytebuf/Python/ceval.c	(original)
+++ python/branches/blais-bytebuf/Python/ceval.c	Fri May 26 13:48:16 2006
@@ -30,7 +30,7 @@
 
 #define READ_TIMESTAMP(var) ppc_getcounter(&var)
 
-static void
+Py_LOCAL(void)
 ppc_getcounter(uint64 *v)
 {
 	register unsigned long tbu, tb, tbu2;
@@ -83,44 +83,44 @@
 
 /* Forward declarations */
 #ifdef WITH_TSC
-static PyObject *call_function(PyObject ***, int, uint64*, uint64*);
+Py_LOCAL(PyObject *)call_function(PyObject ***, int, uint64*, uint64*);
 #else
-static PyObject *call_function(PyObject ***, int);
+Py_LOCAL(PyObject *)call_function(PyObject ***, int);
 #endif
-static PyObject *fast_function(PyObject *, PyObject ***, int, int, int);
-static PyObject *do_call(PyObject *, PyObject ***, int, int);
-static PyObject *ext_do_call(PyObject *, PyObject ***, int, int, int);
-static PyObject *update_keyword_args(PyObject *, int, PyObject ***,PyObject *);
-static PyObject *update_star_args(int, int, PyObject *, PyObject ***);
-static PyObject *load_args(PyObject ***, int);
+Py_LOCAL(PyObject *)fast_function(PyObject *, PyObject ***, int, int, int);
+Py_LOCAL(PyObject *)do_call(PyObject *, PyObject ***, int, int);
+Py_LOCAL(PyObject *)ext_do_call(PyObject *, PyObject ***, int, int, int);
+Py_LOCAL(PyObject *)update_keyword_args(PyObject *, int, PyObject ***,PyObject *);
+Py_LOCAL(PyObject *)update_star_args(int, int, PyObject *, PyObject ***);
+Py_LOCAL(PyObject *)load_args(PyObject ***, int);
 #define CALL_FLAG_VAR 1
 #define CALL_FLAG_KW 2
 
 #ifdef LLTRACE
-static int lltrace;
-static int prtrace(PyObject *, char *);
+Py_LOCAL(int) lltrace;
+Py_LOCAL(int) prtrace(PyObject *, char *);
 #endif
-static int call_trace(Py_tracefunc, PyObject *, PyFrameObject *,
+Py_LOCAL(int) call_trace(Py_tracefunc, PyObject *, PyFrameObject *,
 		      int, PyObject *);
-static void call_trace_protected(Py_tracefunc, PyObject *,
+Py_LOCAL(void) call_trace_protected(Py_tracefunc, PyObject *,
 				 PyFrameObject *, int, PyObject *);
-static void call_exc_trace(Py_tracefunc, PyObject *, PyFrameObject *);
-static int maybe_call_line_trace(Py_tracefunc, PyObject *,
+Py_LOCAL(void) call_exc_trace(Py_tracefunc, PyObject *, PyFrameObject *);
+Py_LOCAL(int) maybe_call_line_trace(Py_tracefunc, PyObject *,
 				  PyFrameObject *, int *, int *, int *);
 
-static PyObject *apply_slice(PyObject *, PyObject *, PyObject *);
-static int assign_slice(PyObject *, PyObject *,
+Py_LOCAL(PyObject *)apply_slice(PyObject *, PyObject *, PyObject *);
+Py_LOCAL(int) assign_slice(PyObject *, PyObject *,
 			PyObject *, PyObject *);
-static PyObject *cmp_outcome(int, PyObject *, PyObject *);
-static PyObject *import_from(PyObject *, PyObject *);
-static int import_all_from(PyObject *, PyObject *);
-static PyObject *build_class(PyObject *, PyObject *, PyObject *);
-static int exec_statement(PyFrameObject *,
+Py_LOCAL(PyObject *)cmp_outcome(int, PyObject *, PyObject *);
+Py_LOCAL(PyObject *)import_from(PyObject *, PyObject *);
+Py_LOCAL(int) import_all_from(PyObject *, PyObject *);
+Py_LOCAL(PyObject *)build_class(PyObject *, PyObject *, PyObject *);
+Py_LOCAL(int) exec_statement(PyFrameObject *,
 			  PyObject *, PyObject *, PyObject *);
-static void set_exc_info(PyThreadState *, PyObject *, PyObject *, PyObject *);
-static void reset_exc_info(PyThreadState *);
-static void format_exc_check_arg(PyObject *, char *, PyObject *);
-static PyObject *string_concatenate(PyObject *, PyObject *,
+Py_LOCAL(void) set_exc_info(PyThreadState *, PyObject *, PyObject *, PyObject *);
+Py_LOCAL(void) reset_exc_info(PyThreadState *);
+Py_LOCAL(void) format_exc_check_arg(PyObject *, char *, PyObject *);
+Py_LOCAL(PyObject *)string_concatenate(PyObject *, PyObject *,
 				    PyFrameObject *, unsigned char *);
 
 #define NAME_ERROR_MSG \
@@ -477,7 +477,7 @@
 };
 
 static enum why_code do_raise(PyObject *, PyObject *, PyObject *);
-static int unpack_iterable(PyObject *, int, PyObject **);
+Py_LOCAL(int) unpack_iterable(PyObject *, int, PyObject **);
 
 /* for manipulating the thread switch and periodic "stuff" - used to be
    per thread, now just a pair o' globals */
@@ -2888,7 +2888,7 @@
 
 */
 
-static void
+Py_LOCAL(void)
 set_exc_info(PyThreadState *tstate,
 	     PyObject *type, PyObject *value, PyObject *tb)
 {
@@ -2933,7 +2933,7 @@
 	PySys_SetObject("exc_traceback", tb);
 }
 
-static void
+Py_LOCAL(void)
 reset_exc_info(PyThreadState *tstate)
 {
 	PyFrameObject *frame;
@@ -3080,7 +3080,7 @@
 /* Iterate v argcnt times and store the results on the stack (via decreasing
    sp).  Return 1 for success, 0 if error. */
 
-static int
+Py_LOCAL(int)
 unpack_iterable(PyObject *v, int argcnt, PyObject **sp)
 {
 	int i = 0;
@@ -3127,7 +3127,7 @@
 
 
 #ifdef LLTRACE
-static int
+Py_LOCAL(int)
 prtrace(PyObject *v, char *str)
 {
 	printf("%s ", str);
@@ -3138,7 +3138,7 @@
 }
 #endif
 
-static void
+Py_LOCAL(void)
 call_exc_trace(Py_tracefunc func, PyObject *self, PyFrameObject *f)
 {
 	PyObject *type, *value, *traceback, *arg;
@@ -3164,7 +3164,7 @@
 	}
 }
 
-static void
+Py_LOCAL(void)
 call_trace_protected(Py_tracefunc func, PyObject *obj, PyFrameObject *frame,
 		     int what, PyObject *arg)
 {
@@ -3181,7 +3181,7 @@
 	}
 }
 
-static int
+Py_LOCAL(int)
 call_trace(Py_tracefunc func, PyObject *obj, PyFrameObject *frame,
 	   int what, PyObject *arg)
 {
@@ -3216,7 +3216,7 @@
 	return result;
 }
 
-static int
+Py_LOCAL(int)
 maybe_call_line_trace(Py_tracefunc func, PyObject *obj,
 		      PyFrameObject *frame, int *instr_lb, int *instr_ub,
 		      int *instr_prev)
@@ -3444,7 +3444,7 @@
 	}
 }
 
-static void
+Py_LOCAL(void)
 err_args(PyObject *func, int flags, int nargs)
 {
 	if (flags & METH_NOARGS)
@@ -3491,7 +3491,7 @@
 	x = call; \
 	}
 
-static PyObject *
+Py_LOCAL(PyObject *)
 call_function(PyObject ***pp_stack, int oparg
 #ifdef WITH_TSC
 		, uint64* pintr0, uint64* pintr1
@@ -3582,7 +3582,7 @@
    done before evaluating the frame.
 */
 
-static PyObject *
+Py_LOCAL(PyObject *)
 fast_function(PyObject *func, PyObject ***pp_stack, int n, int na, int nk)
 {
 	PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
@@ -3635,7 +3635,7 @@
 				 PyFunction_GET_CLOSURE(func));
 }
 
-static PyObject *
+Py_LOCAL(PyObject *)
 update_keyword_args(PyObject *orig_kwdict, int nk, PyObject ***pp_stack,
                     PyObject *func)
 {
@@ -3675,7 +3675,7 @@
 	return kwdict;
 }
 
-static PyObject *
+Py_LOCAL(PyObject *)
 update_star_args(int nstack, int nstar, PyObject *stararg,
 		 PyObject ***pp_stack)
 {
@@ -3700,7 +3700,7 @@
 	return callargs;
 }
 
-static PyObject *
+Py_LOCAL(PyObject *)
 load_args(PyObject ***pp_stack, int na)
 {
 	PyObject *args = PyTuple_New(na);
@@ -3715,7 +3715,7 @@
 	return args;
 }
 
-static PyObject *
+Py_LOCAL(PyObject *)
 do_call(PyObject *func, PyObject ***pp_stack, int na, int nk)
 {
 	PyObject *callargs = NULL;
@@ -3751,7 +3751,7 @@
 	return result;
 }
 
-static PyObject *
+Py_LOCAL(PyObject *)
 ext_do_call(PyObject *func, PyObject ***pp_stack, int flags, int na, int nk)
 {
 	int nstar = 0;
@@ -3863,7 +3863,7 @@
                      PyType_HasFeature((x)->ob_type, Py_TPFLAGS_HAVE_INDEX) \
 		     && (x)->ob_type->tp_as_number->nb_index))
 
-static PyObject *
+Py_LOCAL(PyObject *)
 apply_slice(PyObject *u, PyObject *v, PyObject *w) /* return u[v:w] */
 {
 	PyTypeObject *tp = u->ob_type;
@@ -3889,7 +3889,7 @@
 	}
 }
 
-static int
+Py_LOCAL(int)
 assign_slice(PyObject *u, PyObject *v, PyObject *w, PyObject *x)
 	/* u[v:w] = x */
 {
@@ -3923,7 +3923,7 @@
 	}
 }
 
-static PyObject *
+Py_LOCAL(PyObject *)
 cmp_outcome(int op, register PyObject *v, register PyObject *w)
 {
 	int res = 0;
@@ -3956,7 +3956,7 @@
 	return v;
 }
 
-static PyObject *
+Py_LOCAL(PyObject *)
 import_from(PyObject *v, PyObject *name)
 {
 	PyObject *x;
@@ -3970,7 +3970,7 @@
 	return x;
 }
 
-static int
+Py_LOCAL(int)
 import_all_from(PyObject *locals, PyObject *v)
 {
 	PyObject *all = PyObject_GetAttrString(v, "__all__");
@@ -4027,7 +4027,7 @@
 	return err;
 }
 
-static PyObject *
+Py_LOCAL(PyObject *)
 build_class(PyObject *methods, PyObject *bases, PyObject *name)
 {
 	PyObject *metaclass = NULL, *result, *base;
@@ -4079,7 +4079,7 @@
 	return result;
 }
 
-static int
+Py_LOCAL(int)
 exec_statement(PyFrameObject *f, PyObject *prog, PyObject *globals,
 	       PyObject *locals)
 {
@@ -4175,7 +4175,7 @@
 	return 0;
 }
 
-static void
+Py_LOCAL(void)
 format_exc_check_arg(PyObject *exc, char *format_str, PyObject *obj)
 {
 	char *obj_str;
@@ -4190,7 +4190,7 @@
 	PyErr_Format(exc, format_str, obj_str);
 }
 
-static PyObject *
+Py_LOCAL(PyObject *)
 string_concatenate(PyObject *v, PyObject *w,
 		   PyFrameObject *f, unsigned char *next_instr)
 {
@@ -4265,7 +4265,7 @@
 
 #ifdef DYNAMIC_EXECUTION_PROFILE
 
-static PyObject *
+Py_LOCAL(PyObject *)
 getarray(long a[256])
 {
 	int i;

Modified: python/branches/blais-bytebuf/Tools/unicode/gencodec.py
==============================================================================
--- python/branches/blais-bytebuf/Tools/unicode/gencodec.py	(original)
+++ python/branches/blais-bytebuf/Tools/unicode/gencodec.py	Fri May 26 13:48:16 2006
@@ -318,15 +318,15 @@
 ### encodings module API
 
 def getregentry():
-    return codecs.CodecInfo((
-        name=%r,
+    return codecs.CodecInfo(
         Codec().encode,
         Codec().decode,
+        name=%r,
         streamwriter=StreamWriter,
         streamreader=StreamReader,
         incrementalencoder=IncrementalEncoder,
         incrementaldecoder=IncrementalDecoder,
-    ))
+    )
 ''' % encodingname.replace('_', '-'))
 
     # Add decoding table or map (with preference to the table)

Modified: python/branches/blais-bytebuf/configure
==============================================================================
--- python/branches/blais-bytebuf/configure	(original)
+++ python/branches/blais-bytebuf/configure	Fri May 26 13:48:16 2006
@@ -1,5 +1,5 @@
 #! /bin/sh
-# From configure.in Revision: 46010 .
+# From configure.in Revision: 46046 .
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.59 for python 2.5.
 #
@@ -312,7 +312,7 @@
 # include <unistd.h>
 #endif"
 
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS VERSION SOVERSION CONFIG_ARGS UNIVERSALSDK PYTHONFRAMEWORK PYTHONFRAMEWORKDIR PYTHONFRAMEWORKPREFIX PYTHONFRAMEWORKINSTALLDIR MACHDEP SGI_ABI EXTRAPLATDIR EXTRAMACHDEPPATH CONFIGURE_MACOSX_DEPLOYMENT_TARGET EXPORT_MACOSX_DEPLOYMENT_TARGET CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CXX MAINCC CPP EGREP BUILDEXEEXT LIBRARY LDLIBRARY DLLLIBRARY BLDLIBRARY LDLIBRARYDIR INSTSONAME RUNSHARED LINKCC RANLIB ac_ct_RANLIB AR SVNVERSION INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN OPT BASECFLAGS OTHER_LIBTOOL_OPT LIBTOOL_CRUFT SO LDSHARED BLDSHARED CCSHARED LINKFORSHARED CFLAGSFORSHARED SHLIBS USE_SIGNAL_MODULE SIGNAL_OBJS USE_THREAD_MODULE LDLAST THREADOBJ DLINCLDIR DYNLOADFILE MACHDEP_OBJS TRUE LIBOBJS HAVE_GETHOSTBYNAME_R_6_ARG HAVE_GETHOSTBYNAME_R_5_ARG HAVE_GETHOSTBYNAME_R_3_ARG HAVE_GETHOSTBYNAME_R HAVE_GETHOSTBYNAME LIBM LIBC UNICODE_OBJS THREADHEADERS SRCDIRS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS VERSION SOVERSION CONFIG_ARGS UNIVERSALSDK PYTHONFRAMEWORK PYTHONFRAMEWORKDIR PYTHONFRAMEWORKPREFIX PYTHONFRAMEWORKINSTALLDIR FRAMEWORKINSTALLFIRST FRAMEWORKINSTALLLAST MACHDEP SGI_ABI EXTRAPLATDIR EXTRAMACHDEPPATH CONFIGURE_MACOSX_DEPLOYMENT_TARGET EXPORT_MACOSX_DEPLOYMENT_TARGET CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CXX MAINCC CPP EGREP BUILDEXEEXT LIBRARY LDLIBRARY DLLLIBRARY BLDLIBRARY LDLIBRARYDIR INSTSONAME RUNSHARED LINKCC RANLIB ac_ct_RANLIB AR SVNVERSION INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN OPT BASECFLAGS OTHER_LIBTOOL_OPT LIBTOOL_CRUFT SO LDSHARED BLDSHARED CCSHARED LINKFORSHARED CFLAGSFORSHARED SHLIBS USE_SIGNAL_MODULE SIGNAL_OBJS USE_THREAD_MODULE LDLAST THREADOBJ DLINCLDIR DYNLOADFILE MACHDEP_OBJS TRUE LIBOBJS HAVE_GETHOSTBYNAME_R_6_ARG HAVE_GETHOSTBYNAME_R_5_ARG HAVE_GETHOSTBYNAME_R_3_ARG HAVE_GETHOSTBYNAME_R HAVE_GETHOSTBYNAME LIBM LIBC UNICODE_OBJS THREADHEADERS SRCDIRS LTLIBOBJS'
 ac_subst_files=''
 
 # Initialize some variables set by options.
@@ -1443,6 +1443,8 @@
 		PYTHONFRAMEWORKDIR=no-framework
 		PYTHONFRAMEWORKPREFIX=
 		PYTHONFRAMEWORKINSTALLDIR=
+		FRAMEWORKINSTALLFIRST=
+		FRAMEWORKINSTALLLAST=
 		enable_framework=
 		;;
 	*)
@@ -1450,6 +1452,8 @@
 		PYTHONFRAMEWORKDIR=Python.framework
 		PYTHONFRAMEWORKPREFIX=$enableval
 		PYTHONFRAMEWORKINSTALLDIR=$PYTHONFRAMEWORKPREFIX/$PYTHONFRAMEWORKDIR
+		FRAMEWORKINSTALLFIRST="frameworkinstallstructure"
+		FRAMEWORKINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools"
 		prefix=$PYTHONFRAMEWORKINSTALLDIR/Versions/$VERSION
 
 		# Add makefiles for Mac specific code to the list of output
@@ -1468,6 +1472,8 @@
 	PYTHONFRAMEWORKDIR=no-framework
 	PYTHONFRAMEWORKPREFIX=
 	PYTHONFRAMEWORKINSTALLDIR=
+	FRAMEWORKINSTALLFIRST=
+	FRAMEWORKINSTALLLAST=
 	enable_framework=
 
 fi;
@@ -1476,6 +1482,8 @@
 
 
 
+
+
 ##AC_ARG_WITH(dyld,
 ##            AC_HELP_STRING(--with-dyld,
 ##                           Use (OpenStep|Rhapsody) dynamic linker))
@@ -22541,6 +22549,8 @@
 s, at PYTHONFRAMEWORKDIR@,$PYTHONFRAMEWORKDIR,;t t
 s, at PYTHONFRAMEWORKPREFIX@,$PYTHONFRAMEWORKPREFIX,;t t
 s, at PYTHONFRAMEWORKINSTALLDIR@,$PYTHONFRAMEWORKINSTALLDIR,;t t
+s, at FRAMEWORKINSTALLFIRST@,$FRAMEWORKINSTALLFIRST,;t t
+s, at FRAMEWORKINSTALLLAST@,$FRAMEWORKINSTALLLAST,;t t
 s, at MACHDEP@,$MACHDEP,;t t
 s, at SGI_ABI@,$SGI_ABI,;t t
 s, at EXTRAPLATDIR@,$EXTRAPLATDIR,;t t

Modified: python/branches/blais-bytebuf/configure.in
==============================================================================
--- python/branches/blais-bytebuf/configure.in	(original)
+++ python/branches/blais-bytebuf/configure.in	Fri May 26 13:48:16 2006
@@ -97,6 +97,8 @@
 		PYTHONFRAMEWORKDIR=no-framework
 		PYTHONFRAMEWORKPREFIX=
 		PYTHONFRAMEWORKINSTALLDIR=
+		FRAMEWORKINSTALLFIRST=
+		FRAMEWORKINSTALLLAST=
 		enable_framework=
 		;;
 	*)
@@ -104,6 +106,8 @@
 		PYTHONFRAMEWORKDIR=Python.framework
 		PYTHONFRAMEWORKPREFIX=$enableval
 		PYTHONFRAMEWORKINSTALLDIR=$PYTHONFRAMEWORKPREFIX/$PYTHONFRAMEWORKDIR
+		FRAMEWORKINSTALLFIRST="frameworkinstallstructure"
+		FRAMEWORKINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools"
 		prefix=$PYTHONFRAMEWORKINSTALLDIR/Versions/$VERSION
 
 		# Add makefiles for Mac specific code to the list of output
@@ -117,12 +121,16 @@
 	PYTHONFRAMEWORKDIR=no-framework
 	PYTHONFRAMEWORKPREFIX=
 	PYTHONFRAMEWORKINSTALLDIR=
+	FRAMEWORKINSTALLFIRST=
+	FRAMEWORKINSTALLLAST=
 	enable_framework=
 ])
 AC_SUBST(PYTHONFRAMEWORK)
 AC_SUBST(PYTHONFRAMEWORKDIR)
 AC_SUBST(PYTHONFRAMEWORKPREFIX)
 AC_SUBST(PYTHONFRAMEWORKINSTALLDIR)
+AC_SUBST(FRAMEWORKINSTALLFIRST)
+AC_SUBST(FRAMEWORKINSTALLLAST)
 
 ##AC_ARG_WITH(dyld,
 ##            AC_HELP_STRING(--with-dyld,

Modified: python/branches/blais-bytebuf/setup.py
==============================================================================
--- python/branches/blais-bytebuf/setup.py	(original)
+++ python/branches/blais-bytebuf/setup.py	Fri May 26 13:48:16 2006
@@ -317,6 +317,23 @@
         if platform in ['osf1', 'unixware7', 'openunix8']:
             lib_dirs += ['/usr/ccs/lib']
 
+        if platform == 'darwin':
+            # This should work on any unixy platform ;-)
+            # If the user has bothered specifying additional -I and -L flags
+            # in OPT and LDFLAGS we might as well use them here.
+            #   NOTE: using shlex.split would technically be more correct, but
+            # also gives a bootstrap problem. Let's hope nobody uses directories
+            # with whitespace in the name to store libraries.
+            cflags, ldflags = sysconfig.get_config_vars(
+                    'CFLAGS', 'LDFLAGS')
+            for item in cflags.split():
+                if item.startswith('-I'):
+                    inc_dirs.append(item[2:])
+
+            for item in ldflags.split():
+                if item.startswith('-L'):
+                    lib_dirs.append(item[2:])
+
         # Check for MacOS X, which doesn't need libm.a at all
         math_libs = ['m']
         if platform in ['darwin', 'beos', 'mac']:
@@ -463,6 +480,16 @@
             if find_file('readline/rlconf.h', inc_dirs, []) is None:
                 do_readline = False
         if do_readline:
+            if sys.platform == 'darwin':
+                # In every directory on the search path search for a dynamic
+                # library and then a static library, instead of first looking
+                # for dynamic libraries on the entiry path.
+                # This way a staticly linked custom readline gets picked up
+                # before the (broken) dynamic library in /usr/lib.
+                readline_extra_link_args = ('-Wl,-search_paths_first',)
+            else:
+                readline_extra_link_args = ()
+
             readline_libs = ['readline']
             if self.compiler.find_library_file(lib_dirs,
                                                  'ncursesw'):
@@ -478,6 +505,7 @@
                 readline_libs.append('termcap')
             exts.append( Extension('readline', ['readline.c'],
                                    library_dirs=['/usr/lib/termcap'],
+                                   extra_link_args=readline_extra_link_args,
                                    libraries=readline_libs) )
         if platform not in ['mac']:
             # crypt module.
@@ -712,7 +740,11 @@
         MIN_SQLITE_VERSION_NUMBER = (3, 0, 8)
         MIN_SQLITE_VERSION = ".".join([str(x)
                                     for x in MIN_SQLITE_VERSION_NUMBER])
-        for d in sqlite_inc_paths + inc_dirs:
+
+        # Scan the default include directories before the SQLite specific
+        # ones. This allows one to override the copy of sqlite on OSX,
+        # where /usr/include contains an old version of sqlite.
+        for d in inc_dirs + sqlite_inc_paths:
             f = os.path.join(d, "sqlite3.h")
             if os.path.exists(f):
                 if sqlite_setup_debug: print "sqlite: found %s"%f
@@ -763,12 +795,24 @@
             else:
                 sqlite_defines.append(('MODULE_NAME', '\\"sqlite3\\"'))
 
+
+            if sys.platform == 'darwin':
+                # In every directory on the search path search for a dynamic
+                # library and then a static library, instead of first looking
+                # for dynamic libraries on the entiry path.
+                # This way a staticly linked custom sqlite gets picked up
+                # before the dynamic library in /usr/lib.
+                sqlite_extra_link_args = ('-Wl,-search_paths_first',)
+            else:
+                sqlite_extra_link_args = ()
+
             exts.append(Extension('_sqlite3', sqlite_srcs,
                                   define_macros=sqlite_defines,
                                   include_dirs=["Modules/_sqlite",
                                                 sqlite_incdir],
                                   library_dirs=sqlite_libdir,
                                   runtime_library_dirs=sqlite_libdir,
+                                  extra_link_args=sqlite_extra_link_args,
                                   libraries=["sqlite3",]))
 
         # Look for Berkeley db 1.85.   Note that it is built as a different


More information about the Python-checkins mailing list