Revision: 8556
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8556&view=rev
Author:   mdboom
Date:     2010-07-15 18:34:54 +0000 (Thu, 15 Jul 2010)

Log Message:
-----------
Fix compilation in Python 2.x

Modified Paths:
--------------
    branches/py3k/setupext.py
    branches/py3k/src/_backend_agg.cpp
    branches/py3k/src/_path.cpp

Modified: branches/py3k/setupext.py
===================================================================
--- branches/py3k/setupext.py   2010-07-15 17:37:19 UTC (rev 8555)
+++ branches/py3k/setupext.py   2010-07-15 18:34:54 UTC (rev 8556)
@@ -136,9 +136,11 @@
 
 defines = [
         ('PY_ARRAY_UNIQUE_SYMBOL', 'MPL_ARRAY_API'),
-        ('PYCXX_ISO_CPP_LIB', '1'),
-        ('PYCXX_PYTHON_2TO3', '1')]
+        ('PYCXX_ISO_CPP_LIB', '1')]
 
+if sys.hexversion >= 0x03000000:
+    defines.append(('PYCXX_PYTHON_2TO3', '1'))
+
 # Based on the contents of setup.cfg, determine the build options
 if os.path.exists("setup.cfg"):
     config = configparser.SafeConfigParser()

Modified: branches/py3k/src/_backend_agg.cpp
===================================================================
--- branches/py3k/src/_backend_agg.cpp  2010-07-15 17:37:19 UTC (rev 8555)
+++ branches/py3k/src/_backend_agg.cpp  2010-07-15 18:34:54 UTC (rev 8556)
@@ -213,7 +213,7 @@
 GCAgg::_set_antialiased(const Py::Object& gc)
 {
     _VERBOSE("GCAgg::antialiased");
-    isaa = gc.getAttr("_antialiased").as_bool();
+    isaa = Py::Boolean(gc.getAttr("_antialiased"));
 }
 
 
@@ -1518,7 +1518,7 @@
 
         if (check_snap)
         {
-            gc.isaa = antialiaseds[i % Naa].as_bool();
+            gc.isaa = Py::Boolean(antialiaseds[i % Naa]);
 
             transformed_path_t tpath(path, trans);
             nan_removed_t      nan_removed(tpath, true, has_curves);
@@ -1537,7 +1537,7 @@
         }
         else
         {
-            gc.isaa = antialiaseds[i % Naa].as_bool();
+            gc.isaa = Py::Boolean(antialiaseds[i % Naa]);
 
             transformed_path_t tpath(path, trans);
             nan_removed_t      nan_removed(tpath, true, has_curves);
@@ -1750,8 +1750,8 @@
     Py::Object              offsets_obj      = args[5];
     agg::trans_affine       offset_trans     = 
py_to_agg_transformation_matrix(args[6].ptr());
     Py::Object              facecolors_obj   = args[7];
-    bool                    antialiased      = args[8].as_bool();
-    bool                    showedges        = args[9].as_bool();
+    bool                    antialiased      = Py::Boolean(args[8]);
+    bool                    showedges        = Py::Boolean(args[9]);
     bool                    free_edgecolors  = false;
 
     QuadMeshGenerator path_generator(mesh_width, mesh_height, 
coordinates.ptr());

Modified: branches/py3k/src/_path.cpp
===================================================================
--- branches/py3k/src/_path.cpp 2010-07-15 17:37:19 UTC (rev 8555)
+++ branches/py3k/src/_path.cpp 2010-07-15 18:34:54 UTC (rev 8556)
@@ -379,7 +379,7 @@
             "Must pass Bbox object as arg 3 of update_path_extents");
     }
     Py::Object minpos_obj = args[3];
-    bool ignore = args[4].as_bool();
+    bool ignore = Py::Boolean(args[4]);
 
     double xm, ym;
     PyArrayObject* input_minpos = NULL;
@@ -599,7 +599,7 @@
     Py::SeqBase<Py::Object> transforms_obj   = args[5];
     Py::SeqBase<Py::Object> offsets_obj      = args[6];
     agg::trans_affine       offset_trans     = 
py_to_agg_transformation_matrix(args[7].ptr());
-    bool                    filled           = args[8].as_bool();
+    bool                    filled           = Py::Boolean(args[8]);
 
     PyArrayObject* offsets = (PyArrayObject*)PyArray_FromObject(
         offsets_obj.ptr(), PyArray_DOUBLE, 0, 2);
@@ -926,7 +926,7 @@
 
     PathIterator path(args[0]);
     Py::Object bbox_obj = args[1];
-    bool inside = args[2].as_bool();
+    bool inside = Py::Boolean(args[2]);
 
     double x0, y0, x1, y1;
     if (!py_convert_bbox(bbox_obj.ptr(), x0, y0, x1, y1))


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to