[python-shapely] 70/148: Imported Upstream version 1.2.13

Sebastiaan Couwenberg sebastic at moszumanska.debian.org
Thu Aug 20 17:42:04 UTC 2015


This is an automated email from the git hooks/post-receive script.

sebastic pushed a commit to branch master
in repository python-shapely.

commit 9db99d64430d16853230592c258129dc5b45ef61
Author: Pietro Battiston <me at pietrobattiston.it>
Date:   Wed Dec 21 16:10:42 2011 +0100

    Imported Upstream version 1.2.13
---
 CHANGES.txt                         |  21 ++++++
 CREDITS.txt                         |   4 +-
 PKG-INFO                            |  77 +++++++++++++---------
 README.txt => README.rst            |  52 ++++++++-------
 Shapely.egg-info/PKG-INFO           |  77 +++++++++++++---------
 Shapely.egg-info/SOURCES.txt        |   2 +-
 docs/manual.txt                     |  20 +++---
 setup.py                            |  23 +++++--
 shapely/__init__.py                 |   3 +-
 shapely/ctypes_declarations.py      |   5 ++
 shapely/geometry/base.py            |   5 +-
 shapely/geometry/linestring.py      |  21 +++---
 shapely/geometry/multilinestring.py |   3 -
 shapely/geometry/multipoint.py      |   5 +-
 shapely/geometry/polygon.py         |  58 ++++++-----------
 shapely/geos.py                     |  13 ++--
 shapely/predicates.py               |   4 +-
 shapely/prepared.py                 |   5 +-
 shapely/speedups/__init__.py        |   3 +
 shapely/speedups/_speedups.c        | 123 +++++++++++++++++++-----------------
 shapely/speedups/_speedups.pyx      |  22 +++----
 shapely/tests/test_prepared.py      |  15 ++++-
 shapely/topology.py                 |  14 ++--
 shapely/wkb.py                      |   4 +-
 24 files changed, 330 insertions(+), 249 deletions(-)

diff --git a/CHANGES.txt b/CHANGES.txt
index 3897490..970ce91 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -2,6 +2,27 @@
 CHANGES
 =======
 
+1.2.13 (2011-09-16)
+-------------------
+- Fixed errors in speedups on 32bit systems when GEOS references memory above 2GB.
+- Add shapely.__version__ attribute.
+- Update the manual.
+
+1.2.12 (2011-08-15)
+-------------------
+- Build Windows distributions with VC7 or VC9 as appropriate.
+- More verbose report on failure to speed up.
+- Fix for prepared geometries broken in 1.2.11.
+- DO NOT INSTALL 1.2.11
+
+1.2.11 (2011-08-04)
+-------------------
+- Ignore AttributeError during exit.
+- PyPy 1.5 support.
+- Prevent operation on prepared geometry crasher (#12).
+- Optional Cython speedups for Windows.
+- Linux 3 platform support.
+
 1.2.10 (2011-05-09)
 -------------------
 - Add optional Cython speedups.
diff --git a/CREDITS.txt b/CREDITS.txt
index 8967542..a496ced 100644
--- a/CREDITS.txt
+++ b/CREDITS.txt
@@ -3,6 +3,7 @@ Shapely is written by:
 * Sean Gillies
 * Aron Bierbaum
 * Kai Lautaportti
+* Oliver Tonnhofer
 
 Patches contributed by:
 
@@ -11,7 +12,6 @@ Patches contributed by:
 * Eric Lemoine
 * Jonathan Tartley
 * Kristian Thy
-* Oliver Tonnhofer
 
 Additional help from:
 
@@ -22,3 +22,5 @@ Additional help from:
 
 Major portions of this work were supported by a grant (for Pleiades_) from the
 U.S. National Endowment for the Humanities (http://www.neh.gov).
+
+.. _Pleiades: http://pleiades.stoa.org
diff --git a/PKG-INFO b/PKG-INFO
index 78a49df..8a6a778 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,34 +1,34 @@
 Metadata-Version: 1.0
 Name: Shapely
-Version: 1.2.10
+Version: 1.2.13
 Summary: Geometric objects, predicates, and operations
-Home-page: http://trac.gispython.org/lab/wiki/Shapely
+Home-page: https://github.com/sgillies/shapely
 Author: Sean Gillies
 Author-email: sean.gillies at gmail.com
 License: BSD
-Description: ======
-        README
-        ======
+Description: =======
+        Shapely
+        =======
+        
+        PostGIS-ish operations outside a database context for Pythoneers and Pythonistas
         
         .. image:: http://farm3.static.flickr.com/2738/4511827859_b5822043b7_o_d.png
         :width: 800
         :height: 400
         
         Shapely is a BSD-licensed Python package for manipulation and analysis of
-        planar geometric objects. It is not concerned with data formats or coordinate
-        systems.  It is based on the widely deployed GEOS_ (the engine of PostGIS_) and
-        JTS_ (from which GEOS is ported) libraries. This C dependency is traded for the
-        ability to execute with blazing speed.
-        
-        In a nutshell: Shapely lets you do PostGIS-ish stuff outside the context of a
-        database using idiomatic Python. For more details, see:
+        planar geometric objects. It is based on the widely deployed GEOS_ (the engine
+        of PostGIS_) and JTS_ (from which GEOS is ported) libraries. This C dependency
+        is traded for the ability to execute with blazing speed. Shapely is not
+        concerned with data formats or coordinate systems, but can be readily
+        integrated with packages that are. For more details, see:
         
         * Shapely wiki_
         * Shapely manual_
         * Shapely `example apps`_
         
         Dependencies
-        ------------
+        ============
         
         Shapely 1.2 depends on:
         
@@ -36,7 +36,7 @@ Description: ======
         * libgeos_c >=3.1 (3.0 and below have not been tested, YMMV)
         
         Installation
-        ------------
+        ============
         
         Windows users should use the executable installer, which contains the required
         GEOS DLL. Other users should acquire libgeos_c by any means, make sure that it
@@ -49,7 +49,7 @@ Description: ======
         $ python setup.py install
         
         Usage
-        -----
+        =====
         
         Here is the canonical example of building an approximately circular patch by
         buffering a point::
@@ -65,7 +65,7 @@ Description: ======
         intersect.py `example apps`_.
         
         Integration
-        -----------
+        ===========
         
         Shapely does not read or write data files, but it can serialize and deserialize
         using several well known formats and protocols. The shapely.wkb and shapely.wkt
@@ -88,8 +88,8 @@ Description: ======
         [  1.00000000e+01,   0.00000000e+00]])
         
         That yields a numpy array of [x, y] arrays. This is not always exactly what one
-        wants for plotting shapes with Matplotlib, so Shapely 1.2 adds a `xy` property
-        for getting separate arrays of coordinate x and y values.::
+        wants for plotting shapes with Matplotlib (for example), so Shapely 1.2 adds
+        a `xy` property for obtaining separate arrays of coordinate x and y values.::
         
         >>> x, y = patch.exterior.xy
         >>> ax = asarray(x)
@@ -105,7 +105,7 @@ Description: ======
         'LINESTRING (10.0000000000000000 0.0000000000000000, ...)'
         
         Testing
-        -------
+        =======
         
         Shapely uses a Zope-stye suite of unittests and doctests, excercised via
         setup.py.::
@@ -116,16 +116,12 @@ Description: ======
         supported well by nose.
         
         Support
-        -------
-        
-        For current information about this project, see the wiki_.
-        
-        If you have questions, please consider joining our community list:
+        =======
         
-        http://trac.gispython.org/projects/PCL/wiki/CommunityList
+        Bugs may be reported and questions asked via https://github.com/sgillies/shapely.
         
         Credits
-        -------
+        =======
         
         Shapely is written by:
         
@@ -136,8 +132,8 @@ Description: ======
         Patches contributed by:
         
         * Howard Butler
-        * Fr |eaigue| d |eaigue| ric Junod
-        * Eric Lemoine
+        * Fr |eacute| d |eacute| ric Junod
+        * |Eacute| ric Lemoine
         * Jonathan Tartley
         * Kristian Thy
         * Oliver Tonnhofer
@@ -158,7 +154,9 @@ Description: ======
         .. _example apps: http://trac.gispython.org/lab/wiki/Examples
         .. _wiki: http://trac.gispython.org/lab/wiki/Shapely
         .. _manual: http://gispython.org/shapely/docs/1.2
-        .. |eaigue| unicode:: U+00E9
+        .. |eacute| unicode:: U+00E9
+        :trim:
+        .. |Eacute| unicode:: U+00C9
         :trim:
         .. _Pleiades: http://pleiades.stoa.org
         
@@ -166,6 +164,27 @@ Description: ======
         CHANGES
         =======
         
