changeset 796:44d18ebd7e46 stable-0.5.x

Ported [995] to 0.5.x branch.
author cmlenz
date Thu, 15 Jan 2009 23:46:08 +0000
parents 5c93aefcd93f
children 890dc65c3e75
files genshi/_speedups.c setup.py
diffstat 2 files changed, 12 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/genshi/_speedups.c
+++ b/genshi/_speedups.c
@@ -43,7 +43,7 @@
 
 /* Markup class */
 
-PyAPI_DATA(PyTypeObject) MarkupType;
+PyTypeObject MarkupType; /* declared later */
 
 PyDoc_STRVAR(Markup__doc__,
 "Marks a string as being safe for inclusion in HTML/XML output without\n\
@@ -232,7 +232,8 @@
     static char *kwlist[] = {"seq", "escape_quotes", 0};
     PyObject *seq = NULL, *seq2, *tmp, *tmp2;
     char quotes = 1;
-    int n, i;
+    Py_ssize_t n;
+    int i;
 
     if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|b", kwlist, &seq, &quotes)) {
         return NULL;
@@ -310,7 +311,8 @@
 Markup_mod(PyObject *self, PyObject *args)
 {
     PyObject *tmp, *tmp2, *ret, *args2;
-    int i, nargs = 0;
+    int i;
+    Py_ssize_t nargs = 0;
     PyObject *kwds = NULL;
 
     if (PyDict_Check(args)) {
--- a/setup.py
+++ b/setup.py
@@ -40,23 +40,24 @@
     def run(self):
         try:
             build_ext.run(self)
-        except DistutilsPlatformError:
-            self._unavailable()
+        except DistutilsPlatformError, e:
+            self._unavailable(e)
 
     def build_extension(self, ext):
         try:
             build_ext.build_extension(self, ext)
             global _speedup_available
             _speedup_available = True
-        except CCompilerError, x:
-            self._unavailable()
+        except CCompilerError, e:
+            self._unavailable(e)
 
-    def _unavailable(self):
+    def _unavailable(self, exc):
         print '*' * 70
         print """WARNING:
 An optional C extension could not be compiled, speedups will not be
 available."""
         print '*' * 70
+        print exc
 
 
 if Feature:
@@ -83,6 +84,7 @@
 if bdist_egg:
     cmdclass['bdist_egg'] = my_bdist_egg
 
+
 setup(
     name = 'Genshi',
     version = '0.5.2',
Copyright (C) 2012-2017 Edgewall Software