+        1.2.13 (2011-09-16)
+        -------------------
+        - Fixed errors in speedups on 32bit systems when GEOS references memory above 2GB.
+        - Add shapely.__version__ attribute.
+        - Update the manual.
+        
+        1.2.12 (2011-08-15)
+        -------------------
+        - Build Windows distributions with VC7 or VC9 as appropriate.
+        - More verbose report on failure to speed up.
+        - Fix for prepared geometries broken in 1.2.11.
+        - DO NOT INSTALL 1.2.11
+        
+        1.2.11 (2011-08-04)
+        -------------------
+        - Ignore AttributeError during exit.
+        - PyPy 1.5 support.
+        - Prevent operation on prepared geometry crasher (#12).
+        - Optional Cython speedups for Windows.
+        - Linux 3 platform support.
+        
         1.2.10 (2011-05-09)
         -------------------
         - Add optional Cython speedups.
diff --git a/README.txt b/README.rst
similarity index 79%
rename from README.txt
rename to README.rst
index 382b16f..5676ebd 100644
--- a/README.txt
+++ b/README.rst
@@ -1,26 +1,26 @@
-======
-README
-======
+=======
+Shapely
+=======
+
+PostGIS-ish operations outside a database context for Pythoneers and Pythonistas
 
 .. image:: http://farm3.static.flickr.com/2738/4511827859_b5822043b7_o_d.png
    :width: 800
    :height: 400
 
 Shapely is a BSD-licensed Python package for manipulation and analysis of
-planar geometric objects. It is not concerned with data formats or coordinate
-systems.  It is based on the widely deployed GEOS_ (the engine of PostGIS_) and
-JTS_ (from which GEOS is ported) libraries. This C dependency is traded for the
-ability to execute with blazing speed.
-
-In a nutshell: Shapely lets you do PostGIS-ish stuff outside the context of a
-database using idiomatic Python. For more details, see:
+planar geometric objects. It is based on the widely deployed GEOS_ (the engine
+of PostGIS_) and JTS_ (from which GEOS is ported) libraries. This C dependency
+is traded for the ability to execute with blazing speed. Shapely is not
+concerned with data formats or coordinate systems, but can be readily
+integrated with packages that are. For more details, see:
 
 * Shapely wiki_
 * Shapely manual_
 * Shapely `example apps`_
 
 Dependencies
-------------
+============
 
 Shapely 1.2 depends on:
 
@@ -28,7 +28,7 @@ Shapely 1.2 depends on:
 * libgeos_c >=3.1 (3.0 and below have not been tested, YMMV)
 
 Installation
-------------
+============
 
 Windows users should use the executable installer, which contains the required
 GEOS DLL. Other users should acquire libgeos_c by any means, make sure that it
@@ -41,7 +41,7 @@ or from a source distribution with the setup script::
   $ python setup.py install
 
 Usage
------
+=====
 
 Here is the canonical example of building an approximately circular patch by
 buffering a point::
@@ -57,7 +57,7 @@ See the manual_ for comprehensive usage snippets and the dissolve.py and
 intersect.py `example apps`_.
 
 Integration 
------------
+===========
 
 Shapely does not read or write data files, but it can serialize and deserialize
 using several well known formats and protocols. The shapely.wkb and shapely.wkt
@@ -80,8 +80,8 @@ provide the Numpy array interface.::
          [  1.00000000e+01,   0.00000000e+00]])
 
 That yields a numpy array of [x, y] arrays. This is not always exactly what one
-wants for plotting shapes with Matplotlib, so Shapely 1.2 adds a `xy` property
-for getting separate arrays of coordinate x and y values.::
+wants for plotting shapes with Matplotlib (for example), so Shapely 1.2 adds
+a `xy` property for obtaining separate arrays of coordinate x and y values.::
 
   >>> x, y = patch.exterior.xy
   >>> ax = asarray(x)
@@ -97,7 +97,7 @@ Numpy arrays can also be adapted to Shapely linestrings::
   'LINESTRING (10.0000000000000000 0.0000000000000000, ...)'
 
 Testing
--------
+=======
 
 Shapely uses a Zope-stye suite of unittests and doctests, excercised via
 setup.py.::
@@ -108,16 +108,12 @@ Nosetests won't run the tests properly; Zope doctest suites are not currently
 supported well by nose.
 
 Support
--------
-
-For current information about this project, see the wiki_.
+=======
 
-If you have questions, please consider joining our community list:
-
-http://trac.gispython.org/projects/PCL/wiki/CommunityList
+Bugs may be reported and questions asked via https://github.com/sgillies/shapely.
 
 Credits
--------
+=======
 
 Shapely is written by:
 
@@ -128,8 +124,8 @@ Shapely is written by:
 Patches contributed by:
 
 * Howard Butler
-* Fr |eaigue| d |eaigue| ric Junod
-* Eric Lemoine
+* Fr |eacute| d |eacute| ric Junod
+* |Eacute| ric Lemoine
 * Jonathan Tartley
 * Kristian Thy
 * Oliver Tonnhofer
@@ -150,6 +146,8 @@ U.S. National Endowment for the Humanities (http://www.neh.gov).
 .. _example apps: http://trac.gispython.org/lab/wiki/Examples
 .. _wiki: http://trac.gispython.org/lab/wiki/Shapely
 .. _manual: http://gispython.org/shapely/docs/1.2
-.. |eaigue| unicode:: U+00E9
+.. |eacute| unicode:: U+00E9
+   :trim:
+.. |Eacute| unicode:: U+00C9
    :trim:
 .. _Pleiades: http://pleiades.stoa.org
diff --git a/Shapely.egg-info/PKG-INFO b/Shapely.egg-info/PKG-INFO
index 78a49df..8a6a778 100644
--- a/Shapely.egg-info/PKG-INFO
+++ b/Shapely.egg-info/PKG-INFO
@@ -1,34 +1,34 @@
 Metadata-Version: 1.0
 Name: Shapely
-Version: 1.2.10
+Version: 1.2.13
 Summary: Geometric objects, predicates, and operations
-Home-page: http://trac.gispython.org/lab/wiki/Shapely
+Home-page: https://github.com/sgillies/shapely
 Author: Sean Gillies
 Author-email: sean.gillies at gmail.com
 License: BSD
-Description: ======
-        README
-        ======
+Description: =======
+        Shapely
+        =======
+        
+        PostGIS-ish operations outside a database context for Pythoneers and Pythonistas
         
         .. image:: http://farm3.static.flickr.com/2738/4511827859_b5822043b7_o_d.png
         :width: 800
         :height: 400
         
         Shapely is a BSD-licensed Python package for manipulation and analysis of
-        planar geometric objects. It is not concerned with data formats or coordinate
-        systems.  It is based on the widely deployed GEOS_ (the engine of PostGIS_) and
-        JTS_ (from which GEOS is ported) libraries. This C dependency is traded for the
-        ability to execute with blazing speed.
-        
-        In a nutshell: Shapely lets you do PostGIS-ish stuff outside the context of a
-        database using idiomatic Python. For more details, see:
+        planar geometric objects. It is based on the widely deployed GEOS_ (the engine
+        of PostGIS_) and JTS_ (from which GEOS is ported) libraries. This C dependency
+        is traded for the ability to execute with blazing speed. Shapely is not
+        concerned with data formats or coordinate systems, but can be readily
+        integrated with packages that are. For more details, see:
         
         * Shapely wiki_
         * Shapely manual_
         * Shapely `example apps`_
         
         Dependencies
-        ------------
+        ============
         
         Shapely 1.2 depends on:
         
@@ -36,7 +36,7 @@ Description: ======
         * libgeos_c >=3.1 (3.0 and below have not been tested, YMMV)
         
         Installation
-        ------------
+        ============
         
         Windows users should use the executable installer, which contains the required
         GEOS DLL. Other users should acquire libgeos_c by any means, make sure that it
@@ -49,7 +49,7 @@ Description: ======
         $ python setup.py install
         
         Usage
-        -----
+        =====
         
         Here is the canonical example of building an approximately circular patch by
         buffering a point::
@@ -65,7 +65,7 @@ Description: ======
         intersect.py `example apps`_.
         
         Integration
-        -----------
+        ===========
         
         Shapely does not read or write data files, but it can serialize and deserialize
         using several well known formats and protocols. The shapely.wkb and shapely.wkt
@@ -88,8 +88,8 @@ Description: ======
         [  1.00000000e+01,   0.00000000e+00]])
         
         That yields a numpy array of [x, y] arrays. This is not always exactly what one
-        wants for plotting shapes with Matplotlib, so Shapely 1.2 adds a `xy` property
-        for getting separate arrays of coordinate x and y values.::
+        wants for plotting shapes with Matplotlib (for example), so Shapely 1.2 adds
+        a `xy` property for obtaining separate arrays of coordinate x and y values.::
         
         >>> x, y = patch.exterior.xy
         >>> ax = asarray(x)
@@ -105,7 +105,7 @@ Description: ======
         'LINESTRING (10.0000000000000000 0.0000000000000000, ...)'
         
         Testing
-        -------
+        =======
         
         Shapely uses a Zope-stye suite of unittests and doctests, excercised via
         setup.py.::
@@ -116,16 +116,12 @@ Description: ======
         supported well by nose.
         
         Support
-        -------
-        
-        For current information about this project, see the wiki_.
-        
-        If you have questions, please consider joining our community list:
+        =======
         
-        http://trac.gispython.org/projects/PCL/wiki/CommunityList
+        Bugs may be reported and questions asked via https://github.com/sgillies/shapely.
         
         Credits
-        -------
+        =======
         
         Shapely is written by:
         
@@ -136,8 +132,8 @@ Description: ======
         Patches contributed by:
         
         * Howard Butler
-        * Fr |eaigue| d |eaigue| ric Junod
-        * Eric Lemoine
+        * Fr |eacute| d |eacute| ric Junod
+        * |Eacute| ric Lemoine
         * Jonathan Tartley
         * Kristian Thy
         * Oliver Tonnhofer
@@ -158,7 +154,9 @@ Description: ======
         .. _example apps: http://trac.gispython.org/lab/wiki/Examples
         .. _wiki: http://trac.gispython.org/lab/wiki/Shapely
         .. _manual: http://gispython.org/shapely/docs/1.2
-        .. |eaigue| unicode:: U+00E9
+        .. |eacute| unicode:: U+00E9
+        :trim:
+        .. |Eacute| unicode:: U+00C9
         :trim:
         .. _Pleiades: http://pleiades.stoa.org
         
@@ -166,6 +164,27 @@ Description: ======
         CHANGES
         =======
         
+        1.2.13 (2011-09-16)
+        -------------------
+        - Fixed errors in speedups on 32bit systems when GEOS references memory above 2GB.
+        - Add shapely.__version__ attribute.
+        - Update the manual.
+        
+        1.2.12 (2011-08-15)
+        -------------------
+        - Build Windows distributions with VC7 or VC9 as appropriate.
+        - More verbose report on failure to speed up.
+        - Fix for prepared geometries broken in 1.2.11.
+        - DO NOT INSTALL 1.2.11
+        
+        1.2.11 (2011-08-04)
+        -------------------
+        - Ignore AttributeError during exit.
+        - PyPy 1.5 support.
+        - Prevent operation on prepared geometry crasher (#12).
+        - Optional Cython speedups for Windows.
+        - Linux 3 platform support.
+        
         1.2.10 (2011-05-09)
         -------------------
         - Add optional Cython speedups.
diff --git a/Shapely.egg-info/SOURCES.txt b/Shapely.egg-info/SOURCES.txt
index 74426a7..5326a5e 100644
--- a/Shapely.egg-info/SOURCES.txt
+++ b/Shapely.egg-info/SOURCES.txt
@@ -1,7 +1,7 @@
 CHANGES.txt
 CREDITS.txt
 LICENSE.txt
-README.txt
+README.rst
 setup.cfg
 setup.py
 Shapely.egg-info/PKG-INFO
diff --git a/docs/manual.txt b/docs/manual.txt
index 1d0bfde..746c2aa 100644
--- a/docs/manual.txt
+++ b/docs/manual.txt
@@ -3,8 +3,8 @@ The Shapely User Manual
 =======================
 
 :Author: Sean Gillies, <sean.gillies at gmail.com>
-:Revision: 1.2.10
-:Date: 2 May 2011
+:Revision: 1.2.13
+:Date: 15 September 2011
 :Copyright: 
   This work is licensed under a `Creative Commons Attribution 3.0
   United States License`__.
@@ -1796,19 +1796,19 @@ Performance
 
 Shapely uses the GEOS_ library for all operations. GEOS is written in C++ and
 used in many applications and you can expect that all operations are highly
-optimized. Only the creation of new geometries involves some overhead that
-might slow down your code, if you create lots of geometries with a large number
-of coordinates.
+optimized. The creation of new geometries with many coordinates, however,
+involves some overhead that might slow down your code.
 
 .. versionadded:: 1.2.10
 
-The :mod:`shapely.speedups` module contains performance enhancements written
-in C. They are automaticaly installed when Python has access to a compiler
-during installation.
+The :mod:`shapely.speedups` module contains performance enhancements written in
+C. They are automaticaly installed when Python has access to a compiler during
+installation.
 
 You can check if the speedups are installed with the :attr:`available`
-attribute. To enable the speedups call :func:`enable`. You can revert to the
-default implementation with :func:`disable`.
+attribute. The constructor speedups are disabled by default. To enable the
+speedups call :func:`enable`. You can revert to the default implementation with
+:func:`disable`.
 
 .. sourcecode:: pycon
 
diff --git a/setup.py b/setup.py
index 9d30ac1..aafca2e 100644
--- a/setup.py
+++ b/setup.py
@@ -15,14 +15,15 @@ from setuptools.extension import Extension
 from setuptools.command.build_ext import build_ext
 from setuptools import setup, find_packages
 import sys
+import platform
 
-readme_text = file('README.txt', 'rb').read()
+readme_text = file('README.rst', 'rb').read()
 changes_text = file('CHANGES.txt', 'rb').read()
 
 setup_args = dict(
     metadata_version    = '1.2',
     name                = 'Shapely',
-    version             = '1.2.10',
+    version             = '1.2.13',
     requires_python     = '>=2.5,<3',
     requires_external   = 'libgeos_c (>=3.1)', 
     description         = 'Geometric objects, predicates, and operations',
@@ -32,7 +33,7 @@ setup_args = dict(
     author_email        = 'sean.gillies at gmail.com',
     maintainer          = 'Sean Gillies',
     maintainer_email    = 'sean.gillies at gmail.com',
-    url                 = 'http://trac.gispython.org/lab/wiki/Shapely',
+    url                 = 'https://github.com/sgillies/shapely',
     long_description    = readme_text + "\n" + changes_text,
     packages            = find_packages(),
     test_suite          = 'shapely.tests.test_suite',
@@ -51,11 +52,15 @@ setup_args = dict(
 if sys.platform == 'win32':
     if '(AMD64)' in sys.version:
         setup_args.update(
-            data_files=[('DLLs', glob.glob('DLLs_AMD64/*.dll'))]
+            data_files=[('DLLs', glob.glob('DLLs_AMD64_VC9/*.dll'))]
             )
+    elif platform.python_version().startswith('2.5.'):
+        setup_args.update(
+            data_files=[('DLLs', glob.glob('DLLs_x86_VC7/*.dll'))]
+            )       
     else:
         setup_args.update(
-            data_files=[('DLLs', glob.glob('DLLs_x86/*.dll'))]
+            data_files=[('DLLs', glob.glob('DLLs_x86_VC9/*.dll'))]
             )
 
 
@@ -88,6 +93,14 @@ class ve_build_ext(build_ext):
             raise BuildFailed(x)
 
 if sys.platform == 'win32':
+    # geos DLL is geos.dll instead of geos_c.dll on Windows
+    ext_modules = [
+        Extension("shapely.speedups._speedups",
+              ["shapely/speedups/_speedups.c"], libraries=['geos']),
+    ]
+elif (hasattr(platform, 'python_implementation') 
+    and platform.python_implementation() == 'PyPy'):
+    # python_implementation >= 2.6
     ext_modules = []
 else:
     ext_modules = [
diff --git a/shapely/__init__.py b/shapely/__init__.py
index 5bb534f..a4b958d 100644
--- a/shapely/__init__.py
+++ b/shapely/__init__.py
@@ -1 +1,2 @@
-# package
+__version__ = "1.2.13"
+
diff --git a/shapely/ctypes_declarations.py b/shapely/ctypes_declarations.py
index d185fd8..3039945 100644
--- a/shapely/ctypes_declarations.py
+++ b/shapely/ctypes_declarations.py
@@ -6,12 +6,17 @@ import ctypes
 class allocated_c_char_p(ctypes.c_char_p):
     pass
 
+EXCEPTION_HANDLER_FUNCTYPE = ctypes.CFUNCTYPE(None, ctypes.c_char_p, ctypes.c_char_p)
+
 def prototype(lgeos, geosVersion):
 
+    lgeos.initGEOS.argtypes = [EXCEPTION_HANDLER_FUNCTYPE, EXCEPTION_HANDLER_FUNCTYPE]
     lgeos.initGEOS.restype = None
 
+    lgeos.finishGEOS.argtypes = []
     lgeos.finishGEOS.restype = None
 
+    lgeos.GEOSversion.argtypes = []
     lgeos.GEOSversion.restype = ctypes.c_char_p
 
     lgeos.GEOSGeomFromWKT.restype = ctypes.c_void_p
diff --git a/shapely/geometry/base.py b/shapely/geometry/base.py
index 8e3949e..1a2bb70 100644
--- a/shapely/geometry/base.py
+++ b/shapely/geometry/base.py
@@ -104,7 +104,10 @@ class BaseGeometry(object):
         # TODO: defer cleanup to the implementation. We shouldn't be
         # explicitly calling a lgeos method here.
         if not (self._owned or self._is_empty):
-            self._lgeos.GEOSGeom_destroy(self.__geom__)
+            try:
+                self._lgeos.GEOSGeom_destroy(self.__geom__)
+            except AttributeError:
+                pass # _lgeos might be empty on shutdown
         self.__geom__ = EMPTY
 
     def __del__(self):
diff --git a/shapely/geometry/linestring.py b/shapely/geometry/linestring.py
index 964ee54..da172a0 100644
--- a/shapely/geometry/linestring.py
+++ b/shapely/geometry/linestring.py
@@ -167,9 +167,10 @@ def geos_linestring_from_py(ob, update_geom=None, update_ndim=0):
         assert n == 2 or n == 3
 
         # Make pointer to the coordinate array
-        try:
+        if isinstance(array['data'], tuple):
+            # numpy tuple (addr, read-only)
             cp = cast(array['data'][0], POINTER(c_double))
-        except ArgumentError:
+        else:
             cp = array['data']
 
         # Create a coordinate sequence
@@ -226,21 +227,15 @@ def geos_linestring_from_py(ob, update_geom=None, update_ndim=0):
         # add to coordinate sequence
         for i in xrange(m):
             coords = ob[i]
-            dx = c_double(coords[0])
-            dy = c_double(coords[1])
-            dz = None
+            # Because of a bug in the GEOS C API, 
+            # always set X before Y
+            lgeos.GEOSCoordSeq_setX(cs, i, coords[0])
+            lgeos.GEOSCoordSeq_setY(cs, i, coords[1])
             if n == 3:
                 try:
-                    dz = c_double(coords[2])
+                    lgeos.GEOSCoordSeq_setZ(cs, i, coords[2])
                 except IndexError:
                     raise ValueError("Inconsistent coordinate dimensionality")
-        
-            # Because of a bug in the GEOS C API, 
-            # always set X before Y
-            lgeos.GEOSCoordSeq_setX(cs, i, dx)
-            lgeos.GEOSCoordSeq_setY(cs, i, dy)
-            if n == 3:
-                lgeos.GEOSCoordSeq_setZ(cs, i, dz)
     
     if update_geom is not None:
         return None
diff --git a/shapely/geometry/multilinestring.py b/shapely/geometry/multilinestring.py
index ebf78a4..f3d5234 100644
--- a/shapely/geometry/multilinestring.py
+++ b/shapely/geometry/multilinestring.py
@@ -93,9 +93,6 @@ def geos_multilinestring_from_py(ob):
         L = array['shape'][0]
         assert L >= 1
 
-        # Make pointer to the coordinate array
-        cp = cast(array['data'][0], POINTER(c_double))
-
         # Array of pointers to sub-geometries
         subs = (c_void_p * L)()
 
diff --git a/shapely/geometry/multipoint.py b/shapely/geometry/multipoint.py
index 6a36a92..a02e7a9 100644
--- a/shapely/geometry/multipoint.py
+++ b/shapely/geometry/multipoint.py
@@ -138,9 +138,10 @@ def geos_multipoint_from_py(ob):
         assert n == 2 or n == 3
 
         # Make pointer to the coordinate array
-        try:
+        if isinstance(array['data'], tuple):
+            # numpy tuple (addr, read-only)
             cp = cast(array['data'][0], POINTER(c_double))
-        except ArgumentError:
+        else:
             cp = array['data']
 
         # Array of pointers to sub-geometries
diff --git a/shapely/geometry/polygon.py b/shapely/geometry/polygon.py
index 5fb5ccb..8c0d6f8 100644
--- a/shapely/geometry/polygon.py
+++ b/shapely/geometry/polygon.py
@@ -312,9 +312,10 @@ def geos_linearring_from_py(ob, update_geom=None, update_ndim=0):
         assert n == 2 or n == 3
 
         # Make pointer to the coordinate array
-        try:
+        if isinstance(array['data'], tuple):
+            # numpy tuple (addr, read-only)
             cp = cast(array['data'][0], POINTER(c_double))
-        except ArgumentError:
+        else:
             cp = array['data']
 
         # Add closing coordinates to sequence?
@@ -335,33 +336,21 @@ def geos_linearring_from_py(ob, update_geom=None, update_ndim=0):
 
         # add to coordinate sequence
         for i in xrange(m):
-            dx = c_double(cp[n*i])
-            dy = c_double(cp[n*i+1])
-            dz = None
-            if n == 3:
-                dz = c_double(cp[n*i+2])
-        
             # Because of a bug in the GEOS C API, 
             # always set X before Y
-            lgeos.GEOSCoordSeq_setX(cs, i, dx)
-            lgeos.GEOSCoordSeq_setY(cs, i, dy)
+            lgeos.GEOSCoordSeq_setX(cs, i, cp[n*i])
+            lgeos.GEOSCoordSeq_setY(cs, i, cp[n*i+1])
             if n == 3:
-                lgeos.GEOSCoordSeq_setZ(cs, i, dz)
+                lgeos.GEOSCoordSeq_setZ(cs, i, cp[n*i+2])
 
         # Add closing coordinates to sequence?
-        if M > m:
-            dx = c_double(cp[0])
-            dy = c_double(cp[1])
-            dz = None
-            if n == 3:
-                dz = c_double(cp[2])
-        
+        if M > m:        
             # Because of a bug in the GEOS C API, 
             # always set X before Y
-            lgeos.GEOSCoordSeq_setX(cs, M-1, dx)
-            lgeos.GEOSCoordSeq_setY(cs, M-1, dy)
+            lgeos.GEOSCoordSeq_setX(cs, M-1, cp[0])
+            lgeos.GEOSCoordSeq_setY(cs, M-1, cp[1])
             if n == 3:
-                lgeos.GEOSCoordSeq_setZ(cs, M-1, dz)
+                lgeos.GEOSCoordSeq_setZ(cs, M-1, cp[2])
             
     except AttributeError:
         # Fall back on list
@@ -391,34 +380,25 @@ def geos_linearring_from_py(ob, update_geom=None, update_ndim=0):
         # add to coordinate sequence
         for i in xrange(m):
             coords = ob[i]
-            dx = c_double(coords[0])
-            dy = c_double(coords[1])
-            dz = None
-            if n == 3:
-                dz = c_double(coords[2])
-        
             # Because of a bug in the GEOS C API, 
             # always set X before Y
-            lgeos.GEOSCoordSeq_setX(cs, i, dx)
-            lgeos.GEOSCoordSeq_setY(cs, i, dy)
+            lgeos.GEOSCoordSeq_setX(cs, i, coords[0])
+            lgeos.GEOSCoordSeq_setY(cs, i, coords[1])
             if n == 3:
-                lgeos.GEOSCoordSeq_setZ(cs, i, dz)
+                try:
+                    lgeos.GEOSCoordSeq_setZ(cs, i, coords[2])
+                except IndexError:
+                    raise ValueError("Inconsistent coordinate dimensionality")
 
         # Add closing coordinates to sequence?
         if M > m:
             coords = ob[0]
-            dx = c_double(coords[0])
-            dy = c_double(coords[1])
-            dz = None
-            if n == 3:
-                dz = c_double(coords[2])
-        
             # Because of a bug in the GEOS C API, 
             # always set X before Y
-            lgeos.GEOSCoordSeq_setX(cs, M-1, dx)
-            lgeos.GEOSCoordSeq_setY(cs, M-1, dy)
+            lgeos.GEOSCoordSeq_setX(cs, M-1, coords[0])
+            lgeos.GEOSCoordSeq_setY(cs, M-1, coords[1])
             if n == 3:
-                lgeos.GEOSCoordSeq_setZ(cs, M-1, dz)
+                lgeos.GEOSCoordSeq_setZ(cs, M-1, coords[2])
 
     if update_geom is not None:
         return None
diff --git a/shapely/geos.py b/shapely/geos.py
index dbaa983..eff83ff 100644
--- a/shapely/geos.py
+++ b/shapely/geos.py
@@ -12,7 +12,7 @@ from ctypes import cdll, CDLL, CFUNCTYPE, c_char_p, c_void_p, string_at
 from ctypes.util import find_library
 
 import ftools
-from ctypes_declarations import prototype
+from ctypes_declarations import prototype, EXCEPTION_HANDLER_FUNCTYPE
 
 
 
@@ -43,7 +43,7 @@ def load_dll(libname, fallbacks=None):
             "Could not find library %s or load any of its variants %s" % (
                 libname, fallbacks or []))
        
-if sys.platform == 'linux2':
+if sys.platform.startswith('linux'):
     _lgeos = load_dll('geos_c', fallbacks=['libgeos_c.so.1', 'libgeos_c.so'])
     free = load_dll('c').free
     free.argtypes = [c_void_p]
@@ -92,6 +92,7 @@ else: # other *nix systems
 
 def _geos_c_version():
     func = _lgeos.GEOSversion
+    func.argtypes = []
     func.restype = c_char_p
     v = func().split('-')[2]
     return tuple(int(n) for n in v.split('.'))
@@ -129,7 +130,7 @@ if geos_c_version >= (1,5,0):
     
     # Handle special case.
     _lgeos.initGEOS_r.restype = c_void_p
-    _lgeos.initGEOS_r.argtypes = [c_void_p, c_void_p]
+    _lgeos.initGEOS_r.argtypes = [EXCEPTION_HANDLER_FUNCTYPE, EXCEPTION_HANDLER_FUNCTYPE]
     _lgeos.finishGEOS_r.argtypes = [c_void_p]
 
 # Exceptions
@@ -148,11 +149,11 @@ class PredicateError(Exception):
 
 def error_handler(fmt, list):
     LOG.error("%s", list)
-error_h = CFUNCTYPE(None, c_char_p, c_char_p)(error_handler)
+error_h = EXCEPTION_HANDLER_FUNCTYPE(error_handler)
 
 def notice_handler(fmt, list):
     LOG.warning("%s", list)
-notice_h = CFUNCTYPE(None, c_char_p, c_char_p)(notice_handler)
+notice_h = EXCEPTION_HANDLER_FUNCTYPE(notice_handler)
 
 def cleanup():
     if _lgeos is not None :
@@ -166,7 +167,7 @@ def errcheck_wkb(result, func, argtuple):
     if not result:
         return None
     size_ref = argtuple[-1]
-    size = size_ref._obj
+    size = size_ref.contents
     retval = ctypes.string_at(result, size.value)[:]
     lgeos.GEOSFree(result)
     return retval
diff --git a/shapely/predicates.py b/shapely/predicates.py
index 73c5b8b..25a4711 100644
--- a/shapely/predicates.py
+++ b/shapely/predicates.py
@@ -7,13 +7,13 @@ from shapely.topology import Delegating
 class BinaryPredicate(Delegating):
     def __call__(self, this, other, *args):
         self._validate(this)
-        self._validate(other)
+        self._validate(other, stop_prepared=True)
         return self.fn(this._geom, other._geom, *args)
 
 class RelateOp(Delegating):
     def __call__(self, this, other):
         self._validate(this)
-        self._validate(other)
+        self._validate(other, stop_prepared=True)
         return self.fn(this._geom, other._geom)
 
 class UnaryPredicate(Delegating):
diff --git a/shapely/prepared.py b/shapely/prepared.py
index c2dc3c7..5a3bf22 100644
--- a/shapely/prepared.py
+++ b/shapely/prepared.py
@@ -27,7 +27,10 @@ class PreparedGeometry(object):
     
     def __del__(self):
         if self.__geom__ is not None:
-            lgeos.GEOSPreparedGeom_destroy(self.__geom__)
+            try:
+                lgeos.GEOSPreparedGeom_destroy(self.__geom__)
+            except AttributeError:
+                pass # lgeos might be empty on shutdown
         self.__geom__ = None
         self.context = None
     
diff --git a/shapely/speedups/__init__.py b/shapely/speedups/__init__.py
index eec8e46..c3f932a 100644
--- a/shapely/speedups/__init__.py
+++ b/shapely/speedups/__init__.py
@@ -6,8 +6,11 @@ from shapely import coords
 try:
     from shapely.speedups import _speedups
     available = True
+    import_error_msg = None
 except ImportError:
+    import sys
     available = False
+    import_error_msg = tuple(sys.exc_info()[1])
 
 __all__ = ['available', 'enable', 'disable']
 _orig = {}
diff --git a/shapely/speedups/_speedups.c b/shapely/speedups/_speedups.c
index 94cb1f3..d3e27bc 100644
--- a/shapely/speedups/_speedups.c
+++ b/shapely/speedups/_speedups.c
@@ -1,4 +1,4 @@
-/* Generated by Cython 0.14 on Mon Apr 25 17:07:41 2011 */
+/* Generated by Cython 0.14 on Wed Sep  7 22:30:12 2011 */
 
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"
@@ -479,9 +479,9 @@ static void __Pyx_AddTraceback(const char *funcname); /*proto*/
 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
 /* Module declarations from shapely.speedups._speedups */
 
-static CYTHON_INLINE GEOSGeometry *__pyx_f_7shapely_8speedups_9_speedups_cast_geom(long); /*proto*/
-static CYTHON_INLINE struct GEOSContextHandle_HS *__pyx_f_7shapely_8speedups_9_speedups_cast_handle(long); /*proto*/
-static CYTHON_INLINE GEOSCoordSequence *__pyx_f_7shapely_8speedups_9_speedups_cast_seq(long); /*proto*/
+static CYTHON_INLINE GEOSGeometry *__pyx_f_7shapely_8speedups_9_speedups_cast_geom(unsigned long); /*proto*/
+static CYTHON_INLINE struct GEOSContextHandle_HS *__pyx_f_7shapely_8speedups_9_speedups_cast_handle(unsigned long); /*proto*/
+static CYTHON_INLINE GEOSCoordSequence *__pyx_f_7shapely_8speedups_9_speedups_cast_seq(unsigned long); /*proto*/
 #define __Pyx_MODULE_NAME "shapely.speedups._speedups"
 int __pyx_module_is_main_shapely__speedups___speedups = 0;
 
@@ -571,21 +571,21 @@ static PyObject *__pyx_k_tuple_10;
 /* "/Users/olt/dev/shapely.git/shapely/speedups/_speedups.pyx":28
  *     void GEOSGeom_destroy_r(GEOSContextHandle_HS *, GEOSGeometry *)
  * 
- * cdef inline GEOSGeometry *cast_geom(long geom_addr):             # <<<<<<<<<<<<<<
+ * cdef inline GEOSGeometry *cast_geom(unsigned long geom_addr):             # <<<<<<<<<<<<<<
  *     return <GEOSGeometry *>geom_addr
  * 
  */
 
-static CYTHON_INLINE GEOSGeometry *__pyx_f_7shapely_8speedups_9_speedups_cast_geom(long __pyx_v_geom_addr) {
+static CYTHON_INLINE GEOSGeometry *__pyx_f_7shapely_8speedups_9_speedups_cast_geom(unsigned long __pyx_v_geom_addr) {
   GEOSGeometry *__pyx_r;
   __Pyx_RefNannySetupContext("cast_geom");
 
   /* "/Users/olt/dev/shapely.git/shapely/speedups/_speedups.pyx":29
  * 
- * cdef inline GEOSGeometry *cast_geom(long geom_addr):
+ * cdef inline GEOSGeometry *cast_geom(unsigned long geom_addr):
  *     return <GEOSGeometry *>geom_addr             # <<<<<<<<<<<<<<
  * 
- * cdef inline GEOSContextHandle_HS *cast_handle(long handle_addr):
+ * cdef inline GEOSContextHandle_HS *cast_handle(unsigned long handle_addr):
  */
   __pyx_r = ((GEOSGeometry *)__pyx_v_geom_addr);
   goto __pyx_L0;
@@ -599,21 +599,21 @@ static CYTHON_INLINE GEOSGeometry *__pyx_f_7shapely_8speedups_9_speedups_cast_ge
 /* "/Users/olt/dev/shapely.git/shapely/speedups/_speedups.pyx":31
  *     return <GEOSGeometry *>geom_addr
  * 
- * cdef inline GEOSContextHandle_HS *cast_handle(long handle_addr):             # <<<<<<<<<<<<<<
+ * cdef inline GEOSContextHandle_HS *cast_handle(unsigned long handle_addr):             # <<<<<<<<<<<<<<
  *     return <GEOSContextHandle_HS *>handle_addr
  * 
  */
 
-static CYTHON_INLINE struct GEOSContextHandle_HS *__pyx_f_7shapely_8speedups_9_speedups_cast_handle(long __pyx_v_handle_addr) {
+static CYTHON_INLINE struct GEOSContextHandle_HS *__pyx_f_7shapely_8speedups_9_speedups_cast_handle(unsigned long __pyx_v_handle_addr) {
   struct GEOSContextHandle_HS *__pyx_r;
   __Pyx_RefNannySetupContext("cast_handle");
 
   /* "/Users/olt/dev/shapely.git/shapely/speedups/_speedups.pyx":32
  * 
- * cdef inline GEOSContextHandle_HS *cast_handle(long handle_addr):
+ * cdef inline GEOSContextHandle_HS *cast_handle(unsigned long handle_addr):
  *     return <GEOSContextHandle_HS *>handle_addr             # <<<<<<<<<<<<<<
  * 
- * cdef inline GEOSCoordSequence *cast_seq(long handle_addr):
+ * cdef inline GEOSCoordSequence *cast_seq(unsigned long handle_addr):
  */
   __pyx_r = ((struct GEOSContextHandle_HS *)__pyx_v_handle_addr);
   goto __pyx_L0;
@@ -627,18 +627,18 @@ static CYTHON_INLINE struct GEOSContextHandle_HS *__pyx_f_7shapely_8speedups_9_s
 /* "/Users/olt/dev/shapely.git/shapely/speedups/_speedups.pyx":34
  *     return <GEOSContextHandle_HS *>handle_addr
  * 
- * cdef inline GEOSCoordSequence *cast_seq(long handle_addr):             # <<<<<<<<<<<<<<
+ * cdef inline GEOSCoordSequence *cast_seq(unsigned long handle_addr):             # <<<<<<<<<<<<<<
  *     return <GEOSCoordSequence *>handle_addr
  * 
  */
 
-static CYTHON_INLINE GEOSCoordSequence *__pyx_f_7shapely_8speedups_9_speedups_cast_seq(long __pyx_v_handle_addr) {
+static CYTHON_INLINE GEOSCoordSequence *__pyx_f_7shapely_8speedups_9_speedups_cast_seq(unsigned long __pyx_v_handle_addr) {
   GEOSCoordSequence *__pyx_r;
   __Pyx_RefNannySetupContext("cast_seq");
 
   /* "/Users/olt/dev/shapely.git/shapely/speedups/_speedups.pyx":35
  * 
- * cdef inline GEOSCoordSequence *cast_seq(long handle_addr):
+ * cdef inline GEOSCoordSequence *cast_seq(unsigned long handle_addr):
  *     return <GEOSCoordSequence *>handle_addr             # <<<<<<<<<<<<<<
  * 
  * def destroy(geom):
@@ -666,8 +666,8 @@ static PyObject *__pyx_pf_7shapely_8speedups_9_speedups_0destroy(PyObject *__pyx
   PyObject *__pyx_r = NULL;
   PyObject *__pyx_t_1 = NULL;
   PyObject *__pyx_t_2 = NULL;
-  long __pyx_t_3;
-  long __pyx_t_4;
+  unsigned long __pyx_t_3;
+  unsigned long __pyx_t_4;
   __Pyx_RefNannySetupContext("destroy");
   __pyx_self = __pyx_self;
 
@@ -683,9 +683,9 @@ static PyObject *__pyx_pf_7shapely_8speedups_9_speedups_0destroy(PyObject *__pyx
   __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__geos_handle); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_3 = __Pyx_PyInt_AsLong(__pyx_t_2); if (unlikely((__pyx_t_3 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyInt_AsUnsignedLong(__pyx_t_2); if (unlikely((__pyx_t_3 == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_4 = __Pyx_PyInt_AsLong(__pyx_v_geom); if (unlikely((__pyx_t_4 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_PyInt_AsUnsignedLong(__pyx_v_geom); if (unlikely((__pyx_t_4 == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   GEOSGeom_destroy_r(__pyx_f_7shapely_8speedups_9_speedups_cast_handle(__pyx_t_3), __pyx_f_7shapely_8speedups_9_speedups_cast_geom(__pyx_t_4));
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -729,7 +729,7 @@ static PyObject *__pyx_pf_7shapely_8speedups_9_speedups_1geos_linestring_from_py
   PyObject *__pyx_r = NULL;
   PyObject *__pyx_t_1 = NULL;
   PyObject *__pyx_t_2 = NULL;
-  long __pyx_t_3;
+  unsigned long __pyx_t_3;
   Py_ssize_t __pyx_t_4;
   int __pyx_t_5;
   int __pyx_t_6;
@@ -812,7 +812,7 @@ static PyObject *__pyx_pf_7shapely_8speedups_9_speedups_1geos_linestring_from_py
   __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__geos_handle); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_3 = __Pyx_PyInt_AsLong(__pyx_t_2); if (unlikely((__pyx_t_3 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyInt_AsUnsignedLong(__pyx_t_2); if (unlikely((__pyx_t_3 == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_v_handle = __pyx_f_7shapely_8speedups_9_speedups_cast_handle(__pyx_t_3);
 
@@ -1033,7 +1033,7 @@ static PyObject *__pyx_pf_7shapely_8speedups_9_speedups_1geos_linestring_from_py
  * 
  *         # Make pointer to the coordinate array
  *         if isinstance(array['data'], ctypes.Array):             # <<<<<<<<<<<<<<
- *             cp = <double *><long>ctypes.addressof(array['data'])
+ *             cp = <double *><unsigned long>ctypes.addressof(array['data'])
  *         else:
  */
       __pyx_t_7 = PyObject_GetItem(__pyx_v_array, ((PyObject *)__pyx_n_s__data)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
@@ -1051,9 +1051,9 @@ static PyObject *__pyx_pf_7shapely_8speedups_9_speedups_1geos_linestring_from_py
         /* "/Users/olt/dev/shapely.git/shapely/speedups/_speedups.pyx":63
  *         # Make pointer to the coordinate array
  *         if isinstance(array['data'], ctypes.Array):
- *             cp = <double *><long>ctypes.addressof(array['data'])             # <<<<<<<<<<<<<<
+ *             cp = <double *><unsigned long>ctypes.addressof(array['data'])             # <<<<<<<<<<<<<<
  *         else:
- *             cp = <double *><long>array['data'][0]
+ *             cp = <double *><unsigned long>array['data'][0]
  */
         __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__ctypes); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
         __Pyx_GOTREF(__pyx_t_2);
@@ -1071,7 +1071,7 @@ static PyObject *__pyx_pf_7shapely_8speedups_9_speedups_1geos_linestring_from_py
         __Pyx_GOTREF(__pyx_t_2);
         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
         __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-        __pyx_t_3 = __Pyx_PyInt_AsLong(__pyx_t_2); if (unlikely((__pyx_t_3 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
+        __pyx_t_3 = __Pyx_PyInt_AsUnsignedLong(__pyx_t_2); if (unlikely((__pyx_t_3 == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
         __pyx_v_cp = ((double *)__pyx_t_3);
         goto __pyx_L25;
@@ -1079,9 +1079,9 @@ static PyObject *__pyx_pf_7shapely_8speedups_9_speedups_1geos_linestring_from_py
       /*else*/ {
 
         /* "/Users/olt/dev/shapely.git/shapely/speedups/_speedups.pyx":65
- *             cp = <double *><long>ctypes.addressof(array['data'])
+ *             cp = <double *><unsigned long>ctypes.addressof(array['data'])
  *         else:
- *             cp = <double *><long>array['data'][0]             # <<<<<<<<<<<<<<
+ *             cp = <double *><unsigned long>array['data'][0]             # <<<<<<<<<<<<<<
  * 
  *         # Create a coordinate sequence
  */
@@ -1090,7 +1090,7 @@ static PyObject *__pyx_pf_7shapely_8speedups_9_speedups_1geos_linestring_from_py
         __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
         __Pyx_GOTREF(__pyx_t_1);
         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-        __pyx_t_3 = __Pyx_PyInt_AsLong(__pyx_t_1); if (unlikely((__pyx_t_3 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
+        __pyx_t_3 = __Pyx_PyInt_AsUnsignedLong(__pyx_t_1); if (unlikely((__pyx_t_3 == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
         __pyx_v_cp = ((double *)__pyx_t_3);
       }
@@ -1113,7 +1113,7 @@ static PyObject *__pyx_pf_7shapely_8speedups_9_speedups_1geos_linestring_from_py
  *             if n != update_ndim:
  *                 raise ValueError(
  */
-        __pyx_t_3 = __Pyx_PyInt_AsLong(__pyx_v_update_geom); if (unlikely((__pyx_t_3 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
+        __pyx_t_3 = __Pyx_PyInt_AsUnsignedLong(__pyx_v_update_geom); if (unlikely((__pyx_t_3 == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
         __pyx_v_cs = GEOSGeom_getCoordSeq_r(__pyx_v_handle, __pyx_f_7shapely_8speedups_9_speedups_cast_geom(__pyx_t_3));
 
         /* "/Users/olt/dev/shapely.git/shapely/speedups/_speedups.pyx":70
@@ -1472,7 +1472,7 @@ static PyObject *__pyx_pf_7shapely_8speedups_9_speedups_1geos_linestring_from_py
  *             if n != update_ndim:
  *                 raise ValueError(
  */
-        __pyx_t_3 = __Pyx_PyInt_AsLong(__pyx_v_update_geom); if (unlikely((__pyx_t_3 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
+        __pyx_t_3 = __Pyx_PyInt_AsUnsignedLong(__pyx_v_update_geom); if (unlikely((__pyx_t_3 == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
         __pyx_v_cs = GEOSGeom_getCoordSeq_r(__pyx_v_handle, __pyx_f_7shapely_8speedups_9_speedups_cast_geom(__pyx_t_3));
 
         /* "/Users/olt/dev/shapely.git/shapely/speedups/_speedups.pyx":108
@@ -1715,7 +1715,7 @@ static PyObject *__pyx_pf_7shapely_8speedups_9_speedups_1geos_linestring_from_py
  *     if update_geom is not None:
  *         return None             # <<<<<<<<<<<<<<
  *     else:
- *         return <long>GEOSGeom_createLineString_r(handle, cs), n
+ *         return <unsigned long>GEOSGeom_createLineString_r(handle, cs), n
  */
     __Pyx_XDECREF(__pyx_r);
     __Pyx_INCREF(Py_None);
@@ -1728,12 +1728,12 @@ static PyObject *__pyx_pf_7shapely_8speedups_9_speedups_1geos_linestring_from_py
     /* "/Users/olt/dev/shapely.git/shapely/speedups/_speedups.pyx":136
  *         return None
  *     else:
- *         return <long>GEOSGeom_createLineString_r(handle, cs), n             # <<<<<<<<<<<<<<
+ *         return <unsigned long>GEOSGeom_createLineString_r(handle, cs), n             # <<<<<<<<<<<<<<
  * 
  * 
  */
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_7 = PyInt_FromLong(((long)GEOSGeom_createLineString_r(__pyx_v_handle, __pyx_v_cs))); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = PyLong_FromUnsignedLong(((unsigned long)GEOSGeom_createLineString_r(__pyx_v_handle, __pyx_v_cs))); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
     __pyx_t_1 = PyInt_FromLong(__pyx_v_n); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
@@ -1801,7 +1801,7 @@ static PyObject *__pyx_pf_7shapely_8speedups_9_speedups_2geos_linearring_from_py
   PyObject *__pyx_r = NULL;
   PyObject *__pyx_t_1 = NULL;
   PyObject *__pyx_t_2 = NULL;
-  long __pyx_t_3;
+  unsigned long __pyx_t_3;
   Py_ssize_t __pyx_t_4;
   int __pyx_t_5;
   int __pyx_t_6;
@@ -1885,7 +1885,7 @@ static PyObject *__pyx_pf_7shapely_8speedups_9_speedups_2geos_linearring_from_py
   __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__geos_handle); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_3 = __Pyx_PyInt_AsLong(__pyx_t_2); if (unlikely((__pyx_t_3 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyInt_AsUnsignedLong(__pyx_t_2); if (unlikely((__pyx_t_3 == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_v_handle = __pyx_f_7shapely_8speedups_9_speedups_cast_handle(__pyx_t_3);
 
@@ -2020,7 +2020,7 @@ static PyObject *__pyx_pf_7shapely_8speedups_9_speedups_2geos_linearring_from_py
  * 
  *         # Make pointer to the coordinate array
  *         if isinstance(array['data'], ctypes.Array):             # <<<<<<<<<<<<<<
- *             cp = <double *><long>ctypes.addressof(array['data'])
+ *             cp = <double *><unsigned long>ctypes.addressof(array['data'])
  *         else:
  */
       __pyx_t_2 = PyObject_GetItem(__pyx_v_array, ((PyObject *)__pyx_n_s__data)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
@@ -2038,9 +2038,9 @@ static PyObject *__pyx_pf_7shapely_8speedups_9_speedups_2geos_linearring_from_py
         /* "/Users/olt/dev/shapely.git/shapely/speedups/_speedups.pyx":158
  *         # Make pointer to the coordinate array
  *         if isinstance(array['data'], ctypes.Array):
- *             cp = <double *><long>ctypes.addressof(array['data'])             # <<<<<<<<<<<<<<
+ *             cp = <double *><unsigned long>ctypes.addressof(array['data'])             # <<<<<<<<<<<<<<
  *         else:
- *             cp = <double *><long>array['data'][0]
+ *             cp = <double *><unsigned long>array['data'][0]
  */
         __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__ctypes); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
         __Pyx_GOTREF(__pyx_t_7);
@@ -2058,7 +2058,7 @@ static PyObject *__pyx_pf_7shapely_8speedups_9_speedups_2geos_linearring_from_py
         __Pyx_GOTREF(__pyx_t_7);
         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
         __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-        __pyx_t_3 = __Pyx_PyInt_AsLong(__pyx_t_7); if (unlikely((__pyx_t_3 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
+        __pyx_t_3 = __Pyx_PyInt_AsUnsignedLong(__pyx_t_7); if (unlikely((__pyx_t_3 == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
         __pyx_v_cp = ((double *)__pyx_t_3);
         goto __pyx_L15;
@@ -2066,9 +2066,9 @@ static PyObject *__pyx_pf_7shapely_8speedups_9_speedups_2geos_linearring_from_py
       /*else*/ {
 
         /* "/Users/olt/dev/shapely.git/shapely/speedups/_speedups.pyx":160
- *             cp = <double *><long>ctypes.addressof(array['data'])
+ *             cp = <double *><unsigned long>ctypes.addressof(array['data'])
  *         else:
- *             cp = <double *><long>array['data'][0]             # <<<<<<<<<<<<<<
+ *             cp = <double *><unsigned long>array['data'][0]             # <<<<<<<<<<<<<<
  * 
  *         # Add closing coordinates to sequence?
  */
@@ -2077,7 +2077,7 @@ static PyObject *__pyx_pf_7shapely_8speedups_9_speedups_2geos_linearring_from_py
         __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_7, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
         __Pyx_GOTREF(__pyx_t_1);
         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-        __pyx_t_3 = __Pyx_PyInt_AsLong(__pyx_t_1); if (unlikely((__pyx_t_3 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
+        __pyx_t_3 = __Pyx_PyInt_AsUnsignedLong(__pyx_t_1); if (unlikely((__pyx_t_3 == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
         __pyx_v_cp = ((double *)__pyx_t_3);
       }
@@ -2139,7 +2139,7 @@ static PyObject *__pyx_pf_7shapely_8speedups_9_speedups_2geos_linearring_from_py
  *             if n != update_ndim:
  *                 raise ValueError(
  */
-        __pyx_t_3 = __Pyx_PyInt_AsLong(__pyx_v_update_geom); if (unlikely((__pyx_t_3 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
+        __pyx_t_3 = __Pyx_PyInt_AsUnsignedLong(__pyx_v_update_geom); if (unlikely((__pyx_t_3 == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
         __pyx_v_cs = GEOSGeom_getCoordSeq_r(__pyx_v_handle, __pyx_f_7shapely_8speedups_9_speedups_cast_geom(__pyx_t_3));
 
         /* "/Users/olt/dev/shapely.git/shapely/speedups/_speedups.pyx":171
@@ -2587,7 +2587,7 @@ static PyObject *__pyx_pf_7shapely_8speedups_9_speedups_2geos_linearring_from_py
  *             if n != update_ndim:
  *                 raise ValueError(
  */
-        __pyx_t_3 = __Pyx_PyInt_AsLong(__pyx_v_update_geom); if (unlikely((__pyx_t_3 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
+        __pyx_t_3 = __Pyx_PyInt_AsUnsignedLong(__pyx_v_update_geom); if (unlikely((__pyx_t_3 == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
         __pyx_v_cs = GEOSGeom_getCoordSeq_r(__pyx_v_handle, __pyx_f_7shapely_8speedups_9_speedups_cast_geom(__pyx_t_3));
 
         /* "/Users/olt/dev/shapely.git/shapely/speedups/_speedups.pyx":226
@@ -2930,7 +2930,7 @@ static PyObject *__pyx_pf_7shapely_8speedups_9_speedups_2geos_linearring_from_py
  *     if update_geom is not None:
  *         return None             # <<<<<<<<<<<<<<
  *     else:
- *         return <long>GEOSGeom_createLinearRing_r(handle, cs), n
+ *         return <unsigned long>GEOSGeom_createLinearRing_r(handle, cs), n
  */
     __Pyx_XDECREF(__pyx_r);
     __Pyx_INCREF(Py_None);
@@ -2943,12 +2943,12 @@ static PyObject *__pyx_pf_7shapely_8speedups_9_speedups_2geos_linearring_from_py
     /* "/Users/olt/dev/shapely.git/shapely/speedups/_speedups.pyx":268
  *         return None
  *     else:
- *         return <long>GEOSGeom_createLinearRing_r(handle, cs), n             # <<<<<<<<<<<<<<
+ *         return <unsigned long>GEOSGeom_createLinearRing_r(handle, cs), n             # <<<<<<<<<<<<<<
  * 
  * 
  */
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_2 = PyInt_FromLong(((long)GEOSGeom_createLinearRing_r(__pyx_v_handle, __pyx_v_cs))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyLong_FromUnsignedLong(((unsigned long)GEOSGeom_createLinearRing_r(__pyx_v_handle, __pyx_v_cs))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __pyx_t_1 = PyInt_FromLong(__pyx_v_n); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
@@ -2990,7 +2990,7 @@ static PyObject *__pyx_pf_7shapely_8speedups_9_speedups_2geos_linearring_from_py
  * 
  * def coordseq_ctypes(self):             # <<<<<<<<<<<<<<
  *     cdef int i, n, m
- *     cdef double temp
+ *     cdef double temp = 0
  */
 
 static PyObject *__pyx_pf_7shapely_8speedups_9_speedups_3coordseq_ctypes(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
@@ -3008,7 +3008,7 @@ static PyObject *__pyx_pf_7shapely_8speedups_9_speedups_3coordseq_ctypes(PyObjec
   PyObject *__pyx_r = NULL;
   PyObject *__pyx_t_1 = NULL;
   PyObject *__pyx_t_2 = NULL;
-  long __pyx_t_3;
+  unsigned long __pyx_t_3;
   int __pyx_t_4;
   PyObject *__pyx_t_5 = NULL;
   int __pyx_t_6;
@@ -3018,9 +3018,18 @@ static PyObject *__pyx_pf_7shapely_8speedups_9_speedups_3coordseq_ctypes(PyObjec
   __pyx_v_array_type = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_data = Py_None; __Pyx_INCREF(Py_None);
 
+  /* "/Users/olt/dev/shapely.git/shapely/speedups/_speedups.pyx":273
+ * def coordseq_ctypes(self):
+ *     cdef int i, n, m
+ *     cdef double temp = 0             # <<<<<<<<<<<<<<
+ *     cdef GEOSContextHandle_HS *handle = cast_handle(lgeos.geos_handle)
+ *     cdef GEOSCoordSequence *cs
+ */
+  __pyx_v_temp = 0.0;
+
   /* "/Users/olt/dev/shapely.git/shapely/speedups/_speedups.pyx":274
  *     cdef int i, n, m
- *     cdef double temp
+ *     cdef double temp = 0
  *     cdef GEOSContextHandle_HS *handle = cast_handle(lgeos.geos_handle)             # <<<<<<<<<<<<<<
  *     cdef GEOSCoordSequence *cs
  *     cdef double *data_p
@@ -3030,7 +3039,7 @@ static PyObject *__pyx_pf_7shapely_8speedups_9_speedups_3coordseq_ctypes(PyObjec
   __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__geos_handle); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_3 = __Pyx_PyInt_AsLong(__pyx_t_2); if (unlikely((__pyx_t_3 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyInt_AsUnsignedLong(__pyx_t_2); if (unlikely((__pyx_t_3 == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_v_handle = __pyx_f_7shapely_8speedups_9_speedups_cast_handle(__pyx_t_3);
 
@@ -3116,19 +3125,19 @@ static PyObject *__pyx_pf_7shapely_8speedups_9_speedups_3coordseq_ctypes(PyObjec
  *     data = array_type()
  * 
  *     cs = cast_seq(self._cseq)             # <<<<<<<<<<<<<<
- *     data_p = <double *><long>ctypes.addressof(data)
+ *     data_p = <double *><unsigned long>ctypes.addressof(data)
  * 
  */
   __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___cseq); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
-  __pyx_t_3 = __Pyx_PyInt_AsLong(__pyx_t_5); if (unlikely((__pyx_t_3 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyInt_AsUnsignedLong(__pyx_t_5); if (unlikely((__pyx_t_3 == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
   __pyx_v_cs = __pyx_f_7shapely_8speedups_9_speedups_cast_seq(__pyx_t_3);
 
   /* "/Users/olt/dev/shapely.git/shapely/speedups/_speedups.pyx":284
  * 
  *     cs = cast_seq(self._cseq)
- *     data_p = <double *><long>ctypes.addressof(data)             # <<<<<<<<<<<<<<
+ *     data_p = <double *><unsigned long>ctypes.addressof(data)             # <<<<<<<<<<<<<<
  * 
  *     for i in xrange(m):
  */
@@ -3146,12 +3155,12 @@ static PyObject *__pyx_pf_7shapely_8speedups_9_speedups_3coordseq_ctypes(PyObjec
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
-  __pyx_t_3 = __Pyx_PyInt_AsLong(__pyx_t_1); if (unlikely((__pyx_t_3 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyInt_AsUnsignedLong(__pyx_t_1); if (unlikely((__pyx_t_3 == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __pyx_v_data_p = ((double *)__pyx_t_3);
 
   /* "/Users/olt/dev/shapely.git/shapely/speedups/_speedups.pyx":286
- *     data_p = <double *><long>ctypes.addressof(data)
+ *     data_p = <double *><unsigned long>ctypes.addressof(data)
  * 
  *     for i in xrange(m):             # <<<<<<<<<<<<<<
  *         GEOSCoordSeq_getX_r(handle, cs, i, &temp)
@@ -3550,7 +3559,7 @@ PyMODINIT_FUNC PyInit__speedups(void)
  * 
  * def coordseq_ctypes(self):             # <<<<<<<<<<<<<<
  *     cdef int i, n, m
- *     cdef double temp
+ *     cdef double temp = 0
  */
   __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7shapely_8speedups_9_speedups_3coordseq_ctypes, NULL, __pyx_n_s_12); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
diff --git a/shapely/speedups/_speedups.pyx b/shapely/speedups/_speedups.pyx
index 49c9804..6ba3623 100644
--- a/shapely/speedups/_speedups.pyx
+++ b/shapely/speedups/_speedups.pyx
@@ -25,13 +25,13 @@ cdef extern from "geos_c.h":
     GEOSGeometry *GEOSGeom_createLinearRing_r(GEOSContextHandle_HS *, GEOSCoordSequence *)
     void GEOSGeom_destroy_r(GEOSContextHandle_HS *, GEOSGeometry *)
 
-cdef inline GEOSGeometry *cast_geom(long geom_addr):
+cdef inline GEOSGeometry *cast_geom(unsigned long geom_addr):
     return <GEOSGeometry *>geom_addr
 
-cdef inline GEOSContextHandle_HS *cast_handle(long handle_addr):
+cdef inline GEOSContextHandle_HS *cast_handle(unsigned long handle_addr):
     return <GEOSContextHandle_HS *>handle_addr
 
-cdef inline GEOSCoordSequence *cast_seq(long handle_addr):
+cdef inline GEOSCoordSequence *cast_seq(unsigned long handle_addr):
     return <GEOSCoordSequence *>handle_addr
 
 def destroy(geom):
@@ -60,9 +60,9 @@ def geos_linestring_from_py(ob, update_geom=None, update_ndim=0):
 
         # Make pointer to the coordinate array
         if isinstance(array['data'], ctypes.Array):
-            cp = <double *><long>ctypes.addressof(array['data'])
+            cp = <double *><unsigned long>ctypes.addressof(array['data'])
         else:
-            cp = <double *><long>array['data'][0]
+            cp = <double *><unsigned long>array['data'][0]
 
         # Create a coordinate sequence
         if update_geom is not None:
@@ -133,7 +133,7 @@ def geos_linestring_from_py(ob, update_geom=None, update_ndim=0):
     if update_geom is not None:
         return None
     else:
-        return <long>GEOSGeom_createLineString_r(handle, cs), n
+        return <unsigned long>GEOSGeom_createLineString_r(handle, cs), n
 
 
 def geos_linearring_from_py(ob, update_geom=None, update_ndim=0):
@@ -155,9 +155,9 @@ def geos_linearring_from_py(ob, update_geom=None, update_ndim=0):
 
         # Make pointer to the coordinate array
         if isinstance(array['data'], ctypes.Array):
-            cp = <double *><long>ctypes.addressof(array['data'])
+            cp = <double *><unsigned long>ctypes.addressof(array['data'])
         else:
-            cp = <double *><long>array['data'][0]
+            cp = <double *><unsigned long>array['data'][0]
 
         # Add closing coordinates to sequence?
         if cp[0] != cp[m*n-n] or cp[1] != cp[m*n-n+1]:
@@ -265,12 +265,12 @@ def geos_linearring_from_py(ob, update_geom=None, update_ndim=0):
     if update_geom is not None:
         return None
     else:
-        return <long>GEOSGeom_createLinearRing_r(handle, cs), n
+        return <unsigned long>GEOSGeom_createLinearRing_r(handle, cs), n
 
 
 def coordseq_ctypes(self):
     cdef int i, n, m
-    cdef double temp
+    cdef double temp = 0
     cdef GEOSContextHandle_HS *handle = cast_handle(lgeos.geos_handle)
     cdef GEOSCoordSequence *cs
     cdef double *data_p
@@ -281,7 +281,7 @@ def coordseq_ctypes(self):
     data = array_type()
     
     cs = cast_seq(self._cseq)
-    data_p = <double *><long>ctypes.addressof(data)
+    data_p = <double *><unsigned long>ctypes.addressof(data)
     
     for i in xrange(m):
         GEOSCoordSeq_getX_r(handle, cs, i, &temp)
diff --git a/shapely/tests/test_prepared.py b/shapely/tests/test_prepared.py
index d8bbca4..0ec947d 100644
--- a/shapely/tests/test_prepared.py
+++ b/shapely/tests/test_prepared.py
@@ -6,7 +6,20 @@ from shapely import geometry
 class PreparedGeometryTestCase(unittest.TestCase):
     
     def test_prepared(self):
-        p = prepared.PreparedGeometry(geometry.Point(0.0, 0.0))
+        polygon = geometry.Polygon([
+            (0, 0), (1, 0), (1, 1), (0, 1)
+        ])
+        p = prepared.PreparedGeometry(polygon)
+        self.assertTrue(p.contains(geometry.Point(0.5, 0.5)))
+        self.assertFalse(p.contains(geometry.Point(0.5, 1.5)))
+
+    def test_op_not_allowed(self):
+        p = prepared.PreparedGeometry(geometry.Point(0.0, 0.0).buffer(1.0))
+        self.assertRaises(ValueError, geometry.Point(0.0, 0.0).union, p)
+
+    def test_predicate_not_allowed(self):
+        p = prepared.PreparedGeometry(geometry.Point(0.0, 0.0).buffer(1.0))
+        self.assertRaises(ValueError, geometry.Point(0.0, 0.0).contains, p)
 
 
 def test_suite():
diff --git a/shapely/topology.py b/shapely/topology.py
index 5def1fa..04fc412 100644
--- a/shapely/topology.py
+++ b/shapely/topology.py
@@ -10,14 +10,12 @@ These methods return ctypes objects that should be recast by the caller.
 from ctypes import byref, c_double
 from shapely.geos import TopologicalError, lgeos
 
-
 class Validating(object):
-    def _validate(self, ob):
-        try:
-            assert ob is not None
-            assert ob._geom is not None
-        except AssertionError:
+    def _validate(self, ob, stop_prepared=False):
+        if ob is None or ob._geom is None:
             raise ValueError("Null geometry supports no operations")
+        if stop_prepared and not hasattr(ob, 'type'):
+            raise ValueError("Prepared geometries cannot be operated on")
 
 class Delegating(Validating):
     def __init__(self, name):
@@ -26,7 +24,7 @@ class Delegating(Validating):
 class BinaryRealProperty(Delegating):
     def __call__(self, this, other):
         self._validate(this)
-        self._validate(other)
+        self._validate(other, stop_prepared=True)
         d = c_double()
         retval = self.fn(this._geom, other._geom, byref(d))
         return d.value
@@ -41,7 +39,7 @@ class UnaryRealProperty(Delegating):
 class BinaryTopologicalOp(Delegating):
     def __call__(self, this, other, *args):
         self._validate(this)
-        self._validate(other)
+        self._validate(other, stop_prepared=True)
         product = self.fn(this._geom, other._geom, *args)
         if product is None:
             if not this.is_valid:
diff --git a/shapely/wkb.py b/shapely/wkb.py
index 5c882ab..fbb675e 100644
--- a/shapely/wkb.py
+++ b/shapely/wkb.py
@@ -1,7 +1,7 @@
 """Load/dump geometries using the well-known binary (WKB) format
 """
 
-from ctypes import byref, c_size_t, c_char_p, c_void_p
+from ctypes import pointer, c_size_t, c_char_p, c_void_p
 
 from shapely.geos import lgeos, ReadingError
 
@@ -30,7 +30,7 @@ def dumps(ob):
     if ob is None or ob._geom is None:
         raise ValueError("Null geometry supports no operations")
     size = c_size_t()
-    return lgeos.GEOSGeomToWKB_buf(c_void_p(ob._geom), byref(size))
+    return lgeos.GEOSGeomToWKB_buf(c_void_p(ob._geom), pointer(size))
 
 def dump(ob, fp):
     """Dump a geometry to an open file."""

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/python-shapely.git



More information about the Pkg-grass-devel mailing list