diff -Nru basemap-1.1.0+dfsg/Changelog basemap-1.2.0+dfsg/Changelog --- basemap-1.1.0+dfsg/Changelog 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/Changelog 2018-09-26 01:25:23.000000000 +0000 @@ -1,3 +1,7 @@ +version 1.2.0 +------------- +* Mostly compatibility bugfixes + version 1.1.0 (git tag v1.1.0rel) -------------------------------- * Updated packaged data to use GSHHG v2.3.6 (PR #311 & #320) diff -Nru basemap-1.1.0+dfsg/debian/changelog basemap-1.2.0+dfsg/debian/changelog --- basemap-1.1.0+dfsg/debian/changelog 2018-11-29 23:45:55.000000000 +0000 +++ basemap-1.2.0+dfsg/debian/changelog 2019-01-10 22:53:21.000000000 +0000 @@ -1,3 +1,20 @@ +basemap (1.2.0+dfsg-1) unstable; urgency=medium + + * New upstream release; Closes: #918643 + * debian/watch + - match tags with `rel` suffix + * debian/copyright + - extend packaging copyright years + * debian/patches/* + - refresh patches + * debian/control + - add setuptool, six, pyshp, pyproj, matplotlib, netcdf4 to b-d + - bump Standards-Version to 4.3.0 (no changes needed) + * debian/control + - rework for new upstream setup.py + + -- Sandro Tosi Thu, 10 Jan 2019 17:53:21 -0500 + basemap (1.1.0+dfsg-3) unstable; urgency=medium [ Ondřej Nový ] diff -Nru basemap-1.1.0+dfsg/debian/control basemap-1.2.0+dfsg/debian/control --- basemap-1.1.0+dfsg/debian/control 2018-11-29 23:45:55.000000000 +0000 +++ basemap-1.2.0+dfsg/debian/control 2019-01-10 22:53:21.000000000 +0000 @@ -15,11 +15,15 @@ python-dap, python-httplib2, python-matplotlib, + python3-matplotlib, python-netcdf4, + python3-netcdf4, python-numpy (>= 1:1.5.1-4), python-numpy-dbg, python-pyproj, + python3-pyproj, python-pyshp, + python3-pyshp, python-sphinx (>= 1.0.7+dfsg), python-tk, python3-all, @@ -27,7 +31,11 @@ python3-all-dev, python3-numpy, python3-numpy-dbg, -Standards-Version: 4.2.1 + python-setuptools, + python3-setuptools, + python-six, + python3-six, +Standards-Version: 4.3.0 Homepage: http://matplotlib.org/basemap/ Vcs-Git: https://salsa.debian.org/python-team/modules/basemap.git Vcs-Browser: https://salsa.debian.org/python-team/modules/basemap diff -Nru basemap-1.1.0+dfsg/debian/copyright basemap-1.2.0+dfsg/debian/copyright --- basemap-1.1.0+dfsg/debian/copyright 2018-11-29 23:45:55.000000000 +0000 +++ basemap-1.2.0+dfsg/debian/copyright 2019-01-10 22:53:21.000000000 +0000 @@ -20,7 +20,7 @@ PERFORMANCE OF THIS SOFTWARE. Files: debian/* -Copyright: 2011-2018 Sandro Tosi +Copyright: 2011-2019 Sandro Tosi License: same as upstream Files: doc/* diff -Nru basemap-1.1.0+dfsg/debian/patches/dont_install_data_files basemap-1.2.0+dfsg/debian/patches/dont_install_data_files --- basemap-1.1.0+dfsg/debian/patches/dont_install_data_files 2018-11-29 23:45:55.000000000 +0000 +++ basemap-1.2.0+dfsg/debian/patches/dont_install_data_files 2019-01-10 22:53:21.000000000 +0000 @@ -10,13 +10,11 @@ setup.py | 1 - 1 file changed, 1 deletion(-) -diff --git a/setup.py b/setup.py -index 3b23b58..6b2012b 100644 --- a/setup.py +++ b/setup.py @@ -148,5 +148,4 @@ setup( + namespace_packages = namespace_packages, package_dir = package_dirs, - ext_modules = extensions, - cmdclass = {'build_py': build_py}, + ext_modules = extensions, - package_data = package_data ) diff -Nru basemap-1.1.0+dfsg/debian/patches/use_share_datafiles basemap-1.2.0+dfsg/debian/patches/use_share_datafiles --- basemap-1.1.0+dfsg/debian/patches/use_share_datafiles 2018-11-29 23:45:55.000000000 +0000 +++ basemap-1.2.0+dfsg/debian/patches/use_share_datafiles 2019-01-10 22:53:21.000000000 +0000 @@ -9,11 +9,9 @@ lib/mpl_toolkits/basemap/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -diff --git a/lib/mpl_toolkits/basemap/__init__.py b/lib/mpl_toolkits/basemap/__init__.py -index 10fb6d0..535022b 100644 --- a/lib/mpl_toolkits/basemap/__init__.py +++ b/lib/mpl_toolkits/basemap/__init__.py -@@ -47,7 +47,7 @@ if 'BASEMAPDATA' in os.environ: +@@ -56,7 +56,7 @@ if 'BASEMAPDATA' in os.environ: if not os.path.isdir(basemap_datadir): raise RuntimeError('Path in environment BASEMAPDATA not a directory') else: diff -Nru basemap-1.1.0+dfsg/debian/rules basemap-1.2.0+dfsg/debian/rules --- basemap-1.1.0+dfsg/debian/rules 2018-11-29 23:45:55.000000000 +0000 +++ basemap-1.2.0+dfsg/debian/rules 2019-01-10 22:53:21.000000000 +0000 @@ -11,28 +11,17 @@ set -e ; \ cython3 -2 src/*pyx; \ for python in $(PY2VERS); do \ - $$python setup.py install --prefix $(CURDIR)/debian/python-mpltoolkits.basemap/usr --install-layout=deb; \ - $$python-dbg setup.py install --prefix $(CURDIR)/debian/python-mpltoolkits.basemap-dbg/usr --install-layout=deb; \ + $$python setup.py install --root $(CURDIR)/debian/python-mpltoolkits.basemap/ --install-layout=deb; \ + $$python-dbg setup.py install --root $(CURDIR)/debian/python-mpltoolkits.basemap-dbg/ --install-layout=deb; \ done set -e ; \ cython3 -3 src/*pyx; \ for python in $(PY3VERS); do \ - $$python setup.py install --prefix $(CURDIR)/debian/python3-mpltoolkits.basemap/usr --install-layout=deb; \ - $$python-dbg setup.py install --prefix $(CURDIR)/debian/python3-mpltoolkits.basemap-dbg/usr --install-layout=deb; \ + $$python setup.py install --root $(CURDIR)/debian/python3-mpltoolkits.basemap/ --install-layout=deb; \ + $$python-dbg setup.py install --root $(CURDIR)/debian/python3-mpltoolkits.basemap-dbg/ --install-layout=deb; \ done dh_numpy -override_dh_python2: - dh_python2 - # remove namespace file, already shipped with python-matplotlib - rm $(CURDIR)/debian/python-mpltoolkits.basemap/usr/lib/python2*/dist-packages/mpl_toolkits/__init__.py - - -override_dh_python3: - dh_python3 - # remove namespace file, already shipped with python3-matplotlib - rm $(CURDIR)/debian/python3-mpltoolkits.basemap/usr/lib/python3*/dist-packages/mpl_toolkits/__init__.py - build: build-arch build-indep ; build-arch: diff -Nru basemap-1.1.0+dfsg/debian/watch basemap-1.2.0+dfsg/debian/watch --- basemap-1.1.0+dfsg/debian/watch 2018-11-29 23:45:55.000000000 +0000 +++ basemap-1.2.0+dfsg/debian/watch 2019-01-10 22:53:21.000000000 +0000 @@ -1,3 +1,3 @@ version=4 - opts="dversionmangle=s/\+dfsg//,filenamemangle=s%(?:.*?)?v?(\d[\d.]*)\.tar\.gz%basemap-$1.tar.gz%,repacksuffix=+dfsg" \ - https://github.com/matplotlib/basemap/tags (?:.*?/)?v?(\d[\d.]*)\.tar\.gz + opts="dversionmangle=s/\+dfsg//,filenamemangle=s%(?:.*?)?v?(\d[\d.]*)(?:rel)?\.tar\.gz%basemap-$1.tar.gz%,repacksuffix=+dfsg" \ + https://github.com/matplotlib/basemap/tags (?:.*?/)?v?(\d[\d.]*)(?:rel)?\.tar\.gz diff -Nru basemap-1.1.0+dfsg/doc/users/figures/spstere.py basemap-1.2.0+dfsg/doc/users/figures/spstere.py --- basemap-1.1.0+dfsg/doc/users/figures/spstere.py 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/doc/users/figures/spstere.py 2018-09-26 01:25:23.000000000 +0000 @@ -1,7 +1,7 @@ from mpl_toolkits.basemap import Basemap import numpy as np import matplotlib.pyplot as plt -# setup north polar stereographic basemap. +# setup south polar stereographic basemap. # The longitude lon_0 is at 6-o'clock, and the # latitude circle boundinglat is tangent to the edge # of the map at lon_0. Default value of lat_ts diff -Nru basemap-1.1.0+dfsg/doc/users/installing.rst basemap-1.2.0+dfsg/doc/users/installing.rst --- basemap-1.1.0+dfsg/doc/users/installing.rst 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/doc/users/installing.rst 2018-09-26 01:25:23.000000000 +0000 @@ -10,23 +10,24 @@ **Requirements** These are external packages which you will need to install before -installing basemap. +installing Basemap. -matplotlib 1.0.0 (or later, `download `__) +Matplotlib 1.0.0 (or later, `download `__) -Python 2.4 (or later, including Python 3) - matplotlib requires python 2.4 or later (`download `__) +Python 2.6 (or later, including Python 3) (`download `__) + Matplotlib 2.2 LTS requires Python 2.7 or later + Matplotlib 3.0 requires Python 3.5 or later -numpy 1.2.1 (or later) - array support for python (`download `__) +NumPy 1.2.1 (or later) + Array support for Python (`download `__) `PROJ4 `__ Cartographic Projections Library. -**Required library that ships with basemap** +**Required library that ships with Basemap** `GEOS `__ (Geometry Engine - Open Source) library 3.1.1 or later. - Source code is included in the geos-3.3.3 directory. + Source code is included in the geos-3.3.3 directory. When building from source, must be built and installed separately from basemap (see build instructions below). Included in Windows binary installers. @@ -40,8 +41,8 @@ Installation ============ -Download either Windows binary installers or source tarballs -`here `__. +Download either Windows binary installers or source tarballs +`here `__. To install from the source, follow these steps: @@ -52,7 +53,7 @@ and cd to the basemap-X.Y.Z directory. * Install the GEOS library. If you already have it on your - system, just set the environment variable GEOS_DIR to point to the location + system, just set the environment variable GEOS_DIR to point to the location of libgeos_c and geos_c.h (if libgeos_c is in /usr/local/lib and geos_c.h is in /usr/local/include, set GEOS_DIR to /usr/local). Then go to next step. If you don't have it, you can build it from @@ -62,12 +63,12 @@ export GEOS_DIR= # A reasonable choice on a Unix-like system is /usr/local, or # if you don't have permission to write there, your home directory. - ./configure --prefix=$GEOS_DIR + ./configure --prefix=$GEOS_DIR make; make install * cd back to the top level basemap directory (basemap-X.Y.Z) and run the usual ``python setup.py install``. Check your installation - by running ``from mpl_toolkits.basemap import Basemap`` at the python + by running ``from mpl_toolkits.basemap import Basemap`` at the Python prompt. * To test, cd to the examples directory and run ``python simpletest.py``. diff -Nru basemap-1.1.0+dfsg/examples/allskymap_cr_example.py basemap-1.2.0+dfsg/examples/allskymap_cr_example.py --- basemap-1.1.0+dfsg/examples/allskymap_cr_example.py 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/examples/allskymap_cr_example.py 2018-09-26 01:25:23.000000000 +0000 @@ -1,3 +1,5 @@ +from __future__ import (absolute_import, division, print_function) + """ Example of astronomical use of AllSkyMap class in allskymap.py module diff -Nru basemap-1.1.0+dfsg/examples/allskymap.py basemap-1.2.0+dfsg/examples/allskymap.py --- basemap-1.1.0+dfsg/examples/allskymap.py 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/examples/allskymap.py 2018-09-26 01:25:23.000000000 +0000 @@ -1,3 +1,5 @@ +from __future__ import (absolute_import, division, print_function) + from __future__ import unicode_literals """ AllSkyMap is a subclass of Basemap, specialized for handling common plotting diff -Nru basemap-1.1.0+dfsg/examples/animate.py basemap-1.2.0+dfsg/examples/animate.py --- basemap-1.1.0+dfsg/examples/animate.py 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/examples/animate.py 2018-09-26 01:25:23.000000000 +0000 @@ -1,3 +1,5 @@ +from __future__ import (absolute_import, division, print_function) + # example using matplotlib.animation to create a movie # reads data over http - needs an active internet connection. diff -Nru basemap-1.1.0+dfsg/examples/barb_demo.py basemap-1.2.0+dfsg/examples/barb_demo.py --- basemap-1.1.0+dfsg/examples/barb_demo.py 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/examples/barb_demo.py 2018-09-26 01:25:23.000000000 +0000 @@ -1,3 +1,5 @@ +from __future__ import (absolute_import, division, print_function) + from mpl_toolkits.basemap import Basemap import numpy as np import matplotlib.pyplot as plt diff -Nru basemap-1.1.0+dfsg/examples/ccsm_popgrid.py basemap-1.2.0+dfsg/examples/ccsm_popgrid.py --- basemap-1.1.0+dfsg/examples/ccsm_popgrid.py 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/examples/ccsm_popgrid.py 2018-09-26 01:25:23.000000000 +0000 @@ -1,3 +1,5 @@ +from __future__ import (absolute_import, division, print_function) + """ This example shows how to plot data on rectangular 2D grids (grids that are not rectlinear in geographic or native map projection @@ -56,7 +58,7 @@ m.fillcontinents(color='white') x, y = m(tlon,tlat) -im = m.pcolor(x,y,ma.masked_array(np.zeros(temp.shape,'f'), temp.mask), +im = m.pcolormesh(x,y,ma.masked_array(np.zeros(temp.shape,'f'), temp.mask), shading='faceted', antialiased=True, cmap=plt.cm.cool, vmin=0, vmax=0) # disclaimer: these are not really the grid cells because of the diff -Nru basemap-1.1.0+dfsg/examples/contour_demo.py basemap-1.2.0+dfsg/examples/contour_demo.py --- basemap-1.1.0+dfsg/examples/contour_demo.py 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/examples/contour_demo.py 2018-09-26 01:25:23.000000000 +0000 @@ -1,3 +1,5 @@ +from __future__ import (absolute_import, division, print_function) + from mpl_toolkits.basemap import Basemap import numpy as np import matplotlib.pyplot as plt diff -Nru basemap-1.1.0+dfsg/examples/counties.py basemap-1.2.0+dfsg/examples/counties.py --- basemap-1.1.0+dfsg/examples/counties.py 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/examples/counties.py 2018-09-26 01:25:23.000000000 +0000 @@ -1,8 +1,10 @@ +from __future__ import (absolute_import, division, print_function) + import matplotlib.pyplot as plt from mpl_toolkits.basemap import Basemap def draw_map_background(m, ax): - ax.set_axis_bgcolor('#729FCF') + ax.set_facecolor('#729FCF') m.fillcontinents(color='#FAFAFA', ax=ax, zorder=0) m.drawcounties(ax=ax) m.drawstates(ax=ax) diff -Nru basemap-1.1.0+dfsg/examples/cubed_sphere.py basemap-1.2.0+dfsg/examples/cubed_sphere.py --- basemap-1.1.0+dfsg/examples/cubed_sphere.py 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/examples/cubed_sphere.py 2018-09-26 01:25:23.000000000 +0000 @@ -1,3 +1,5 @@ +from __future__ import (absolute_import, division, print_function) + from mpl_toolkits.basemap import Basemap import matplotlib.pyplot as plt import numpy as np diff -Nru basemap-1.1.0+dfsg/examples/customticks.py basemap-1.2.0+dfsg/examples/customticks.py --- basemap-1.1.0+dfsg/examples/customticks.py 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/examples/customticks.py 2018-09-26 01:25:23.000000000 +0000 @@ -1,3 +1,5 @@ +from __future__ import (absolute_import, division, print_function) + from __future__ import unicode_literals from mpl_toolkits.basemap import Basemap import numpy as np diff -Nru basemap-1.1.0+dfsg/examples/daynight.py basemap-1.2.0+dfsg/examples/daynight.py --- basemap-1.1.0+dfsg/examples/daynight.py 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/examples/daynight.py 2018-09-26 01:25:23.000000000 +0000 @@ -1,3 +1,5 @@ +from __future__ import (absolute_import, division, print_function) + import numpy as np from mpl_toolkits.basemap import Basemap import matplotlib.pyplot as plt diff -Nru basemap-1.1.0+dfsg/examples/embedding_map_in_wx.py basemap-1.2.0+dfsg/examples/embedding_map_in_wx.py --- basemap-1.1.0+dfsg/examples/embedding_map_in_wx.py 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/examples/embedding_map_in_wx.py 2018-09-26 01:25:23.000000000 +0000 @@ -1,3 +1,5 @@ +from __future__ import (absolute_import, division, print_function) + #!/usr/bin/env python """ An example of how to use wx or wxagg in an application with the Basemap module diff -Nru basemap-1.1.0+dfsg/examples/fcstmaps_axesgrid.py basemap-1.2.0+dfsg/examples/fcstmaps_axesgrid.py --- basemap-1.1.0+dfsg/examples/fcstmaps_axesgrid.py 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/examples/fcstmaps_axesgrid.py 2018-09-26 01:25:23.000000000 +0000 @@ -1,4 +1,5 @@ -from __future__ import print_function +from __future__ import (absolute_import, division, print_function) + from __future__ import unicode_literals # this example reads today's numerical weather forecasts # from the NOAA OpenDAP servers and makes a multi-panel plot. diff -Nru basemap-1.1.0+dfsg/examples/fcstmaps.py basemap-1.2.0+dfsg/examples/fcstmaps.py --- basemap-1.1.0+dfsg/examples/fcstmaps.py 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/examples/fcstmaps.py 2018-09-26 01:25:23.000000000 +0000 @@ -1,4 +1,5 @@ -from __future__ import print_function +from __future__ import (absolute_import, division, print_function) + from __future__ import unicode_literals # this example reads today's numerical weather forecasts # from the NOAA OpenDAP servers and makes a multi-panel plot. diff -Nru basemap-1.1.0+dfsg/examples/fillstates.py basemap-1.2.0+dfsg/examples/fillstates.py --- basemap-1.1.0+dfsg/examples/fillstates.py 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/examples/fillstates.py 2018-09-26 01:25:23.000000000 +0000 @@ -1,19 +1,31 @@ -from __future__ import print_function +from __future__ import (absolute_import, division, print_function) + import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.basemap import Basemap as Basemap -from matplotlib.colors import rgb2hex +from matplotlib.colors import rgb2hex, Normalize from matplotlib.patches import Polygon +from matplotlib.colorbar import ColorbarBase + +fig, ax = plt.subplots() # Lambert Conformal map of lower 48 states. -m = Basemap(llcrnrlon=-119,llcrnrlat=22,urcrnrlon=-64,urcrnrlat=49, +m = Basemap(llcrnrlon=-119,llcrnrlat=20,urcrnrlon=-64,urcrnrlat=49, projection='lcc',lat_1=33,lat_2=45,lon_0=-95) -# draw state boundaries. -# data from U.S Census Bureau -# http://www.census.gov/geo/www/cob/st2000.html -shp_info = m.readshapefile('st99_d00','states',drawbounds=True) -# population density by state from -# http://en.wikipedia.org/wiki/List_of_U.S._states_by_population_density + +# Mercator projection, for Alaska and Hawaii +m_ = Basemap(llcrnrlon=-190,llcrnrlat=20,urcrnrlon=-143,urcrnrlat=46, + projection='merc',lat_ts=20) # do not change these numbers + +#%% --------- draw state boundaries ---------------------------------------- +## data from U.S Census Bureau +## http://www.census.gov/geo/www/cob/st2000.html +shp_info = m.readshapefile('st99_d00','states',drawbounds=True, + linewidth=0.45,color='gray') +shp_info_ = m_.readshapefile('st99_d00','states',drawbounds=False) + +## population density by state from +## http://en.wikipedia.org/wiki/List_of_U.S._states_by_population_density popdensity = { 'New Jersey': 438.00, 'Rhode Island': 387.35, @@ -65,13 +77,13 @@ 'Montana': 2.39, 'Wyoming': 1.96, 'Alaska': 0.42} -print(shp_info) -# choose a color for each state based on population density. + +#%% -------- choose a color for each state based on population density. ------- colors={} statenames=[] -cmap = plt.cm.hot # use 'hot' colormap +cmap = plt.cm.hot_r # use 'reversed hot' colormap vmin = 0; vmax = 450 # set range. -print(m.states_info[0].keys()) +norm = Normalize(vmin=vmin, vmax=vmax) for shapedict in m.states_info: statename = shapedict['NAME'] # skip DC and Puerto Rico. @@ -80,18 +92,51 @@ # calling colormap with value between 0 and 1 returns # rgba value. Invert color range (hot colors are high # population), take sqrt root to spread out colors more. - colors[statename] = cmap(1.-np.sqrt((pop-vmin)/(vmax-vmin)))[:3] + colors[statename] = cmap(np.sqrt((pop-vmin)/(vmax-vmin)))[:3] statenames.append(statename) -# cycle through state names, color each one. -ax = plt.gca() # get current axes instance + +#%% --------- cycle through state names, color each one. -------------------- for nshape,seg in enumerate(m.states): # skip DC and Puerto Rico. - if statenames[nshape] not in ['District of Columbia','Puerto Rico']: - color = rgb2hex(colors[statenames[nshape]]) + if statenames[nshape] not in ['Puerto Rico', 'District of Columbia']: + color = rgb2hex(colors[statenames[nshape]]) poly = Polygon(seg,facecolor=color,edgecolor=color) ax.add_patch(poly) -# draw meridians and parallels. -m.drawparallels(np.arange(25,65,20),labels=[1,0,0,0]) -m.drawmeridians(np.arange(-120,-40,20),labels=[0,0,0,1]) -plt.title('Filling State Polygons by Population Density') + +AREA_1 = 0.005 # exclude small Hawaiian islands that are smaller than AREA_1 +AREA_2 = AREA_1 * 30.0 # exclude Alaskan islands that are smaller than AREA_2 +AK_SCALE = 0.19 # scale down Alaska to show as a map inset +HI_OFFSET_X = -1900000 # X coordinate offset amount to move Hawaii "beneath" Texas +HI_OFFSET_Y = 250000 # similar to above: Y offset for Hawaii +AK_OFFSET_X = -250000 # X offset for Alaska (These four values are obtained +AK_OFFSET_Y = -750000 # via manual trial and error, thus changing them is not recommended.) + +for nshape, shapedict in enumerate(m_.states_info): # plot Alaska and Hawaii as map insets + if shapedict['NAME'] in ['Alaska', 'Hawaii']: + seg = m_.states[int(shapedict['SHAPENUM'] - 1)] + if shapedict['NAME'] == 'Hawaii' and float(shapedict['AREA']) > AREA_1: + seg = [(x + HI_OFFSET_X, y + HI_OFFSET_Y) for x, y in seg] + color = rgb2hex(colors[statenames[nshape]]) + elif shapedict['NAME'] == 'Alaska' and float(shapedict['AREA']) > AREA_2: + seg = [(x*AK_SCALE + AK_OFFSET_X, y*AK_SCALE + AK_OFFSET_Y)\ + for x, y in seg] + color = rgb2hex(colors[statenames[nshape]]) + poly = Polygon(seg, facecolor=color, edgecolor='gray', linewidth=.45) + ax.add_patch(poly) + +ax.set_title('United states population density by state') + +#%% --------- Plot bounding boxes for Alaska and Hawaii insets -------------- +light_gray = [0.8]*3 # define light gray color RGB +x1,y1 = m_([-190,-183,-180,-180,-175,-171,-171],[29,29,26,26,26,22,20]) +x2,y2 = m_([-180,-180,-177],[26,23,20]) # these numbers are fine-tuned manually +m_.plot(x1,y1,color=light_gray,linewidth=0.8) # do not change them drastically +m_.plot(x2,y2,color=light_gray,linewidth=0.8) + +#%% --------- Show color bar --------------------------------------- +ax_c = fig.add_axes([0.9, 0.1, 0.03, 0.8]) +cb = ColorbarBase(ax_c,cmap=cmap,norm=norm,orientation='vertical', + label=r'[population per $\mathregular{km^2}$]') + plt.show() + diff -Nru basemap-1.1.0+dfsg/examples/garp.py basemap-1.2.0+dfsg/examples/garp.py --- basemap-1.1.0+dfsg/examples/garp.py 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/examples/garp.py 2018-09-26 01:25:23.000000000 +0000 @@ -1,3 +1,5 @@ +from __future__ import (absolute_import, division, print_function) + from mpl_toolkits.basemap import Basemap import numpy as np import matplotlib.pyplot as plt diff -Nru basemap-1.1.0+dfsg/examples/geos_demo_2.py basemap-1.2.0+dfsg/examples/geos_demo_2.py --- basemap-1.1.0+dfsg/examples/geos_demo_2.py 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/examples/geos_demo_2.py 2018-09-26 01:25:23.000000000 +0000 @@ -1,3 +1,5 @@ +from __future__ import (absolute_import, division, print_function) + """geos_demo_2.py This script shows how to plot data onto the Geostationary Satellite projection diff -Nru basemap-1.1.0+dfsg/examples/geos_demo_3.py basemap-1.2.0+dfsg/examples/geos_demo_3.py --- basemap-1.1.0+dfsg/examples/geos_demo_3.py 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/examples/geos_demo_3.py 2018-09-26 01:25:23.000000000 +0000 @@ -1,3 +1,5 @@ +from __future__ import (absolute_import, division, print_function) + from mpl_toolkits.basemap import Basemap import numpy as np import matplotlib.pyplot as plt @@ -6,7 +8,7 @@ lon_0=57 # global geos map m1 = Basemap(projection='geos',lon_0=lon_0,rsphere=(6378137.00,6356752.3142),resolution=None) -ax = fig.add_axes([0.1,0.1,0.8,0.8],axisbg='k') +ax = fig.add_axes([0.1,0.1,0.8,0.8], facecolor='k') # plot just upper right quadrant (coordinates determined from global map). m = Basemap(projection='geos',lon_0=lon_0,rsphere=(6378137.00,6356752.3142),resolution='l',llcrnrx=0.,llcrnry=0.,urcrnrx=m1.urcrnrx/2.,urcrnry=m1.urcrnry/2.) m.drawcoastlines() @@ -22,7 +24,7 @@ # global ortho map lat_0=10. m1 = Basemap(projection='ortho',lon_0=lon_0,lat_0=lat_0,resolution=None) -ax = fig.add_axes([0.1,0.1,0.8,0.8],axisbg='k') +ax = fig.add_axes([0.1,0.1,0.8,0.8], facecolor='k') # plot just upper right quadrant (corners determined from global map). m = Basemap(projection='ortho',lon_0=lon_0,lat_0=lat_0,resolution='l',llcrnrx=0.,llcrnry=0.,urcrnrx=m1.urcrnrx/2.,urcrnry=m1.urcrnry/2.) m.drawcoastlines() diff -Nru basemap-1.1.0+dfsg/examples/geos_demo.py basemap-1.2.0+dfsg/examples/geos_demo.py --- basemap-1.1.0+dfsg/examples/geos_demo.py 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/examples/geos_demo.py 2018-09-26 01:25:23.000000000 +0000 @@ -1,3 +1,5 @@ +from __future__ import (absolute_import, division, print_function) + from mpl_toolkits.basemap import Basemap import numpy as np import matplotlib.pyplot as plt diff -Nru basemap-1.1.0+dfsg/examples/hexbin_demo.py basemap-1.2.0+dfsg/examples/hexbin_demo.py --- basemap-1.1.0+dfsg/examples/hexbin_demo.py 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/examples/hexbin_demo.py 2018-09-26 01:25:23.000000000 +0000 @@ -1,3 +1,5 @@ +from __future__ import (absolute_import, division, print_function) + # example showing how to plot scattered data with hexbin. from numpy.random import uniform import matplotlib.pyplot as plt @@ -54,7 +56,7 @@ H = np.ma.masked_where(mask, H/bincount) # set color of masked values to axes background (hexbin does this by default) palette = plt.cm.jet -palette.set_bad(ax.get_axis_bgcolor(), 1.0) +palette.set_bad(ax.get_facecolor(), 1.0) CS = m.pcolormesh(xedges,yedges,H.T,shading='flat',cmap=palette) # draw coastlines, lat/lon lines. m.drawcoastlines() diff -Nru basemap-1.1.0+dfsg/examples/hires.py basemap-1.2.0+dfsg/examples/hires.py --- basemap-1.1.0+dfsg/examples/hires.py 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/examples/hires.py 2018-09-26 01:25:23.000000000 +0000 @@ -1,4 +1,5 @@ -from __future__ import print_function +from __future__ import (absolute_import, division, print_function) + from mpl_toolkits.basemap import Basemap import numpy as np import matplotlib.pyplot as plt diff -Nru basemap-1.1.0+dfsg/examples/hurrtracks.py basemap-1.2.0+dfsg/examples/hurrtracks.py --- basemap-1.1.0+dfsg/examples/hurrtracks.py 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/examples/hurrtracks.py 2018-09-26 01:25:23.000000000 +0000 @@ -1,4 +1,5 @@ -from __future__ import print_function +from __future__ import (absolute_import, division, print_function) + """ draw Atlantic Hurricane Tracks for storms that reached Cat 4 or 5. part of the track for which storm is cat 4 or 5 is shown red. diff -Nru basemap-1.1.0+dfsg/examples/lic_demo.py basemap-1.2.0+dfsg/examples/lic_demo.py --- basemap-1.1.0+dfsg/examples/lic_demo.py 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/examples/lic_demo.py 2018-09-26 01:25:23.000000000 +0000 @@ -1,3 +1,5 @@ +from __future__ import (absolute_import, division, print_function) + # example showing how to use Line Integral Convolution to visualize a vector # flow field (from Hurricane Earl). Produces something akin to streamlines. # Requires vectorplot scikit (http://scikits.appspot.com/vectorplot). diff -Nru basemap-1.1.0+dfsg/examples/make_inset.py basemap-1.2.0+dfsg/examples/make_inset.py --- basemap-1.1.0+dfsg/examples/make_inset.py 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/examples/make_inset.py 2018-09-26 01:25:23.000000000 +0000 @@ -1,3 +1,5 @@ +from __future__ import (absolute_import, division, print_function) + from mpl_toolkits.basemap import Basemap from mpl_toolkits.axes_grid1.inset_locator import inset_axes import matplotlib.pyplot as plt diff -Nru basemap-1.1.0+dfsg/examples/maskoceans.py basemap-1.2.0+dfsg/examples/maskoceans.py --- basemap-1.1.0+dfsg/examples/maskoceans.py 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/examples/maskoceans.py 2018-09-26 01:25:23.000000000 +0000 @@ -1,3 +1,5 @@ +from __future__ import (absolute_import, division, print_function) + from mpl_toolkits.basemap import Basemap, shiftgrid, maskoceans, interp import numpy as np import matplotlib.pyplot as plt diff -Nru basemap-1.1.0+dfsg/examples/nsper_demo.py basemap-1.2.0+dfsg/examples/nsper_demo.py --- basemap-1.1.0+dfsg/examples/nsper_demo.py 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/examples/nsper_demo.py 2018-09-26 01:25:23.000000000 +0000 @@ -1,3 +1,5 @@ +from __future__ import (absolute_import, division, print_function) + from mpl_toolkits.basemap import Basemap import numpy as np import matplotlib.pyplot as plt @@ -32,7 +34,7 @@ fig = plt.figure() m1 = Basemap(projection='nsper',lon_0=lon_0,lat_0=lat_0,satellite_height=h,resolution=None) -ax = fig.add_axes([0.1,0.1,0.8,0.8],axisbg='k') +ax = fig.add_axes([0.1,0.1,0.8,0.8], facecolor='k') # plot just upper right quadrant (coordinates determined from global map). m = Basemap(projection='nsper',lon_0=lon_0,lat_0=lat_0,satellite_height=h,resolution='l',llcrnrx=0.,llcrnry=0.,urcrnrx=m1.urcrnrx/2.,urcrnry=m1.urcrnry/2.) m.drawcoastlines() diff -Nru basemap-1.1.0+dfsg/examples/nytolondon.py basemap-1.2.0+dfsg/examples/nytolondon.py --- basemap-1.1.0+dfsg/examples/nytolondon.py 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/examples/nytolondon.py 2018-09-26 01:25:23.000000000 +0000 @@ -1,3 +1,5 @@ +from __future__ import (absolute_import, division, print_function) + # example demonstrating how to draw a great circle on a map. from mpl_toolkits.basemap import Basemap import numpy as np diff -Nru basemap-1.1.0+dfsg/examples/ortho_demo.py basemap-1.2.0+dfsg/examples/ortho_demo.py --- basemap-1.1.0+dfsg/examples/ortho_demo.py 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/examples/ortho_demo.py 2018-09-26 01:25:23.000000000 +0000 @@ -1,3 +1,5 @@ +from __future__ import (absolute_import, division, print_function) + from mpl_toolkits.basemap import Basemap import numpy as np import matplotlib.pyplot as plt diff -Nru basemap-1.1.0+dfsg/examples/panelplot.py basemap-1.2.0+dfsg/examples/panelplot.py --- basemap-1.1.0+dfsg/examples/panelplot.py 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/examples/panelplot.py 2018-09-26 01:25:23.000000000 +0000 @@ -1,3 +1,5 @@ +from __future__ import (absolute_import, division, print_function) + from mpl_toolkits.basemap import Basemap from matplotlib import rcParams from matplotlib.ticker import MultipleLocator diff -Nru basemap-1.1.0+dfsg/examples/plotcities.py basemap-1.2.0+dfsg/examples/plotcities.py --- basemap-1.1.0+dfsg/examples/plotcities.py 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/examples/plotcities.py 2018-09-26 01:25:23.000000000 +0000 @@ -1,3 +1,5 @@ +from __future__ import (absolute_import, division, print_function) + from matplotlib.mlab import prctile_rank import matplotlib.pyplot as plt from mpl_toolkits.basemap import Basemap as Basemap diff -Nru basemap-1.1.0+dfsg/examples/plothighsandlows.py basemap-1.2.0+dfsg/examples/plothighsandlows.py --- basemap-1.1.0+dfsg/examples/plothighsandlows.py 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/examples/plothighsandlows.py 2018-09-26 01:25:23.000000000 +0000 @@ -1,3 +1,5 @@ +from __future__ import (absolute_import, division, print_function) + """ plot H's and L's on a sea-level pressure map (uses scipy.ndimage.filters and netcdf4-python) diff -Nru basemap-1.1.0+dfsg/examples/ploticos.py basemap-1.2.0+dfsg/examples/ploticos.py --- basemap-1.1.0+dfsg/examples/ploticos.py 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/examples/ploticos.py 2018-09-26 01:25:23.000000000 +0000 @@ -1,3 +1,5 @@ +from __future__ import (absolute_import, division, print_function) + from mpl_toolkits.basemap import Basemap import matplotlib.pyplot as plt import numpy as np diff -Nru basemap-1.1.0+dfsg/examples/plotmap_masked.py basemap-1.2.0+dfsg/examples/plotmap_masked.py --- basemap-1.1.0+dfsg/examples/plotmap_masked.py 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/examples/plotmap_masked.py 2018-09-26 01:25:23.000000000 +0000 @@ -1,3 +1,5 @@ +from __future__ import (absolute_import, division, print_function) + # make plot of etopo bathymetry/topography data on # lambert conformal conic map projection, drawing coastlines, state and # country boundaries, and parallels/meridians. diff -Nru basemap-1.1.0+dfsg/examples/plotmap_oo.py basemap-1.2.0+dfsg/examples/plotmap_oo.py --- basemap-1.1.0+dfsg/examples/plotmap_oo.py 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/examples/plotmap_oo.py 2018-09-26 01:25:23.000000000 +0000 @@ -1,3 +1,5 @@ +from __future__ import (absolute_import, division, print_function) + # make plot of etopo bathymetry/topography data on # lambert conformal conic map projection, drawing coastlines, state and # country boundaries, and parallels/meridians. diff -Nru basemap-1.1.0+dfsg/examples/plotmap.py basemap-1.2.0+dfsg/examples/plotmap.py --- basemap-1.1.0+dfsg/examples/plotmap.py 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/examples/plotmap.py 2018-09-26 01:25:23.000000000 +0000 @@ -1,3 +1,5 @@ +from __future__ import (absolute_import, division, print_function) + # make plot of etopo bathymetry/topography data on # lambert conformal conic map projection, drawing coastlines, state and # country boundaries, and parallels/meridians. diff -Nru basemap-1.1.0+dfsg/examples/plotmap_shaded.py basemap-1.2.0+dfsg/examples/plotmap_shaded.py --- basemap-1.1.0+dfsg/examples/plotmap_shaded.py 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/examples/plotmap_shaded.py 2018-09-26 01:25:23.000000000 +0000 @@ -1,3 +1,5 @@ +from __future__ import (absolute_import, division, print_function) + # make shaded relief plot of etopo bathymetry/topography data on # lambert conformal conic map projection. diff -Nru basemap-1.1.0+dfsg/examples/plotozone.py basemap-1.2.0+dfsg/examples/plotozone.py --- basemap-1.1.0+dfsg/examples/plotozone.py 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/examples/plotozone.py 2018-09-26 01:25:23.000000000 +0000 @@ -1,3 +1,5 @@ +from __future__ import (absolute_import, division, print_function) + # make plot of ozone concentration data on # lambert conformal conic map projection, drawing coastlines, state and # country boundaries, and parallels/meridians. @@ -48,7 +50,7 @@ # add an axes. ax = fig.add_axes([0.1,0.1,0.8,0.8]) -ax.set_axis_bgcolor('lightgrey') +ax.set_facecolor('lightgrey') # associate this axes with the Basemap instance. m.ax = ax diff -Nru basemap-1.1.0+dfsg/examples/plotprecip.py basemap-1.2.0+dfsg/examples/plotprecip.py --- basemap-1.1.0+dfsg/examples/plotprecip.py 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/examples/plotprecip.py 2018-09-26 01:25:23.000000000 +0000 @@ -1,4 +1,5 @@ -from __future__ import print_function +from __future__ import (absolute_import, division, print_function) + from mpl_toolkits.basemap import Basemap, cm from netCDF4 import Dataset as NetCDFFile import numpy as np diff -Nru basemap-1.1.0+dfsg/examples/plotsst.py basemap-1.2.0+dfsg/examples/plotsst.py --- basemap-1.1.0+dfsg/examples/plotsst.py 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/examples/plotsst.py 2018-09-26 01:25:23.000000000 +0000 @@ -1,3 +1,5 @@ +from __future__ import (absolute_import, division, print_function) + from mpl_toolkits.basemap import Basemap from netCDF4 import Dataset, date2index import numpy as np diff -Nru basemap-1.1.0+dfsg/examples/plot_tissot.py basemap-1.2.0+dfsg/examples/plot_tissot.py --- basemap-1.1.0+dfsg/examples/plot_tissot.py 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/examples/plot_tissot.py 2018-09-26 01:25:23.000000000 +0000 @@ -1,3 +1,5 @@ +from __future__ import (absolute_import, division, print_function) + import numpy as np import sys import matplotlib.pyplot as plt diff -Nru basemap-1.1.0+dfsg/examples/polarmaps.py basemap-1.2.0+dfsg/examples/polarmaps.py --- basemap-1.1.0+dfsg/examples/polarmaps.py 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/examples/polarmaps.py 2018-09-26 01:25:23.000000000 +0000 @@ -1,4 +1,5 @@ -from __future__ import print_function +from __future__ import (absolute_import, division, print_function) + # make plots of etopo bathymetry/topography data on # various map projections, drawing coastlines, state and # country boundaries, filling continents and drawing diff -Nru basemap-1.1.0+dfsg/examples/quiver_demo.py basemap-1.2.0+dfsg/examples/quiver_demo.py --- basemap-1.1.0+dfsg/examples/quiver_demo.py 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/examples/quiver_demo.py 2018-09-26 01:25:23.000000000 +0000 @@ -1,3 +1,5 @@ +from __future__ import (absolute_import, division, print_function) + from mpl_toolkits.basemap import Basemap import numpy as np import matplotlib.pyplot as plt diff -Nru basemap-1.1.0+dfsg/examples/randompoints.py basemap-1.2.0+dfsg/examples/randompoints.py --- basemap-1.1.0+dfsg/examples/randompoints.py 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/examples/randompoints.py 2018-09-26 01:25:23.000000000 +0000 @@ -1,3 +1,5 @@ +from __future__ import (absolute_import, division, print_function) + import numpy as np import matplotlib.pyplot as plt from matplotlib.colors import rgb2hex diff -Nru basemap-1.1.0+dfsg/examples/run_all.py basemap-1.2.0+dfsg/examples/run_all.py --- basemap-1.1.0+dfsg/examples/run_all.py 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/examples/run_all.py 2018-09-26 01:25:23.000000000 +0000 @@ -1,3 +1,5 @@ +from __future__ import (absolute_import, division, print_function) + import glob, os, sys test_files = glob.glob('*.py') test_files.remove('run_all.py') diff -Nru basemap-1.1.0+dfsg/examples/save_background.py basemap-1.2.0+dfsg/examples/save_background.py --- basemap-1.1.0+dfsg/examples/save_background.py 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/examples/save_background.py 2018-09-26 01:25:23.000000000 +0000 @@ -1,3 +1,5 @@ +from __future__ import (absolute_import, division, print_function) + import matplotlib, sys matplotlib.use('Agg') from mpl_toolkits.basemap import Basemap diff -Nru basemap-1.1.0+dfsg/examples/setwh.py basemap-1.2.0+dfsg/examples/setwh.py --- basemap-1.1.0+dfsg/examples/setwh.py 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/examples/setwh.py 2018-09-26 01:25:23.000000000 +0000 @@ -1,3 +1,5 @@ +from __future__ import (absolute_import, division, print_function) + # examples of using the 'width' and 'height' keywords # to the Basemap constructor. diff -Nru basemap-1.1.0+dfsg/examples/shiftdata.py basemap-1.2.0+dfsg/examples/shiftdata.py --- basemap-1.1.0+dfsg/examples/shiftdata.py 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/examples/shiftdata.py 2018-09-26 01:25:23.000000000 +0000 @@ -1,3 +1,5 @@ +from __future__ import (absolute_import, division, print_function) + import mpl_toolkits.basemap as bm import numpy as np import matplotlib.pyplot as plt diff -Nru basemap-1.1.0+dfsg/examples/show_colormaps.py basemap-1.2.0+dfsg/examples/show_colormaps.py --- basemap-1.1.0+dfsg/examples/show_colormaps.py 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/examples/show_colormaps.py 2018-09-26 01:25:23.000000000 +0000 @@ -1,3 +1,5 @@ +from __future__ import (absolute_import, division, print_function) + import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.basemap import cm diff -Nru basemap-1.1.0+dfsg/examples/simpletest_oo.py basemap-1.2.0+dfsg/examples/simpletest_oo.py --- basemap-1.1.0+dfsg/examples/simpletest_oo.py 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/examples/simpletest_oo.py 2018-09-26 01:25:23.000000000 +0000 @@ -1,4 +1,5 @@ -from __future__ import print_function +from __future__ import (absolute_import, division, print_function) + ###################################### # pyplot-free version of simpletest.py ###################################### diff -Nru basemap-1.1.0+dfsg/examples/simpletest.py basemap-1.2.0+dfsg/examples/simpletest.py --- basemap-1.1.0+dfsg/examples/simpletest.py 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/examples/simpletest.py 2018-09-26 01:25:23.000000000 +0000 @@ -1,3 +1,5 @@ +from __future__ import (absolute_import, division, print_function) + from mpl_toolkits.basemap import Basemap import numpy as np import matplotlib.pyplot as plt diff -Nru basemap-1.1.0+dfsg/examples/streamplot_demo.py basemap-1.2.0+dfsg/examples/streamplot_demo.py --- basemap-1.1.0+dfsg/examples/streamplot_demo.py 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/examples/streamplot_demo.py 2018-09-26 01:25:23.000000000 +0000 @@ -1,3 +1,5 @@ +from __future__ import (absolute_import, division, print_function) + # example showing how to use streamlines to visualize a vector # flow field (from Hurricane Earl). # Requires matplotlib 1.1.1 or newer. @@ -32,11 +34,14 @@ fig = plt.figure(figsize=(8,8)) m = Basemap(projection='cyl',llcrnrlat=lats1[0],llcrnrlon=lons1[0],urcrnrlat=lats1[-1],urcrnrlon=lons1[-1],resolution='i') x, y = m(lons,lats) -m.streamplot(x,y,udat,vdat,color=speed,linewidth=2,density=2,cmap=plt.cm.spectral) -m.colorbar() +m.drawmapboundary(fill_color='w') m.drawcoastlines() m.drawmeridians(np.arange(-120,-60,2),labels=[0,0,0,1]) m.drawparallels(np.arange(0,30,2),labels=[1,0,0,0]) + +m.streamplot(x,y,udat,vdat,color=speed,linewidth=2,density=2,cmap=plt.cm.Spectral) +m.colorbar() + plt.title('Hurricane Rita flow field visualized with streamlines',\ fontsize=13) plt.show() diff -Nru basemap-1.1.0+dfsg/examples/testarcgis.py basemap-1.2.0+dfsg/examples/testarcgis.py --- basemap-1.1.0+dfsg/examples/testarcgis.py 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/examples/testarcgis.py 2018-09-26 01:25:23.000000000 +0000 @@ -1,3 +1,5 @@ +from __future__ import (absolute_import, division, print_function) + from mpl_toolkits.basemap import Basemap import matplotlib.pyplot as plt import numpy as np @@ -28,7 +30,7 @@ epsg = 2263; width=600.e3; height = 400.e3 m=Basemap(epsg=epsg,resolution='h',width=width,height=height) # specify a different server. -m.arcgisimage(server='http://maps.ngdc.noaa.gov',service='etopo1',verbose=True) +m.arcgisimage(server='https://gis.ngdc.noaa.gov/arcgis',service='etopo1',verbose=True) m.drawmeridians(np.arange(-180,180,2),labels=[0,0,0,1]) m.drawparallels(np.arange(0,80,1),labels=[1,0,0,0]) m.drawcoastlines(linewidth=0.25) diff -Nru basemap-1.1.0+dfsg/examples/testgdal.py basemap-1.2.0+dfsg/examples/testgdal.py --- basemap-1.1.0+dfsg/examples/testgdal.py 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/examples/testgdal.py 2018-09-26 01:25:23.000000000 +0000 @@ -1,3 +1,5 @@ +from __future__ import (absolute_import, division, print_function) + """ example showing how to plot data from a DEM file and an ESRI shape file using gdal (http://pypi.python.org/pypi/GDAL). diff -Nru basemap-1.1.0+dfsg/examples/test.py basemap-1.2.0+dfsg/examples/test.py --- basemap-1.1.0+dfsg/examples/test.py 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/examples/test.py 2018-09-26 01:25:23.000000000 +0000 @@ -1,4 +1,5 @@ -from __future__ import print_function +from __future__ import (absolute_import, division, print_function) + # exercise all the projections by plotting # etopo bathymetry/topography over them, plus # drawing coastlines, state and @@ -377,7 +378,7 @@ llcrnrx = 137, urcrnrx = 222.5, resolution = 'l') m.drawcoastlines() ny,nx = lons.shape -m.contourf(lons[ny/2:,:],lats[ny/2:,:],topodat[ny/2:,:],50,cmap=cmap,extend='both',latlon=True) +m.contourf(lons[ny//2:,:],lats[ny//2:,:],topodat[ny//2:,:],50,cmap=cmap,extend='both',latlon=True) m.drawmeridians(np.arange(-180,180,20),labels=[1,1,1,1]) m.drawparallels(np.arange(20,80,20)) m.colorbar() diff -Nru basemap-1.1.0+dfsg/examples/test_rotpole.py basemap-1.2.0+dfsg/examples/test_rotpole.py --- basemap-1.1.0+dfsg/examples/test_rotpole.py 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/examples/test_rotpole.py 2018-09-26 01:25:23.000000000 +0000 @@ -1,4 +1,5 @@ -from __future__ import print_function +from __future__ import (absolute_import, division, print_function) + from netCDF4 import Dataset from mpl_toolkits.basemap import Basemap import numpy as np diff -Nru basemap-1.1.0+dfsg/examples/testwmsimage.py basemap-1.2.0+dfsg/examples/testwmsimage.py --- basemap-1.1.0+dfsg/examples/testwmsimage.py 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/examples/testwmsimage.py 2018-09-26 01:25:23.000000000 +0000 @@ -1,3 +1,5 @@ +from __future__ import (absolute_import, division, print_function) + """ example showing how to use OWSlib to retrieve an image from a WMS server and display it on a map (using the diff -Nru basemap-1.1.0+dfsg/examples/utmtest.py basemap-1.2.0+dfsg/examples/utmtest.py --- basemap-1.1.0+dfsg/examples/utmtest.py 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/examples/utmtest.py 2018-09-26 01:25:23.000000000 +0000 @@ -1,4 +1,5 @@ -from __future__ import print_function +from __future__ import (absolute_import, division, print_function) + import pyproj from mpl_toolkits.basemap import Basemap import matplotlib.pyplot as plt diff -Nru basemap-1.1.0+dfsg/examples/warpimage.py basemap-1.2.0+dfsg/examples/warpimage.py --- basemap-1.1.0+dfsg/examples/warpimage.py 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/examples/warpimage.py 2018-09-26 01:25:23.000000000 +0000 @@ -1,4 +1,5 @@ -from __future__ import print_function +from __future__ import (absolute_import, division, print_function) + from mpl_toolkits.basemap import Basemap import numpy as np import matplotlib.pyplot as plt diff -Nru basemap-1.1.0+dfsg/examples/wiki_example.py basemap-1.2.0+dfsg/examples/wiki_example.py --- basemap-1.1.0+dfsg/examples/wiki_example.py 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/examples/wiki_example.py 2018-09-26 01:25:23.000000000 +0000 @@ -1,3 +1,5 @@ +from __future__ import (absolute_import, division, print_function) + from mpl_toolkits.basemap import Basemap import matplotlib.pyplot as plt import numpy as np diff -Nru basemap-1.1.0+dfsg/.gitignore basemap-1.2.0+dfsg/.gitignore --- basemap-1.1.0+dfsg/.gitignore 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/.gitignore 2018-09-26 01:25:23.000000000 +0000 @@ -67,3 +67,5 @@ doc/_templates/gallery.html doc/users/installing.rst doc/_static/matplotlibrc + +.DS_Store diff -Nru basemap-1.1.0+dfsg/lib/mpl_toolkits/basemap/cm.py basemap-1.2.0+dfsg/lib/mpl_toolkits/basemap/cm.py --- basemap-1.1.0+dfsg/lib/mpl_toolkits/basemap/cm.py 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/lib/mpl_toolkits/basemap/cm.py 2018-09-26 01:25:23.000000000 +0000 @@ -1,3 +1,5 @@ +from __future__ import (absolute_import, division, print_function) + """ extra colormaps: @@ -11,6 +13,8 @@ run examples/show_colormaps.py to see what these colormaps look like. """ +from six import iteritems + from matplotlib import rcParams, colors _LUTSIZE = rcParams['image.lut'] @@ -70,7 +74,7 @@ def _revcmap(data): data_r = {} - for key,val in data.iteritems(): + for key,val in iteritems(data): val = list(val) valrev = val[::-1] valnew = [] @@ -79,7 +83,7 @@ data_r[key]=valnew return data_r -_cmapnames = datad.keys() +_cmapnames = list(datad.keys()) for _cmapname in _cmapnames: _cmapname_r = _cmapname+'_r' _cmapdat_r = _revcmap(datad[_cmapname]) diff -Nru basemap-1.1.0+dfsg/lib/mpl_toolkits/basemap/diagnostic.py basemap-1.2.0+dfsg/lib/mpl_toolkits/basemap/diagnostic.py --- basemap-1.1.0+dfsg/lib/mpl_toolkits/basemap/diagnostic.py 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/lib/mpl_toolkits/basemap/diagnostic.py 2018-09-26 01:25:23.000000000 +0000 @@ -1,3 +1,5 @@ +from __future__ import (absolute_import, division, print_function) + """ These are diagnostic and debugging functions for basemap. """ @@ -52,13 +54,8 @@ OWSLib_version = 'not installed' try: - from PIL import VERSION as pil_version - try: - from PIL import PILLOW_VERSION as pillow_version - except ImportError: - pillow_version = 'not installed' + from PIL import __version__ as pillow_version except ImportError: - pil_version = 'not installed' pillow_version = 'not installed' @@ -66,7 +63,7 @@ 'BasemapPackageVersions', """Python, basemap, matplotlib, numpy, pyproj, pyshp, PROJ4, geodesic, - GEOS, OWSLib, PIL, Pillow""") + GEOS, OWSLib, Pillow""") return BasemapPackageVersions( Python = sys_version, @@ -80,7 +77,6 @@ GEOS = _geoslib.__geos_version__, # optional dependencies below OWSLib = OWSLib_version, - PIL = pil_version, Pillow = pillow_version) def check_proj_inv_hammer(segfault_protection=True): diff -Nru basemap-1.1.0+dfsg/lib/mpl_toolkits/basemap/__init__.py basemap-1.2.0+dfsg/lib/mpl_toolkits/basemap/__init__.py --- basemap-1.1.0+dfsg/lib/mpl_toolkits/basemap/__init__.py 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/lib/mpl_toolkits/basemap/__init__.py 2018-09-26 01:25:23.000000000 +0000 @@ -1,3 +1,5 @@ +from __future__ import (absolute_import, division, print_function) + """ Module for plotting data on maps with matplotlib. @@ -13,8 +15,15 @@ :func:`addcyclic`: Add cyclic (wraparound) point in longitude. """ from distutils.version import LooseVersion + +try: + from urllib import urlretrieve + from urllib2 import urlopen +except ImportError: + from urllib.request import urlretrieve, urlopen + from matplotlib import __version__ as _matplotlib_version -from matplotlib.cbook import is_scalar, dedent +from matplotlib.cbook import dedent # check to make sure matplotlib is not too old. _matplotlib_version = LooseVersion(_matplotlib_version) _mpl_required_version = LooseVersion('0.98') @@ -1296,7 +1305,7 @@ # numpy array (first column is lons, second is lats). polystring = bdatfile.read(bytecount) # binary data is little endian. - b = np.array(np.fromstring(polystring,dtype=' -##Thanks +## Thanks Special thanks to John Hunter, Andrew Straw, Eric Firing, Rob Hetland, Scott Sinclair, Ivan Lima, Erik Andersen, Michael Hearne, Jesper Larsen, Ryan May, David Huard, Mauro Cavalcanti, Jonas Bluethgen, Chris Murphy, Pierre Gerard-Marchant, Christoph Gohlke, Eric Bruning, Stephane Raynaud, Tom Loredo, Patrick Marsh, Phil Elson, and Henry Hammond for valuable contributions. diff -Nru basemap-1.1.0+dfsg/requirements-dev.txt basemap-1.2.0+dfsg/requirements-dev.txt --- basemap-1.1.0+dfsg/requirements-dev.txt 1970-01-01 00:00:00.000000000 +0000 +++ basemap-1.2.0+dfsg/requirements-dev.txt 2018-09-26 01:25:23.000000000 +0000 @@ -0,0 +1,2 @@ +netCDF4 +pillow diff -Nru basemap-1.1.0+dfsg/requirements.txt basemap-1.2.0+dfsg/requirements.txt --- basemap-1.1.0+dfsg/requirements.txt 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/requirements.txt 2018-09-26 01:25:23.000000000 +0000 @@ -1,2 +1,5 @@ +matplotlib>=1.0.0 +numpy>=1.2.1 pyproj>=1.9.3 pyshp>=1.2.0 +six diff -Nru basemap-1.1.0+dfsg/setup.py basemap-1.2.0+dfsg/setup.py --- basemap-1.1.0+dfsg/setup.py 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/setup.py 2018-09-26 01:25:23.000000000 +0000 @@ -1,18 +1,20 @@ -import sys, glob, os, subprocess +from __future__ import (absolute_import, division, print_function) + +import glob +import io +import os +import sys +from setuptools.dist import Distribution if sys.version_info < (2, 6): raise SystemExit("""matplotlib and the basemap toolkit require Python 2.6 or later.""") -from distutils.dist import Distribution -from distutils.util import convert_path -from distutils import ccompiler, sysconfig - # Do not require numpy for just querying the package # Taken from the netcdf-python setup file (which took it from h5py setup file). inc_dirs = [] if any('--' + opt in sys.argv for opt in Distribution.display_option_names + ['help-commands', 'help']) or sys.argv[1] == 'egg_info': - from distutils.core import setup, Extension + from setuptools import setup, Extension else: import numpy # Use numpy versions if they are available. @@ -20,10 +22,14 @@ # append numpy include dir. inc_dirs.append(numpy.get_include()) -try: - from distutils.command.build_py import build_py_2to3 as build_py -except ImportError: - from distutils.command.build_py import build_py + +def get_install_requirements(path): + path = os.path.join(os.path.dirname(__file__), path) + with io.open(path, encoding='utf-8') as fp: + content = fp.read() + return [req for req in content.split("\n") + if req != '' and not req.startswith('#')] + def checkversion(GEOS_dir): """check geos C-API header file (geos_c.h)""" @@ -77,7 +83,7 @@ manually and set the variable GEOS_dir (right after the line that says "set GEOS_dir manually here".""" % "', '".join(geos_search_locations)) else: - geos_include_dirs=[os.path.join(GEOS_dir,'include'),inc_dirs] + geos_include_dirs=[os.path.join(GEOS_dir,'include')] + inc_dirs geos_library_dirs=[os.path.join(GEOS_dir,'lib'),os.path.join(GEOS_dir,'lib64')] packages = ['mpl_toolkits','mpl_toolkits.basemap'] @@ -108,14 +114,9 @@ datafiles = [os.path.join('data',os.path.basename(f)) for f in datafiles] package_data = {'mpl_toolkits.basemap':datafiles} -requirements = [ - "numpy>=1.2.1", - "matplotlib>=1.0.0", - "pyproj >= 1.9.3", - "pyshp >= 1.2.0" -] +install_requires = get_install_requirements("requirements.txt") -__version__ = "1.1.0" +__version__ = "1.2.0" setup( name = "basemap", version = __version__, @@ -131,7 +132,7 @@ author_email = "jeffrey.s.whitaker@noaa.gov", maintainer = "Ben Root", maintainer_email = "ben.v.root@gmail.com", - install_requires = requirements, + install_requires = install_requires, platforms = ["any"], license = "OSI Approved", keywords = ["python","plotting","plots","graphs","charts","GIS","mapping","map projections","maps"], @@ -146,7 +147,6 @@ packages = packages, namespace_packages = namespace_packages, package_dir = package_dirs, - ext_modules = extensions, - cmdclass = {'build_py': build_py}, + ext_modules = extensions, package_data = package_data ) diff -Nru basemap-1.1.0+dfsg/src/_geoslib.c basemap-1.2.0+dfsg/src/_geoslib.c --- basemap-1.1.0+dfsg/src/_geoslib.c 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/src/_geoslib.c 2018-09-26 01:25:23.000000000 +0000 @@ -1,24 +1,17 @@ -/* Generated by Cython 0.23.4 */ - -/* BEGIN: Cython Metadata -{ - "distutils": { - "depends": [] - } -} -END: Cython Metadata */ +/* Generated by Cython 0.28.4 */ #define PY_SSIZE_T_CLEAN #include "Python.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. -#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000) - #error Cython requires Python 2.6+ or Python 3.2+. +#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) + #error Cython requires Python 2.6+ or Python 3.3+. #else -#define CYTHON_ABI "0_23_4" +#define CYTHON_ABI "0_28_4" +#define CYTHON_FUTURE_DIVISION 0 #include #ifndef offsetof -#define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) + #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) #endif #if !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall @@ -37,6 +30,12 @@ #ifndef DL_EXPORT #define DL_EXPORT(t) t #endif +#define __PYX_COMMA , +#ifndef HAVE_LONG_LONG + #if PY_VERSION_HEX >= 0x02070000 + #define HAVE_LONG_LONG + #endif +#endif #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif @@ -44,17 +43,245 @@ #define Py_HUGE_VAL HUGE_VAL #endif #ifdef PYPY_VERSION -#define CYTHON_COMPILING_IN_PYPY 1 -#define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_PYPY 1 + #define CYTHON_COMPILING_IN_PYSTON 0 + #define CYTHON_COMPILING_IN_CPYTHON 0 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 0 + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #if PY_VERSION_HEX < 0x03050000 + #undef CYTHON_USE_ASYNC_SLOTS + #define CYTHON_USE_ASYNC_SLOTS 0 + #elif !defined(CYTHON_USE_ASYNC_SLOTS) + #define CYTHON_USE_ASYNC_SLOTS 1 + #endif + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #undef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 1 + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #undef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 0 +#elif defined(PYSTON_VERSION) + #define CYTHON_COMPILING_IN_PYPY 0 + #define CYTHON_COMPILING_IN_PYSTON 1 + #define CYTHON_COMPILING_IN_CPYTHON 0 + #ifndef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 1 + #endif + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #undef CYTHON_USE_ASYNC_SLOTS + #define CYTHON_USE_ASYNC_SLOTS 0 + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #ifndef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 1 + #endif + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #ifndef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 0 + #endif + #ifndef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 1 + #endif + #ifndef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 1 + #endif + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #undef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 0 +#else + #define CYTHON_COMPILING_IN_PYPY 0 + #define CYTHON_COMPILING_IN_PYSTON 0 + #define CYTHON_COMPILING_IN_CPYTHON 1 + #ifndef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 1 + #endif + #if PY_VERSION_HEX < 0x02070000 + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #elif !defined(CYTHON_USE_PYTYPE_LOOKUP) + #define CYTHON_USE_PYTYPE_LOOKUP 1 + #endif + #if PY_MAJOR_VERSION < 3 + #undef CYTHON_USE_ASYNC_SLOTS + #define CYTHON_USE_ASYNC_SLOTS 0 + #elif !defined(CYTHON_USE_ASYNC_SLOTS) + #define CYTHON_USE_ASYNC_SLOTS 1 + #endif + #if PY_VERSION_HEX < 0x02070000 + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #elif !defined(CYTHON_USE_PYLONG_INTERNALS) + #define CYTHON_USE_PYLONG_INTERNALS 1 + #endif + #ifndef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 1 + #endif + #ifndef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 1 + #endif + #if PY_VERSION_HEX < 0x030300F0 + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #elif !defined(CYTHON_USE_UNICODE_WRITER) + #define CYTHON_USE_UNICODE_WRITER 1 + #endif + #ifndef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 0 + #endif + #ifndef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 1 + #endif + #ifndef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 1 + #endif + #ifndef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 1 + #endif + #ifndef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 1 + #endif + #ifndef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT (0 && PY_VERSION_HEX >= 0x03050000) + #endif + #ifndef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1) + #endif +#endif +#if !defined(CYTHON_FAST_PYCCALL) +#define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) +#endif +#if CYTHON_USE_PYLONG_INTERNALS + #include "longintrepr.h" + #undef SHIFT + #undef BASE + #undef MASK +#endif +#ifndef __has_attribute + #define __has_attribute(x) 0 +#endif +#ifndef __has_cpp_attribute + #define __has_cpp_attribute(x) 0 +#endif +#ifndef CYTHON_RESTRICT + #if defined(__GNUC__) + #define CYTHON_RESTRICT __restrict__ + #elif defined(_MSC_VER) && _MSC_VER >= 1400 + #define CYTHON_RESTRICT __restrict + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_RESTRICT restrict + #else + #define CYTHON_RESTRICT + #endif +#endif +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +#endif +#ifndef CYTHON_MAYBE_UNUSED_VAR +# if defined(__cplusplus) + template void CYTHON_MAYBE_UNUSED_VAR( const T& ) { } +# else +# define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x) +# endif +#endif +#ifndef CYTHON_NCP_UNUSED +# if CYTHON_COMPILING_IN_CPYTHON +# define CYTHON_NCP_UNUSED +# else +# define CYTHON_NCP_UNUSED CYTHON_UNUSED +# endif +#endif +#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) +#ifdef _MSC_VER + #ifndef _MSC_STDINT_H_ + #if _MSC_VER < 1300 + typedef unsigned char uint8_t; + typedef unsigned int uint32_t; + #else + typedef unsigned __int8 uint8_t; + typedef unsigned __int32 uint32_t; + #endif + #endif #else -#define CYTHON_COMPILING_IN_PYPY 0 -#define CYTHON_COMPILING_IN_CPYTHON 1 + #include +#endif +#ifndef CYTHON_FALLTHROUGH + #if defined(__cplusplus) && __cplusplus >= 201103L + #if __has_cpp_attribute(fallthrough) + #define CYTHON_FALLTHROUGH [[fallthrough]] + #elif __has_cpp_attribute(clang::fallthrough) + #define CYTHON_FALLTHROUGH [[clang::fallthrough]] + #elif __has_cpp_attribute(gnu::fallthrough) + #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] + #endif + #endif + #ifndef CYTHON_FALLTHROUGH + #if __has_attribute(fallthrough) + #define CYTHON_FALLTHROUGH __attribute__((fallthrough)) + #else + #define CYTHON_FALLTHROUGH + #endif + #endif + #if defined(__clang__ ) && defined(__apple_build_version__) + #if __apple_build_version__ < 7000000 + #undef CYTHON_FALLTHROUGH + #define CYTHON_FALLTHROUGH + #endif + #endif #endif -#if !defined(CYTHON_USE_PYLONG_INTERNALS) && CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x02070000 -#define CYTHON_USE_PYLONG_INTERNALS 1 + +#ifndef CYTHON_INLINE + #if defined(__clang__) + #define CYTHON_INLINE __inline__ __attribute__ ((__unused__)) + #elif defined(__GNUC__) + #define CYTHON_INLINE __inline__ + #elif defined(_MSC_VER) + #define CYTHON_INLINE __inline + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_INLINE inline + #else + #define CYTHON_INLINE + #endif #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) -#define Py_OptimizeFlag 0 + #define Py_OptimizeFlag 0 #endif #define __PYX_BUILD_PY_SSIZE_T "n" #define CYTHON_FORMAT_SSIZE_T "z" @@ -81,23 +308,117 @@ #ifndef Py_TPFLAGS_HAVE_FINALIZE #define Py_TPFLAGS_HAVE_FINALIZE 0 #endif +#if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL) + #ifndef METH_FASTCALL + #define METH_FASTCALL 0x80 + #endif + typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs); + typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args, + Py_ssize_t nargs, PyObject *kwnames); +#else + #define __Pyx_PyCFunctionFast _PyCFunctionFast + #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords +#endif +#if CYTHON_FAST_PYCCALL +#define __Pyx_PyFastCFunction_Check(func)\ + ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS))))) +#else +#define __Pyx_PyFastCFunction_Check(func) 0 +#endif +#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) + #define PyObject_Malloc(s) PyMem_Malloc(s) + #define PyObject_Free(p) PyMem_Free(p) + #define PyObject_Realloc(p) PyMem_Realloc(p) +#endif +#if CYTHON_COMPILING_IN_PYSTON + #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co) + #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno) +#else + #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) + #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) +#endif +#if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000 + #define __Pyx_PyThreadState_Current PyThreadState_GET() +#elif PY_VERSION_HEX >= 0x03060000 + #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet() +#elif PY_VERSION_HEX >= 0x03000000 + #define __Pyx_PyThreadState_Current PyThreadState_GET() +#else + #define __Pyx_PyThreadState_Current _PyThreadState_Current +#endif +#if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT) +#include "pythread.h" +#define Py_tss_NEEDS_INIT 0 +typedef int Py_tss_t; +static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) { + *key = PyThread_create_key(); + return 0; // PyThread_create_key reports success always +} +static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) { + Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t)); + *key = Py_tss_NEEDS_INIT; + return key; +} +static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) { + PyObject_Free(key); +} +static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) { + return *key != Py_tss_NEEDS_INIT; +} +static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) { + PyThread_delete_key(*key); + *key = Py_tss_NEEDS_INIT; +} +static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) { + return PyThread_set_key_value(*key, value); +} +static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { + return PyThread_get_key_value(*key); +} +#endif // TSS (Thread Specific Storage) API +#if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized) +#define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n)) +#else +#define __Pyx_PyDict_NewPresized(n) PyDict_New() +#endif +#if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS +#define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) +#else +#define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name) +#endif #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) #define CYTHON_PEP393_ENABLED 1 #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ 0 : _PyUnicode_Ready((PyObject *)(op))) #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) + #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u) #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) + #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch) + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) #else #define CYTHON_PEP393_ENABLED 0 + #define PyUnicode_1BYTE_KIND 1 + #define PyUnicode_2BYTE_KIND 2 + #define PyUnicode_4BYTE_KIND 4 #define __Pyx_PyUnicode_READY(op) (0) #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) + #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111) #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE)) #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) + #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch) + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u)) #endif #if CYTHON_COMPILING_IN_PYPY #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b) @@ -110,6 +431,12 @@ #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains) #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) #endif +#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check) + #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) +#endif +#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format) + #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) +#endif #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) #if PY_MAJOR_VERSION >= 3 @@ -117,12 +444,16 @@ #else #define __Pyx_PyString_Format(a, b) PyString_Format(a, b) #endif +#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII) + #define PyObject_ASCII(o) PyObject_Repr(o) +#endif #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type #define PyStringObject PyUnicodeObject #define PyString_Type PyUnicode_Type #define PyString_Check PyUnicode_Check #define PyString_CheckExact PyUnicode_CheckExact + #define PyObject_Unicode PyObject_Str #endif #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) @@ -134,7 +465,11 @@ #ifndef PySet_CheckExact #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) #endif -#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) +#if CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq) +#else + #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq) +#endif #if PY_MAJOR_VERSION >= 3 #define PyIntObject PyLongObject #define PyInt_Type PyLong_Type @@ -169,46 +504,26 @@ #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t #endif #if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) + #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : (Py_INCREF(func), func)) #else #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass) #endif -#if PY_VERSION_HEX >= 0x030500B1 -#define __Pyx_PyAsyncMethodsStruct PyAsyncMethods -#define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async) -#elif CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 -typedef struct { - unaryfunc am_await; - unaryfunc am_aiter; - unaryfunc am_anext; -} __Pyx_PyAsyncMethodsStruct; -#define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved)) -#else -#define __Pyx_PyType_AsAsync(obj) NULL -#endif -#ifndef CYTHON_RESTRICT - #if defined(__GNUC__) - #define CYTHON_RESTRICT __restrict__ - #elif defined(_MSC_VER) && _MSC_VER >= 1400 - #define CYTHON_RESTRICT __restrict - #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define CYTHON_RESTRICT restrict +#if CYTHON_USE_ASYNC_SLOTS + #if PY_VERSION_HEX >= 0x030500B1 + #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods + #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async) #else - #define CYTHON_RESTRICT + #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved)) #endif +#else + #define __Pyx_PyType_AsAsync(obj) NULL #endif -#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) - -#ifndef CYTHON_INLINE - #if defined(__GNUC__) - #define CYTHON_INLINE __inline__ - #elif defined(_MSC_VER) - #define CYTHON_INLINE __inline - #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define CYTHON_INLINE inline - #else - #define CYTHON_INLINE - #endif +#ifndef __Pyx_PyAsyncMethodsStruct + typedef struct { + unaryfunc am_await; + unaryfunc am_aiter; + unaryfunc am_anext; + } __Pyx_PyAsyncMethodsStruct; #endif #if defined(WIN32) || defined(MS_WINDOWS) @@ -224,16 +539,18 @@ return value; } #endif - - -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL) +#define __Pyx_truncl trunc #else - #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#define __Pyx_truncl truncl #endif + +#define __PYX_ERR(f_index, lineno, Ln_error) \ +{ \ + __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \ +} + #ifndef __PYX_EXTERN_C #ifdef __cplusplus #define __PYX_EXTERN_C extern "C" @@ -244,37 +561,18 @@ #define __PYX_HAVE___geoslib #define __PYX_HAVE_API___geoslib +/* Early includes */ #include "numpy/arrayobject.h" #include "geos_c.h" #ifdef _OPENMP #include #endif /* _OPENMP */ -#ifdef PYREX_WITHOUT_ASSERTIONS +#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS) #define CYTHON_WITHOUT_ASSERTIONS #endif -#ifndef CYTHON_UNUSED -# if defined(__GNUC__) -# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) -# define CYTHON_UNUSED __attribute__ ((__unused__)) -# else -# define CYTHON_UNUSED -# endif -# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) -# define CYTHON_UNUSED __attribute__ ((__unused__)) -# else -# define CYTHON_UNUSED -# endif -#endif -#ifndef CYTHON_NCP_UNUSED -# if CYTHON_COMPILING_IN_CPYTHON -# define CYTHON_NCP_UNUSED -# else -# define CYTHON_NCP_UNUSED CYTHON_UNUSED -# endif -#endif -typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding; +typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 @@ -301,8 +599,8 @@ #define __Pyx_sst_abs(value) abs(value) #elif SIZEOF_LONG >= SIZEOF_SIZE_T #define __Pyx_sst_abs(value) labs(value) -#elif defined (_MSC_VER) && defined (_M_X64) - #define __Pyx_sst_abs(value) _abs64(value) +#elif defined (_MSC_VER) + #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value)) #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define __Pyx_sst_abs(value) llabs(value) #elif defined (__GNUC__) @@ -310,8 +608,8 @@ #else #define __Pyx_sst_abs(value) ((value<0) ? -value : value) #endif -static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*); -static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); +static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*); +static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s)) #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l) #define __Pyx_PyBytes_FromString PyBytes_FromString @@ -324,39 +622,51 @@ #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize #endif -#define __Pyx_PyObject_AsSString(s) ((signed char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s)) +#define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s)) +#define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s)) +#define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s)) +#define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s)) +#define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s)) +#define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s) #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s) #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) -#if PY_MAJOR_VERSION < 3 -static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) -{ +static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) { const Py_UNICODE *u_end = u; while (*u_end++) ; return (size_t)(u_end - u - 1); } -#else -#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen -#endif #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj) #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None) -#define __Pyx_PyBool_FromLong(b) ((b) ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False)) +static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b); static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); -static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); +#define __Pyx_PySequence_Tuple(obj)\ + (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj)) static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_ASSUME_SAFE_MACROS #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) #else #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) #endif #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) +#if PY_MAJOR_VERSION >= 3 +#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x)) +#else +#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x)) +#endif +#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x)) #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII static int __Pyx_sys_getdefaultencoding_not_ascii; static int __Pyx_init_sys_getdefaultencoding_params(void) { @@ -441,12 +751,15 @@ #define likely(x) (x) #define unlikely(x) (x) #endif /* __GNUC__ */ +static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; } -static PyObject *__pyx_m; +static PyObject *__pyx_m = NULL; static PyObject *__pyx_d; static PyObject *__pyx_b; +static PyObject *__pyx_cython_runtime = NULL; static PyObject *__pyx_empty_tuple; static PyObject *__pyx_empty_bytes; +static PyObject *__pyx_empty_unicode; static int __pyx_lineno; static int __pyx_clineno = 0; static const char * __pyx_cfilenm= __FILE__; @@ -454,7 +767,7 @@ static const char *__pyx_f[] = { - "_geoslib.pyx", + "src/_geoslib.pyx", }; /*--- Type declarations ---*/ @@ -490,7 +803,7 @@ }; -/* "_geoslib.pyx":385 +/* "_geoslib.pyx":387 * return area * * cdef class LineString(BaseGeometry): # <<<<<<<<<<<<<< @@ -502,7 +815,7 @@ }; -/* "_geoslib.pyx":417 +/* "_geoslib.pyx":419 * self.boundary = b * * cdef class Point(BaseGeometry): # <<<<<<<<<<<<<< @@ -517,6 +830,7 @@ /* --- Runtime support code (head) --- */ +/* Refnanny.proto */ #ifndef CYTHON_REFNANNY #define CYTHON_REFNANNY 0 #endif @@ -579,55 +893,123 @@ #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_getattro)) - return tp->tp_getattro(obj, attr_name); -#if PY_MAJOR_VERSION < 3 - if (likely(tp->tp_getattr)) - return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); -#endif - return PyObject_GetAttr(obj, attr_name); -} +/* PyObjectGetAttrStr.proto */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); #else #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) #endif +/* GetBuiltinName.proto */ static PyObject *__Pyx_GetBuiltinName(PyObject *name); -static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); -static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); - +/* PyThreadStateGet.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; +#define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; +#define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type +#else +#define __Pyx_PyThreadState_declare +#define __Pyx_PyThreadState_assign +#define __Pyx_PyErr_Occurred() PyErr_Occurred() +#endif + +/* SaveResetException.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); +#else +#define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb) +#define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb) +#endif + +/* GetException.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb) +static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#else static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); +#endif +/* GetModuleGlobalName.proto */ static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); +/* PyCFunctionFastCall.proto */ +#if CYTHON_FAST_PYCCALL +static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs); +#else +#define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL) +#endif + +/* PyFunctionFastCall.proto */ +#if CYTHON_FAST_PYCALL +#define __Pyx_PyFunction_FastCall(func, args, nargs)\ + __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL) +#if 1 || PY_VERSION_HEX < 0x030600B1 +static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs); +#else +#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs) +#endif +#endif + +/* PyObjectCall.proto */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); #else #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) #endif +/* PyObjectCallMethO.proto */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); #endif +/* PyObjectCallOneArg.proto */ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); -static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); -static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); +/* PyErrFetchRestore.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL) +#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) +#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) +#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) +#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) +#else +#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) +#endif +#else +#define __Pyx_PyErr_Clear() PyErr_Clear() +#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) +#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) +#define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb) +#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) +#endif +/* WriteUnraisableException.proto */ static void __Pyx_WriteUnraisable(const char *name, int clineno, int lineno, const char *filename, int full_traceback, int nogil); -static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, - const char *name, int exact); +/* ArgTypeTest.proto */ +#define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\ + ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\ + __Pyx__ArgTypeTest(obj, type, name, exact)) +static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact); +/* RaiseException.proto */ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); -#if CYTHON_COMPILING_IN_CPYTHON +/* ListAppend.proto */ +#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { PyListObject* L = (PyListObject*) list; Py_ssize_t len = Py_SIZE(list); @@ -643,23 +1025,29 @@ #define __Pyx_PyList_Append(L,x) PyList_Append(L,x) #endif +/* RaiseDoubleKeywords.proto */ static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); +/* ParseKeywords.proto */ static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\ PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\ const char* function_name); +/* RaiseArgTupleInvalid.proto */ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); +/* PyObjectCallNoArg.proto */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); #else #define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL) #endif +/* ExtTypeTest.proto */ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); +/* GetItemInt.proto */ #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\ @@ -677,15 +1065,45 @@ (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL)) static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, int wraparound, int boundscheck); -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); +static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, int wraparound, int boundscheck); +/* ObjectGetItem.proto */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key); +#else +#define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key) +#endif + +/* PyObject_GenericGetAttrNoDict.proto */ +#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 +static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name); +#else +#define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr +#endif + +/* PyObject_GenericGetAttr.proto */ +#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 +static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name); +#else +#define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr +#endif + +/* Import.proto */ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); +/* CLineInTraceback.proto */ +#ifdef CYTHON_CLINE_IN_TRACEBACK +#define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0) +#else +static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line); +#endif + +/* CodeObjectCache.proto */ typedef struct { - int code_line; PyCodeObject* code_object; + int code_line; } __Pyx_CodeObjectCacheEntry; struct __Pyx_CodeObjectCache { int count; @@ -697,23 +1115,45 @@ static PyCodeObject *__pyx_find_code_object(int code_line); static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); +/* AddTraceback.proto */ static void __Pyx_AddTraceback(const char *funcname, int c_line, int py_line, const char *filename); +/* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value); +/* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_int(unsigned int value); + +/* CIntFromPy.proto */ static CYTHON_INLINE unsigned int __Pyx_PyInt_As_unsigned_int(PyObject *); +/* CIntFromPy.proto */ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_int(unsigned int value); - +/* CIntFromPy.proto */ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); +/* FastTypeChecks.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type) +static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b); +static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type); +static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2); +#else +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) +#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type) +#define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2)) +#endif +#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) + +/* CheckBinaryVersion.proto */ static int __Pyx_check_binary_version(void); +/* PyIdentifierFromString.proto */ #if !defined(__Pyx_PyIdentifier_FromString) #if PY_MAJOR_VERSION < 3 #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) @@ -722,10 +1162,13 @@ #endif #endif +/* ModuleImport.proto */ static PyObject *__Pyx_ImportModule(const char *name); +/* TypeImport.proto */ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); +/* InitStrings.proto */ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); @@ -742,36 +1185,39 @@ static PyObject *__pyx_f_8_geoslib_geos_version(void); /*proto*/ static PyObject *__pyx_f_8_geoslib__get_coords(GEOSGeom *); /*proto*/ #define __Pyx_MODULE_NAME "_geoslib" +extern int __pyx_module_is_main__geoslib; int __pyx_module_is_main__geoslib = 0; /* Implementation of '_geoslib' */ static PyObject *__pyx_builtin_NotImplementedError; -static char __pyx_k_b[] = "b"; -static char __pyx_k_0_3[] = "0.3"; -static char __pyx_k_sys[] = "sys"; -static char __pyx_k_copy[] = "copy"; -static char __pyx_k_main[] = "__main__"; -static char __pyx_k_test[] = "__test__"; -static char __pyx_k_class[] = "__class__"; -static char __pyx_k_empty[] = "empty"; -static char __pyx_k_numpy[] = "numpy"; -static char __pyx_k_shape[] = "shape"; -static char __pyx_k_write[] = "write"; -static char __pyx_k_import[] = "__import__"; -static char __pyx_k_stderr[] = "stderr"; -static char __pyx_k_float64[] = "float64"; -static char __pyx_k_version[] = "__version__"; -static char __pyx_k_GEOS_ERROR_s[] = "GEOS_ERROR: %s\n"; -static char __pyx_k_geos_version[] = "__geos_version__"; -static char __pyx_k_geos_major_version[] = "__geos_major_version__"; -static char __pyx_k_NotImplementedError[] = "NotImplementedError"; -static char __pyx_k_intersections_of_type_s_not_yet[] = "intersections of type '%s' not yet implemented"; -static char __pyx_k_unions_of_type_s_not_yet_impleme[] = "unions of type '%s' not yet implemented"; +static const char __pyx_k_b[] = "b"; +static const char __pyx_k_0_3[] = "0.3"; +static const char __pyx_k_sys[] = "sys"; +static const char __pyx_k_copy[] = "copy"; +static const char __pyx_k_main[] = "__main__"; +static const char __pyx_k_test[] = "__test__"; +static const char __pyx_k_class[] = "__class__"; +static const char __pyx_k_empty[] = "empty"; +static const char __pyx_k_numpy[] = "numpy"; +static const char __pyx_k_shape[] = "shape"; +static const char __pyx_k_write[] = "write"; +static const char __pyx_k_import[] = "__import__"; +static const char __pyx_k_stderr[] = "stderr"; +static const char __pyx_k_float64[] = "float64"; +static const char __pyx_k_version[] = "__version__"; +static const char __pyx_k_GEOS_ERROR_s[] = "GEOS_ERROR: %s\n"; +static const char __pyx_k_geos_version[] = "__geos_version__"; +static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback"; +static const char __pyx_k_geos_major_version[] = "__geos_major_version__"; +static const char __pyx_k_NotImplementedError[] = "NotImplementedError"; +static const char __pyx_k_intersections_of_type_s_not_yet[] = "intersections of type '%s' not yet implemented"; +static const char __pyx_k_unions_of_type_s_not_yet_impleme[] = "unions of type '%s' not yet implemented"; static PyObject *__pyx_kp_s_0_3; static PyObject *__pyx_kp_s_GEOS_ERROR_s; static PyObject *__pyx_n_s_NotImplementedError; static PyObject *__pyx_n_s_b; static PyObject *__pyx_n_s_class; +static PyObject *__pyx_n_s_cline_in_traceback; static PyObject *__pyx_n_s_copy; static PyObject *__pyx_n_s_empty; static PyObject *__pyx_n_s_float64; @@ -824,6 +1270,7 @@ static PyObject *__pyx_tuple__2; static PyObject *__pyx_tuple__3; static PyObject *__pyx_tuple__4; +/* Late includes */ /* "_geoslib.pyx":108 * int GEOSCoordSeq_getSize(GEOSCoordSeq *s, unsigned int *size) @@ -862,9 +1309,6 @@ PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; __Pyx_RefNannySetupContext("error_h", 0); /* "_geoslib.pyx":119 @@ -874,7 +1318,7 @@ * message = PyBytes_FromString(msg) * try: */ - __pyx_t_1 = PyBytes_FromString(__pyx_v_fmt); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyBytes_FromString(__pyx_v_fmt); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 119, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_format = __pyx_t_1; __pyx_t_1 = 0; @@ -886,7 +1330,7 @@ * try: * warn_msg = format % message */ - __pyx_t_1 = PyBytes_FromString(__pyx_v_msg); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyBytes_FromString(__pyx_v_msg); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 120, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_message = __pyx_t_1; __pyx_t_1 = 0; @@ -899,6 +1343,8 @@ * except: */ { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4); __Pyx_XGOTREF(__pyx_t_2); __Pyx_XGOTREF(__pyx_t_3); @@ -912,7 +1358,7 @@ * except: * warn_msg = format */ - __pyx_t_1 = PyNumber_Remainder(__pyx_v_format, __pyx_v_message); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_t_1 = PyNumber_Remainder(__pyx_v_format, __pyx_v_message); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 122, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_warn_msg = __pyx_t_1; __pyx_t_1 = 0; @@ -928,7 +1374,7 @@ __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - goto __pyx_L10_try_end; + goto __pyx_L8_try_end; __pyx_L3_error:; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -941,7 +1387,7 @@ */ /*except:*/ { __Pyx_AddTraceback("_geoslib.error_h", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_5, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} + if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_5, &__pyx_t_6) < 0) __PYX_ERR(0, 123, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GOTREF(__pyx_t_5); __Pyx_GOTREF(__pyx_t_6); @@ -979,7 +1425,7 @@ __Pyx_XGIVEREF(__pyx_t_3); __Pyx_XGIVEREF(__pyx_t_4); __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); - __pyx_L10_try_end:; + __pyx_L8_try_end:; } /* "_geoslib.pyx":125 @@ -989,18 +1435,18 @@ * * # check library version */ - __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 125, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_stderr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_stderr); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 125, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_write); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_write); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 125, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_GEOS_ERROR_s, __pyx_v_warn_msg); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_GEOS_ERROR_s, __pyx_v_warn_msg); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 125, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_7 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) { + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_7)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); @@ -1010,19 +1456,39 @@ } } if (!__pyx_t_7) { - __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 125, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_GOTREF(__pyx_t_6); } else { - __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __pyx_t_7 = NULL; - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_5)) { + PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_1}; + __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 125, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { + PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_1}; + __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 125, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else + #endif + { + __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 125, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __pyx_t_7 = NULL; + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 125, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } } __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; @@ -1043,7 +1509,7 @@ __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); - __Pyx_WriteUnraisable("_geoslib.error_h", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0); + __Pyx_WriteUnraisable("_geoslib.error_h", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_L0:; __Pyx_XDECREF(__pyx_v_format); __Pyx_XDECREF(__pyx_v_message); @@ -1063,9 +1529,6 @@ PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; __Pyx_RefNannySetupContext("geos_version", 0); /* "_geoslib.pyx":129 @@ -1076,7 +1539,7 @@ * __geos_major_version__ = GEOS_VERSION_MAJOR */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyBytes_FromString(GEOSversion()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyBytes_FromString(GEOSversion()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 129, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1223,9 +1686,6 @@ PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; __Pyx_RefNannySetupContext("geom_type", 0); /* "_geoslib.pyx":152 @@ -1236,7 +1696,7 @@ * def within(self, BaseGeometry geom): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyBytes_FromString(GEOSGeomType(__pyx_v_self->_geom)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyBytes_FromString(GEOSGeomType(__pyx_v_self->_geom)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 152, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1272,13 +1732,10 @@ /* Python wrapper */ static PyObject *__pyx_pw_8_geoslib_12BaseGeometry_5within(PyObject *__pyx_v_self, PyObject *__pyx_v_geom); /*proto*/ static PyObject *__pyx_pw_8_geoslib_12BaseGeometry_5within(PyObject *__pyx_v_self, PyObject *__pyx_v_geom) { - CYTHON_UNUSED int __pyx_lineno = 0; - CYTHON_UNUSED const char *__pyx_filename = NULL; - CYTHON_UNUSED int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("within (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_geom), __pyx_ptype_8_geoslib_BaseGeometry, 1, "geom", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_geom), __pyx_ptype_8_geoslib_BaseGeometry, 1, "geom", 0))) __PYX_ERR(0, 154, __pyx_L1_error) __pyx_r = __pyx_pf_8_geoslib_12BaseGeometry_4within(((struct __pyx_obj_8_geoslib_BaseGeometry *)__pyx_v_self), ((struct __pyx_obj_8_geoslib_BaseGeometry *)__pyx_v_geom)); /* function exit code */ @@ -1400,13 +1857,10 @@ /* Python wrapper */ static PyObject *__pyx_pw_8_geoslib_12BaseGeometry_7union(PyObject *__pyx_v_self, PyObject *__pyx_v_geom); /*proto*/ static PyObject *__pyx_pw_8_geoslib_12BaseGeometry_7union(PyObject *__pyx_v_self, PyObject *__pyx_v_geom) { - CYTHON_UNUSED int __pyx_lineno = 0; - CYTHON_UNUSED const char *__pyx_filename = NULL; - CYTHON_UNUSED int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("union (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_geom), __pyx_ptype_8_geoslib_BaseGeometry, 1, "geom", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_geom), __pyx_ptype_8_geoslib_BaseGeometry, 1, "geom", 0))) __PYX_ERR(0, 166, __pyx_L1_error) __pyx_r = __pyx_pf_8_geoslib_12BaseGeometry_6union(((struct __pyx_obj_8_geoslib_BaseGeometry *)__pyx_v_self), ((struct __pyx_obj_8_geoslib_BaseGeometry *)__pyx_v_geom)); /* function exit code */ @@ -1433,9 +1887,6 @@ GEOSGeom *__pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; __Pyx_RefNannySetupContext("union", 0); /* "_geoslib.pyx":172 @@ -1493,7 +1944,7 @@ * p = Polygon(b) * elif typeid == GEOS_LINESTRING: */ - __pyx_t_2 = __pyx_f_8_geoslib__get_coords(__pyx_v_g3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_f_8_geoslib__get_coords(__pyx_v_g3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 177, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_b = __pyx_t_2; __pyx_t_2 = 0; @@ -1505,16 +1956,10 @@ * elif typeid == GEOS_LINESTRING: * b = _get_coords(g3) */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_8_geoslib_Polygon), __pyx_v_b); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 178, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_v_b); - __Pyx_GIVEREF(__pyx_v_b); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_b); - __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8_geoslib_Polygon), __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_p = ((struct __pyx_obj_8_geoslib_BaseGeometry *)__pyx_t_3); - __pyx_t_3 = 0; + __pyx_v_p = ((struct __pyx_obj_8_geoslib_BaseGeometry *)__pyx_t_2); + __pyx_t_2 = 0; /* "_geoslib.pyx":176 * g3 = GEOSUnion(g1, g2) @@ -1541,10 +1986,10 @@ * p = LineString(b) * # for multi-geom structures, just return first one. */ - __pyx_t_3 = __pyx_f_8_geoslib__get_coords(__pyx_v_g3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_v_b = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_t_2 = __pyx_f_8_geoslib__get_coords(__pyx_v_g3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 180, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_b = __pyx_t_2; + __pyx_t_2 = 0; /* "_geoslib.pyx":181 * elif typeid == GEOS_LINESTRING: @@ -1553,14 +1998,8 @@ * # for multi-geom structures, just return first one. * elif typeid == GEOS_MULTIPOLYGON: */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_b); - __Pyx_GIVEREF(__pyx_v_b); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_b); - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8_geoslib_LineString), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_8_geoslib_LineString), __pyx_v_b); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 181, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_p = ((struct __pyx_obj_8_geoslib_BaseGeometry *)__pyx_t_2); __pyx_t_2 = 0; @@ -1607,7 +2046,7 @@ * p = Polygon(b) * elif typeid == GEOS_MULTILINESTRING: */ - __pyx_t_2 = __pyx_f_8_geoslib__get_coords(__pyx_v_gout); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_f_8_geoslib__get_coords(__pyx_v_gout); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 186, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_b = __pyx_t_2; __pyx_t_2 = 0; @@ -1619,16 +2058,10 @@ * elif typeid == GEOS_MULTILINESTRING: * numgeoms = GEOSGetNumGeometries(g3) */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_8_geoslib_Polygon), __pyx_v_b); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 187, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_v_b); - __Pyx_GIVEREF(__pyx_v_b); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_b); - __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8_geoslib_Polygon), __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_p = ((struct __pyx_obj_8_geoslib_BaseGeometry *)__pyx_t_3); - __pyx_t_3 = 0; + __pyx_v_p = ((struct __pyx_obj_8_geoslib_BaseGeometry *)__pyx_t_2); + __pyx_t_2 = 0; /* "_geoslib.pyx":183 * p = LineString(b) @@ -1673,10 +2106,10 @@ * p = LineString(b) * else: */ - __pyx_t_3 = __pyx_f_8_geoslib__get_coords(__pyx_v_gout); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_v_b = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_t_2 = __pyx_f_8_geoslib__get_coords(__pyx_v_gout); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 191, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_b = __pyx_t_2; + __pyx_t_2 = 0; /* "_geoslib.pyx":192 * gout = GEOSGetGeometryN(g3, 0) @@ -1685,14 +2118,8 @@ * else: * type = PyBytes_FromString(GEOSGeomType(g3)) */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_b); - __Pyx_GIVEREF(__pyx_v_b); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_b); - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8_geoslib_LineString), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_8_geoslib_LineString), __pyx_v_b); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 192, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_p = ((struct __pyx_obj_8_geoslib_BaseGeometry *)__pyx_t_2); __pyx_t_2 = 0; @@ -1713,7 +2140,7 @@ * raise NotImplementedError("unions of type '%s' not yet implemented" % (type)) * GEOSGeom_destroy(g3) */ - __pyx_t_2 = PyBytes_FromString(GEOSGeomType(__pyx_v_g3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyBytes_FromString(GEOSGeomType(__pyx_v_g3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 194, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_type = __pyx_t_2; __pyx_t_2 = 0; @@ -1725,19 +2152,14 @@ * GEOSGeom_destroy(g3) * return p */ - __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_unions_of_type_s_not_yet_impleme, __pyx_v_type); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_unions_of_type_s_not_yet_impleme, __pyx_v_type); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 195, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_NotImplementedError, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 195, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_NotImplementedError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(0, 195, __pyx_L1_error) break; } @@ -1822,9 +2244,6 @@ double __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; __Pyx_RefNannySetupContext("simplify", 0); /* "_geoslib.pyx":205 @@ -1844,7 +2263,7 @@ * g3 = GEOSSimplify(g1,tolerance) * typeid = GEOSGeomTypeId(g3) */ - __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_v_tol); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_v_tol); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 206, __pyx_L1_error) __pyx_v_tolerance = __pyx_t_2; /* "_geoslib.pyx":207 @@ -1882,7 +2301,7 @@ * p = Polygon(b) * elif typeid == GEOS_LINESTRING: */ - __pyx_t_3 = __pyx_f_8_geoslib__get_coords(__pyx_v_g3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_f_8_geoslib__get_coords(__pyx_v_g3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 210, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_v_b = __pyx_t_3; __pyx_t_3 = 0; @@ -1894,16 +2313,10 @@ * elif typeid == GEOS_LINESTRING: * b = _get_coords(g3) */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_8_geoslib_Polygon), __pyx_v_b); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 211, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_b); - __Pyx_GIVEREF(__pyx_v_b); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_b); - __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8_geoslib_Polygon), __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_p = ((struct __pyx_obj_8_geoslib_BaseGeometry *)__pyx_t_4); - __pyx_t_4 = 0; + __pyx_v_p = ((struct __pyx_obj_8_geoslib_BaseGeometry *)__pyx_t_3); + __pyx_t_3 = 0; /* "_geoslib.pyx":209 * g3 = GEOSSimplify(g1,tolerance) @@ -1930,10 +2343,10 @@ * p = LineString(b) * # for multi-geom structures, just return first one. */ - __pyx_t_4 = __pyx_f_8_geoslib__get_coords(__pyx_v_g3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_v_b = __pyx_t_4; - __pyx_t_4 = 0; + __pyx_t_3 = __pyx_f_8_geoslib__get_coords(__pyx_v_g3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 213, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_v_b = __pyx_t_3; + __pyx_t_3 = 0; /* "_geoslib.pyx":214 * elif typeid == GEOS_LINESTRING: @@ -1942,14 +2355,8 @@ * # for multi-geom structures, just return first one. * elif typeid == GEOS_MULTIPOLYGON: */ - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(__pyx_v_b); - __Pyx_GIVEREF(__pyx_v_b); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_b); - __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8_geoslib_LineString), __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_8_geoslib_LineString), __pyx_v_b); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 214, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_v_p = ((struct __pyx_obj_8_geoslib_BaseGeometry *)__pyx_t_3); __pyx_t_3 = 0; @@ -1996,7 +2403,7 @@ * p = Polygon(b) * elif typeid == GEOS_MULTILINESTRING: */ - __pyx_t_3 = __pyx_f_8_geoslib__get_coords(__pyx_v_gout); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_f_8_geoslib__get_coords(__pyx_v_gout); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 219, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_v_b = __pyx_t_3; __pyx_t_3 = 0; @@ -2008,16 +2415,10 @@ * elif typeid == GEOS_MULTILINESTRING: * numgeoms = GEOSGetNumGeometries(g3) */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_8_geoslib_Polygon), __pyx_v_b); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 220, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_b); - __Pyx_GIVEREF(__pyx_v_b); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_b); - __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8_geoslib_Polygon), __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_p = ((struct __pyx_obj_8_geoslib_BaseGeometry *)__pyx_t_4); - __pyx_t_4 = 0; + __pyx_v_p = ((struct __pyx_obj_8_geoslib_BaseGeometry *)__pyx_t_3); + __pyx_t_3 = 0; /* "_geoslib.pyx":216 * p = LineString(b) @@ -2062,10 +2463,10 @@ * p = LineString(b) * else: */ - __pyx_t_4 = __pyx_f_8_geoslib__get_coords(__pyx_v_gout); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_v_b = __pyx_t_4; - __pyx_t_4 = 0; + __pyx_t_3 = __pyx_f_8_geoslib__get_coords(__pyx_v_gout); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 224, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_v_b = __pyx_t_3; + __pyx_t_3 = 0; /* "_geoslib.pyx":225 * gout = GEOSGetGeometryN(g3, 0) @@ -2074,14 +2475,8 @@ * else: * type = PyBytes_FromString(GEOSGeomType(g3)) */ - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(__pyx_v_b); - __Pyx_GIVEREF(__pyx_v_b); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_b); - __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8_geoslib_LineString), __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_8_geoslib_LineString), __pyx_v_b); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 225, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_v_p = ((struct __pyx_obj_8_geoslib_BaseGeometry *)__pyx_t_3); __pyx_t_3 = 0; @@ -2102,7 +2497,7 @@ * raise NotImplementedError("intersections of type '%s' not yet implemented" % (type)) * GEOSGeom_destroy(g3) */ - __pyx_t_3 = PyBytes_FromString(GEOSGeomType(__pyx_v_g3)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyBytes_FromString(GEOSGeomType(__pyx_v_g3)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 227, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_v_type = __pyx_t_3; __pyx_t_3 = 0; @@ -2114,19 +2509,14 @@ * GEOSGeom_destroy(g3) * return p */ - __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_intersections_of_type_s_not_yet, __pyx_v_type); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_intersections_of_type_s_not_yet, __pyx_v_type); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 228, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_NotImplementedError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 228, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_NotImplementedError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __PYX_ERR(0, 228, __pyx_L1_error) break; } @@ -2209,9 +2599,6 @@ GEOSGeom *__pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; __Pyx_RefNannySetupContext("fix", 0); /* "_geoslib.pyx":237 @@ -2259,7 +2646,7 @@ * p = Polygon(b) * elif typeid == GEOS_LINESTRING: */ - __pyx_t_2 = __pyx_f_8_geoslib__get_coords(__pyx_v_g3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_f_8_geoslib__get_coords(__pyx_v_g3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 241, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_b = __pyx_t_2; __pyx_t_2 = 0; @@ -2271,16 +2658,10 @@ * elif typeid == GEOS_LINESTRING: * b = _get_coords(g3) */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_8_geoslib_Polygon), __pyx_v_b); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 242, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_v_b); - __Pyx_GIVEREF(__pyx_v_b); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_b); - __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8_geoslib_Polygon), __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_p = ((struct __pyx_obj_8_geoslib_BaseGeometry *)__pyx_t_3); - __pyx_t_3 = 0; + __pyx_v_p = ((struct __pyx_obj_8_geoslib_BaseGeometry *)__pyx_t_2); + __pyx_t_2 = 0; /* "_geoslib.pyx":240 * g3 = GEOSBuffer(g1, 0., 0) @@ -2307,10 +2688,10 @@ * p = LineString(b) * # for multi-geom structures, just return first one. */ - __pyx_t_3 = __pyx_f_8_geoslib__get_coords(__pyx_v_g3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_v_b = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_t_2 = __pyx_f_8_geoslib__get_coords(__pyx_v_g3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 244, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_b = __pyx_t_2; + __pyx_t_2 = 0; /* "_geoslib.pyx":245 * elif typeid == GEOS_LINESTRING: @@ -2319,14 +2700,8 @@ * # for multi-geom structures, just return first one. * elif typeid == GEOS_MULTIPOLYGON: */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_b); - __Pyx_GIVEREF(__pyx_v_b); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_b); - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8_geoslib_LineString), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_8_geoslib_LineString), __pyx_v_b); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 245, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_p = ((struct __pyx_obj_8_geoslib_BaseGeometry *)__pyx_t_2); __pyx_t_2 = 0; @@ -2373,7 +2748,7 @@ * p = Polygon(b) * elif typeid == GEOS_MULTILINESTRING: */ - __pyx_t_2 = __pyx_f_8_geoslib__get_coords(__pyx_v_gout); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_f_8_geoslib__get_coords(__pyx_v_gout); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 250, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_b = __pyx_t_2; __pyx_t_2 = 0; @@ -2385,16 +2760,10 @@ * elif typeid == GEOS_MULTILINESTRING: * numgeoms = GEOSGetNumGeometries(g3) */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_8_geoslib_Polygon), __pyx_v_b); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 251, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_v_b); - __Pyx_GIVEREF(__pyx_v_b); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_b); - __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8_geoslib_Polygon), __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_p = ((struct __pyx_obj_8_geoslib_BaseGeometry *)__pyx_t_3); - __pyx_t_3 = 0; + __pyx_v_p = ((struct __pyx_obj_8_geoslib_BaseGeometry *)__pyx_t_2); + __pyx_t_2 = 0; /* "_geoslib.pyx":247 * p = LineString(b) @@ -2438,11 +2807,11 @@ * b = _get_coords(gout) # <<<<<<<<<<<<<< * p = LineString(b) * else: - */ - __pyx_t_3 = __pyx_f_8_geoslib__get_coords(__pyx_v_gout); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_v_b = __pyx_t_3; - __pyx_t_3 = 0; + */ + __pyx_t_2 = __pyx_f_8_geoslib__get_coords(__pyx_v_gout); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 255, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_b = __pyx_t_2; + __pyx_t_2 = 0; /* "_geoslib.pyx":256 * gout = GEOSGetGeometryN(g3, 0) @@ -2451,14 +2820,8 @@ * else: * type = PyBytes_FromString(GEOSGeomType(g3)) */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_b); - __Pyx_GIVEREF(__pyx_v_b); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_b); - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8_geoslib_LineString), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_8_geoslib_LineString), __pyx_v_b); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 256, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_p = ((struct __pyx_obj_8_geoslib_BaseGeometry *)__pyx_t_2); __pyx_t_2 = 0; @@ -2479,7 +2842,7 @@ * raise NotImplementedError("intersections of type '%s' not yet implemented" % (type)) * GEOSGeom_destroy(g3) */ - __pyx_t_2 = PyBytes_FromString(GEOSGeomType(__pyx_v_g3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyBytes_FromString(GEOSGeomType(__pyx_v_g3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 258, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_type = __pyx_t_2; __pyx_t_2 = 0; @@ -2491,19 +2854,14 @@ * GEOSGeom_destroy(g3) * return p */ - __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_intersections_of_type_s_not_yet, __pyx_v_type); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_intersections_of_type_s_not_yet, __pyx_v_type); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 259, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_NotImplementedError, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 259, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_NotImplementedError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(0, 259, __pyx_L1_error) break; } @@ -2562,13 +2920,10 @@ /* Python wrapper */ static PyObject *__pyx_pw_8_geoslib_12BaseGeometry_13intersects(PyObject *__pyx_v_self, PyObject *__pyx_v_geom); /*proto*/ static PyObject *__pyx_pw_8_geoslib_12BaseGeometry_13intersects(PyObject *__pyx_v_self, PyObject *__pyx_v_geom) { - CYTHON_UNUSED int __pyx_lineno = 0; - CYTHON_UNUSED const char *__pyx_filename = NULL; - CYTHON_UNUSED int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("intersects (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_geom), __pyx_ptype_8_geoslib_BaseGeometry, 1, "geom", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_geom), __pyx_ptype_8_geoslib_BaseGeometry, 1, "geom", 0))) __PYX_ERR(0, 263, __pyx_L1_error) __pyx_r = __pyx_pf_8_geoslib_12BaseGeometry_12intersects(((struct __pyx_obj_8_geoslib_BaseGeometry *)__pyx_v_self), ((struct __pyx_obj_8_geoslib_BaseGeometry *)__pyx_v_geom)); /* function exit code */ @@ -2690,13 +3045,10 @@ /* Python wrapper */ static PyObject *__pyx_pw_8_geoslib_12BaseGeometry_15intersection(PyObject *__pyx_v_self, PyObject *__pyx_v_geom); /*proto*/ static PyObject *__pyx_pw_8_geoslib_12BaseGeometry_15intersection(PyObject *__pyx_v_self, PyObject *__pyx_v_geom) { - CYTHON_UNUSED int __pyx_lineno = 0; - CYTHON_UNUSED const char *__pyx_filename = NULL; - CYTHON_UNUSED int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("intersection (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_geom), __pyx_ptype_8_geoslib_BaseGeometry, 1, "geom", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_geom), __pyx_ptype_8_geoslib_BaseGeometry, 1, "geom", 0))) __PYX_ERR(0, 275, __pyx_L1_error) __pyx_r = __pyx_pf_8_geoslib_12BaseGeometry_14intersection(((struct __pyx_obj_8_geoslib_BaseGeometry *)__pyx_v_self), ((struct __pyx_obj_8_geoslib_BaseGeometry *)__pyx_v_geom)); /* function exit code */ @@ -2723,12 +3075,8 @@ __Pyx_RefNannyDeclarations GEOSGeom *__pyx_t_1; PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; + int __pyx_t_3; int __pyx_t_4; - int __pyx_t_5; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; __Pyx_RefNannySetupContext("intersection", 0); /* "_geoslib.pyx":282 @@ -2786,7 +3134,7 @@ * p = Polygon(b) * pout = [p] */ - __pyx_t_2 = __pyx_f_8_geoslib__get_coords(__pyx_v_g3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_f_8_geoslib__get_coords(__pyx_v_g3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 287, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_b = __pyx_t_2; __pyx_t_2 = 0; @@ -2798,16 +3146,10 @@ * pout = [p] * elif typeid == GEOS_LINESTRING: */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_8_geoslib_Polygon), __pyx_v_b); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 288, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_v_b); - __Pyx_GIVEREF(__pyx_v_b); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_b); - __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8_geoslib_Polygon), __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_p = ((struct __pyx_obj_8_geoslib_BaseGeometry *)__pyx_t_3); - __pyx_t_3 = 0; + __pyx_v_p = ((struct __pyx_obj_8_geoslib_BaseGeometry *)__pyx_t_2); + __pyx_t_2 = 0; /* "_geoslib.pyx":289 * b = _get_coords(g3) @@ -2816,13 +3158,13 @@ * elif typeid == GEOS_LINESTRING: * b = _get_coords(g3) */ - __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 289, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_p)); __Pyx_GIVEREF(((PyObject *)__pyx_v_p)); - PyList_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_p)); - __pyx_v_pout = ((PyObject*)__pyx_t_3); - __pyx_t_3 = 0; + PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_p)); + __pyx_v_pout = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; /* "_geoslib.pyx":286 * g3 = GEOSIntersection(g1, g2) @@ -2849,10 +3191,10 @@ * p = LineString(b) * pout = [p] */ - __pyx_t_3 = __pyx_f_8_geoslib__get_coords(__pyx_v_g3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_v_b = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_t_2 = __pyx_f_8_geoslib__get_coords(__pyx_v_g3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 291, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_b = __pyx_t_2; + __pyx_t_2 = 0; /* "_geoslib.pyx":292 * elif typeid == GEOS_LINESTRING: @@ -2861,14 +3203,8 @@ * pout = [p] * elif typeid == GEOS_MULTIPOLYGON: */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_b); - __Pyx_GIVEREF(__pyx_v_b); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_b); - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8_geoslib_LineString), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_8_geoslib_LineString), __pyx_v_b); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 292, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_p = ((struct __pyx_obj_8_geoslib_BaseGeometry *)__pyx_t_2); __pyx_t_2 = 0; @@ -2879,7 +3215,7 @@ * elif typeid == GEOS_MULTIPOLYGON: * numgeoms = GEOSGetNumGeometries(g3) */ - __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 293, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_p)); __Pyx_GIVEREF(((PyObject *)__pyx_v_p)); @@ -2921,7 +3257,7 @@ * for i from 0 <= i < numgeoms: * gout = GEOSGetGeometryN(g3, i) */ - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 296, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_pout = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; @@ -2933,8 +3269,8 @@ * gout = GEOSGetGeometryN(g3, i) * b = _get_coords(gout) */ - __pyx_t_4 = __pyx_v_numgeoms; - for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_4; __pyx_v_i++) { + __pyx_t_3 = __pyx_v_numgeoms; + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) { /* "_geoslib.pyx":298 * pout = [] @@ -2952,7 +3288,7 @@ * p = Polygon(b) * pout.append(p) */ - __pyx_t_2 = __pyx_f_8_geoslib__get_coords(__pyx_v_gout); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_f_8_geoslib__get_coords(__pyx_v_gout); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 299, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_XDECREF_SET(__pyx_v_b, __pyx_t_2); __pyx_t_2 = 0; @@ -2964,16 +3300,10 @@ * pout.append(p) * elif typeid == GEOS_MULTILINESTRING: */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_8_geoslib_Polygon), __pyx_v_b); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 300, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_v_b); - __Pyx_GIVEREF(__pyx_v_b); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_b); - __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8_geoslib_Polygon), __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF_SET(__pyx_v_p, ((struct __pyx_obj_8_geoslib_BaseGeometry *)__pyx_t_3)); - __pyx_t_3 = 0; + __Pyx_XDECREF_SET(__pyx_v_p, ((struct __pyx_obj_8_geoslib_BaseGeometry *)__pyx_t_2)); + __pyx_t_2 = 0; /* "_geoslib.pyx":301 * b = _get_coords(gout) @@ -2982,7 +3312,7 @@ * elif typeid == GEOS_MULTILINESTRING: * numgeoms = GEOSGetNumGeometries(g3) */ - __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_pout, ((PyObject *)__pyx_v_p)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_pout, ((PyObject *)__pyx_v_p)); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 301, __pyx_L1_error) } /* "_geoslib.pyx":294 @@ -3019,10 +3349,10 @@ * for i from 0 <= i < numgeoms: * gout = GEOSGetGeometryN(g3, i) */ - __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_v_pout = ((PyObject*)__pyx_t_3); - __pyx_t_3 = 0; + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 304, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_pout = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; /* "_geoslib.pyx":305 * numgeoms = GEOSGetNumGeometries(g3) @@ -3031,8 +3361,8 @@ * gout = GEOSGetGeometryN(g3, i) * b = _get_coords(gout) */ - __pyx_t_4 = __pyx_v_numgeoms; - for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_4; __pyx_v_i++) { + __pyx_t_3 = __pyx_v_numgeoms; + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) { /* "_geoslib.pyx":306 * pout = [] @@ -3050,10 +3380,10 @@ * p = LineString(b) * pout.append(p) */ - __pyx_t_3 = __pyx_f_8_geoslib__get_coords(__pyx_v_gout); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_XDECREF_SET(__pyx_v_b, __pyx_t_3); - __pyx_t_3 = 0; + __pyx_t_2 = __pyx_f_8_geoslib__get_coords(__pyx_v_gout); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 307, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_XDECREF_SET(__pyx_v_b, __pyx_t_2); + __pyx_t_2 = 0; /* "_geoslib.pyx":308 * gout = GEOSGetGeometryN(g3, i) @@ -3062,14 +3392,8 @@ * pout.append(p) * else: */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_b); - __Pyx_GIVEREF(__pyx_v_b); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_b); - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8_geoslib_LineString), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_8_geoslib_LineString), __pyx_v_b); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 308, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF_SET(__pyx_v_p, ((struct __pyx_obj_8_geoslib_BaseGeometry *)__pyx_t_2)); __pyx_t_2 = 0; @@ -3080,7 +3404,7 @@ * else: * #type = PyBytes_FromString(GEOSGeomType(g3)) */ - __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_pout, ((PyObject *)__pyx_v_p)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_pout, ((PyObject *)__pyx_v_p)); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 309, __pyx_L1_error) } /* "_geoslib.pyx":302 @@ -3110,7 +3434,7 @@ * return pout */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 314, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; @@ -3150,7 +3474,6 @@ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("_geoslib.BaseGeometry.intersection", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -3187,9 +3510,6 @@ PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_coords", 0); /* "_geoslib.pyx":319 @@ -3200,7 +3520,7 @@ * def __dealloc__(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_8_geoslib__get_coords(__pyx_v_self->_geom); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __pyx_f_8_geoslib__get_coords(__pyx_v_self->_geom); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 319, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3297,9 +3617,6 @@ PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__reduce__", 0); /* "_geoslib.pyx":327 @@ -3310,14 +3627,14 @@ * cdef class Polygon(BaseGeometry): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 327, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 327, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_self->boundary); __Pyx_GIVEREF(__pyx_v_self->boundary); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self->boundary); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 327, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); @@ -3457,9 +3774,6 @@ static int __pyx_pw_8_geoslib_7Polygon_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_8_geoslib_7Polygon_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_b = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); @@ -3471,17 +3785,18 @@ const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_b)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_b)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 331, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { goto __pyx_L5_argtuple_error; @@ -3492,13 +3807,13 @@ } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 331, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("_geoslib.Polygon.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_b), __pyx_ptype_8_geoslib_ndarray, 1, "b", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_b), __pyx_ptype_8_geoslib_ndarray, 1, "b", 0))) __PYX_ERR(0, 331, __pyx_L1_error) __pyx_r = __pyx_pf_8_geoslib_7Polygon___init__(((struct __pyx_obj_8_geoslib_Polygon *)__pyx_v_self), __pyx_v_b); /* function exit code */ @@ -3527,13 +3842,10 @@ PyObject *__pyx_t_4 = NULL; unsigned int __pyx_t_5; int __pyx_t_6; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__init__", 0); __Pyx_INCREF((PyObject *)__pyx_v_b); - /* "_geoslib.pyx":340 + /* "_geoslib.pyx":342 * # make sure data is contiguous. * # if not, make a local copy. * if not PyArray_ISCONTIGUOUS(b): # <<<<<<<<<<<<<< @@ -3543,17 +3855,17 @@ __pyx_t_1 = ((!(PyArray_ISCONTIGUOUS(__pyx_v_b) != 0)) != 0); if (__pyx_t_1) { - /* "_geoslib.pyx":341 + /* "_geoslib.pyx":343 * # if not, make a local copy. * if not PyArray_ISCONTIGUOUS(b): * b = b.copy() # <<<<<<<<<<<<<< * * m = b.shape[0] */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_b), __pyx_n_s_copy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_b), __pyx_n_s_copy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 343, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) { + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); @@ -3563,18 +3875,18 @@ } } if (__pyx_t_4) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 343, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else { - __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 343, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_8_geoslib_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_8_geoslib_ndarray))))) __PYX_ERR(0, 343, __pyx_L1_error) __Pyx_DECREF_SET(__pyx_v_b, ((PyArrayObject *)__pyx_t_2)); __pyx_t_2 = 0; - /* "_geoslib.pyx":340 + /* "_geoslib.pyx":342 * # make sure data is contiguous. * # if not, make a local copy. * if not PyArray_ISCONTIGUOUS(b): # <<<<<<<<<<<<<< @@ -3583,76 +3895,82 @@ */ } - /* "_geoslib.pyx":343 + /* "_geoslib.pyx":345 * b = b.copy() * * m = b.shape[0] # <<<<<<<<<<<<<< * * # Add closing coordinates to sequence? */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_b), __pyx_n_s_shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_b), __pyx_n_s_shape); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 345, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 345, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_5 = __Pyx_PyInt_As_unsigned_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyInt_As_unsigned_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 345, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_m = __pyx_t_5; - /* "_geoslib.pyx":346 + /* "_geoslib.pyx":348 * * # Add closing coordinates to sequence? - * if b[-1,0] != b[0,0] or b[-1,1] != b[0,1]: # <<<<<<<<<<<<<< + * if m > 0 and (b[-1,0] != b[0,0] or b[-1,1] != b[0,1]): # <<<<<<<<<<<<<< * M = m + 1 * else: */ - __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_b), __pyx_tuple_); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_t_6 = ((__pyx_v_m > 0) != 0); + if (__pyx_t_6) { + } else { + __pyx_t_1 = __pyx_t_6; + goto __pyx_L5_bool_binop_done; + } + __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_b), __pyx_tuple_); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 348, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_v_b), __pyx_tuple__2); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_b), __pyx_tuple__2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 348, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_t_2, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_t_2, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 348, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 348, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (!__pyx_t_6) { } else { __pyx_t_1 = __pyx_t_6; goto __pyx_L5_bool_binop_done; } - __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_b), __pyx_tuple__3); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_b), __pyx_tuple__3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 348, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_v_b), __pyx_tuple__4); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_b), __pyx_tuple__4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 348, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_RichCompare(__pyx_t_4, __pyx_t_2, Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_t_4, __pyx_t_2, Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 348, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 348, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_1 = __pyx_t_6; __pyx_L5_bool_binop_done:; if (__pyx_t_1) { - /* "_geoslib.pyx":347 + /* "_geoslib.pyx":349 * # Add closing coordinates to sequence? - * if b[-1,0] != b[0,0] or b[-1,1] != b[0,1]: + * if m > 0 and (b[-1,0] != b[0,0] or b[-1,1] != b[0,1]): * M = m + 1 # <<<<<<<<<<<<<< * else: * M = m */ __pyx_v_M = (__pyx_v_m + 1); - /* "_geoslib.pyx":346 + /* "_geoslib.pyx":348 * * # Add closing coordinates to sequence? - * if b[-1,0] != b[0,0] or b[-1,1] != b[0,1]: # <<<<<<<<<<<<<< + * if m > 0 and (b[-1,0] != b[0,0] or b[-1,1] != b[0,1]): # <<<<<<<<<<<<<< * M = m + 1 * else: */ goto __pyx_L4; } - /* "_geoslib.pyx":349 + /* "_geoslib.pyx":351 * M = m + 1 * else: * M = m # <<<<<<<<<<<<<< @@ -3664,7 +3982,7 @@ } __pyx_L4:; - /* "_geoslib.pyx":350 + /* "_geoslib.pyx":352 * else: * M = m * self._npts = M # <<<<<<<<<<<<<< @@ -3673,7 +3991,7 @@ */ __pyx_v_self->__pyx_base._npts = __pyx_v_M; - /* "_geoslib.pyx":353 + /* "_geoslib.pyx":355 * * # Create a coordinate sequence * cs = GEOSCoordSeq_create(M, 2) # <<<<<<<<<<<<<< @@ -3682,7 +4000,7 @@ */ __pyx_v_cs = GEOSCoordSeq_create(__pyx_v_M, 2); - /* "_geoslib.pyx":356 + /* "_geoslib.pyx":358 * * # add to coordinate sequence * bbuffer = b.data # <<<<<<<<<<<<<< @@ -3691,7 +4009,7 @@ */ __pyx_v_bbuffer = ((double *)__pyx_v_b->data); - /* "_geoslib.pyx":357 + /* "_geoslib.pyx":359 * # add to coordinate sequence * bbuffer = b.data * for i from 0 <= i < m: # <<<<<<<<<<<<<< @@ -3701,7 +4019,7 @@ __pyx_t_5 = __pyx_v_m; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_5; __pyx_v_i++) { - /* "_geoslib.pyx":358 + /* "_geoslib.pyx":360 * bbuffer = b.data * for i from 0 <= i < m: * dx = bbuffer[2*i] # <<<<<<<<<<<<<< @@ -3710,7 +4028,7 @@ */ __pyx_v_dx = (__pyx_v_bbuffer[(2 * __pyx_v_i)]); - /* "_geoslib.pyx":359 + /* "_geoslib.pyx":361 * for i from 0 <= i < m: * dx = bbuffer[2*i] * dy = bbuffer[2*i+1] # <<<<<<<<<<<<<< @@ -3719,26 +4037,26 @@ */ __pyx_v_dy = (__pyx_v_bbuffer[((2 * __pyx_v_i) + 1)]); - /* "_geoslib.pyx":362 + /* "_geoslib.pyx":364 * # Because of a bug in the GEOS C API, * # always set X before Y * GEOSCoordSeq_setX(cs, i, dx) # <<<<<<<<<<<<<< * GEOSCoordSeq_setY(cs, i, dy) * */ - GEOSCoordSeq_setX(__pyx_v_cs, __pyx_v_i, __pyx_v_dx); + (void)(GEOSCoordSeq_setX(__pyx_v_cs, __pyx_v_i, __pyx_v_dx)); - /* "_geoslib.pyx":363 + /* "_geoslib.pyx":365 * # always set X before Y * GEOSCoordSeq_setX(cs, i, dx) * GEOSCoordSeq_setY(cs, i, dy) # <<<<<<<<<<<<<< * * # Add closing coordinates to sequence? */ - GEOSCoordSeq_setY(__pyx_v_cs, __pyx_v_i, __pyx_v_dy); + (void)(GEOSCoordSeq_setY(__pyx_v_cs, __pyx_v_i, __pyx_v_dy)); } - /* "_geoslib.pyx":366 + /* "_geoslib.pyx":368 * * # Add closing coordinates to sequence? * if M > m: # <<<<<<<<<<<<<< @@ -3748,7 +4066,7 @@ __pyx_t_1 = ((__pyx_v_M > __pyx_v_m) != 0); if (__pyx_t_1) { - /* "_geoslib.pyx":367 + /* "_geoslib.pyx":369 * # Add closing coordinates to sequence? * if M > m: * dx = bbuffer[0] # <<<<<<<<<<<<<< @@ -3757,7 +4075,7 @@ */ __pyx_v_dx = (__pyx_v_bbuffer[0]); - /* "_geoslib.pyx":368 + /* "_geoslib.pyx":370 * if M > m: * dx = bbuffer[0] * dy = bbuffer[1] # <<<<<<<<<<<<<< @@ -3766,25 +4084,25 @@ */ __pyx_v_dy = (__pyx_v_bbuffer[1]); - /* "_geoslib.pyx":369 + /* "_geoslib.pyx":371 * dx = bbuffer[0] * dy = bbuffer[1] * GEOSCoordSeq_setX(cs, M-1, dx) # <<<<<<<<<<<<<< * GEOSCoordSeq_setY(cs, M-1, dy) * */ - GEOSCoordSeq_setX(__pyx_v_cs, (__pyx_v_M - 1), __pyx_v_dx); + (void)(GEOSCoordSeq_setX(__pyx_v_cs, (__pyx_v_M - 1), __pyx_v_dx)); - /* "_geoslib.pyx":370 + /* "_geoslib.pyx":372 * dy = bbuffer[1] * GEOSCoordSeq_setX(cs, M-1, dx) * GEOSCoordSeq_setY(cs, M-1, dy) # <<<<<<<<<<<<<< * * # create LinearRing */ - GEOSCoordSeq_setY(__pyx_v_cs, (__pyx_v_M - 1), __pyx_v_dy); + (void)(GEOSCoordSeq_setY(__pyx_v_cs, (__pyx_v_M - 1), __pyx_v_dy)); - /* "_geoslib.pyx":366 + /* "_geoslib.pyx":368 * * # Add closing coordinates to sequence? * if M > m: # <<<<<<<<<<<<<< @@ -3793,7 +4111,7 @@ */ } - /* "_geoslib.pyx":373 + /* "_geoslib.pyx":375 * * # create LinearRing * lr = GEOSGeom_createLinearRing(cs) # <<<<<<<<<<<<<< @@ -3802,7 +4120,7 @@ */ __pyx_v_lr = GEOSGeom_createLinearRing(__pyx_v_cs); - /* "_geoslib.pyx":376 + /* "_geoslib.pyx":378 * * # create Polygon from LinearRing (assuming no holes) * self._geom = GEOSGeom_createPolygon(lr,NULL,0) # <<<<<<<<<<<<<< @@ -3811,7 +4129,7 @@ */ __pyx_v_self->__pyx_base._geom = GEOSGeom_createPolygon(__pyx_v_lr, NULL, 0); - /* "_geoslib.pyx":377 + /* "_geoslib.pyx":379 * # create Polygon from LinearRing (assuming no holes) * self._geom = GEOSGeom_createPolygon(lr,NULL,0) * self.boundary = b # <<<<<<<<<<<<<< @@ -3847,7 +4165,7 @@ return __pyx_r; } -/* "_geoslib.pyx":380 +/* "_geoslib.pyx":382 * * * def area(self): # <<<<<<<<<<<<<< @@ -3873,21 +4191,18 @@ PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; __Pyx_RefNannySetupContext("area", 0); - /* "_geoslib.pyx":382 + /* "_geoslib.pyx":384 * def area(self): * cdef double area * GEOSArea(self._geom, &area) # <<<<<<<<<<<<<< * return area * */ - GEOSArea(__pyx_v_self->__pyx_base._geom, (&__pyx_v_area)); + (void)(GEOSArea(__pyx_v_self->__pyx_base._geom, (&__pyx_v_area))); - /* "_geoslib.pyx":383 + /* "_geoslib.pyx":385 * cdef double area * GEOSArea(self._geom, &area) * return area # <<<<<<<<<<<<<< @@ -3895,13 +4210,13 @@ * cdef class LineString(BaseGeometry): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(__pyx_v_area); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_area); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 385, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "_geoslib.pyx":380 + /* "_geoslib.pyx":382 * * * def area(self): # <<<<<<<<<<<<<< @@ -3920,7 +4235,7 @@ return __pyx_r; } -/* "_geoslib.pyx":386 +/* "_geoslib.pyx":388 * * cdef class LineString(BaseGeometry): * def __init__(self, ndarray b): # <<<<<<<<<<<<<< @@ -3932,9 +4247,6 @@ static int __pyx_pw_8_geoslib_10LineString_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_8_geoslib_10LineString_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_b = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); @@ -3946,17 +4258,18 @@ const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_b)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_b)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 388, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { goto __pyx_L5_argtuple_error; @@ -3967,13 +4280,13 @@ } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 388, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("_geoslib.LineString.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_b), __pyx_ptype_8_geoslib_ndarray, 1, "b", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_b), __pyx_ptype_8_geoslib_ndarray, 1, "b", 0))) __PYX_ERR(0, 388, __pyx_L1_error) __pyx_r = __pyx_pf_8_geoslib_10LineString___init__(((struct __pyx_obj_8_geoslib_LineString *)__pyx_v_self), __pyx_v_b); /* function exit code */ @@ -3999,13 +4312,10 @@ PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; int __pyx_t_5; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__init__", 0); __Pyx_INCREF((PyObject *)__pyx_v_b); - /* "_geoslib.pyx":394 + /* "_geoslib.pyx":396 * # make sure data is contiguous. * # if not, make a local copy. * if not PyArray_ISCONTIGUOUS(b): # <<<<<<<<<<<<<< @@ -4015,17 +4325,17 @@ __pyx_t_1 = ((!(PyArray_ISCONTIGUOUS(__pyx_v_b) != 0)) != 0); if (__pyx_t_1) { - /* "_geoslib.pyx":395 + /* "_geoslib.pyx":397 * # if not, make a local copy. * if not PyArray_ISCONTIGUOUS(b): * b = b.copy() # <<<<<<<<<<<<<< * * M = b.shape[0] */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_b), __pyx_n_s_copy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_b), __pyx_n_s_copy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 397, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) { + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); @@ -4035,18 +4345,18 @@ } } if (__pyx_t_4) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 397, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else { - __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 397, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_8_geoslib_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_8_geoslib_ndarray))))) __PYX_ERR(0, 397, __pyx_L1_error) __Pyx_DECREF_SET(__pyx_v_b, ((PyArrayObject *)__pyx_t_2)); __pyx_t_2 = 0; - /* "_geoslib.pyx":394 + /* "_geoslib.pyx":396 * # make sure data is contiguous. * # if not, make a local copy. * if not PyArray_ISCONTIGUOUS(b): # <<<<<<<<<<<<<< @@ -4055,23 +4365,23 @@ */ } - /* "_geoslib.pyx":397 + /* "_geoslib.pyx":399 * b = b.copy() * * M = b.shape[0] # <<<<<<<<<<<<<< * self._npts = M * */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_b), __pyx_n_s_shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_b), __pyx_n_s_shape); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 399, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 399, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 399, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_M = __pyx_t_5; - /* "_geoslib.pyx":398 + /* "_geoslib.pyx":400 * * M = b.shape[0] * self._npts = M # <<<<<<<<<<<<<< @@ -4080,7 +4390,7 @@ */ __pyx_v_self->__pyx_base._npts = __pyx_v_M; - /* "_geoslib.pyx":401 + /* "_geoslib.pyx":403 * * # Create a coordinate sequence * cs = GEOSCoordSeq_create(M, 2) # <<<<<<<<<<<<<< @@ -4089,7 +4399,7 @@ */ __pyx_v_cs = GEOSCoordSeq_create(__pyx_v_M, 2); - /* "_geoslib.pyx":404 + /* "_geoslib.pyx":406 * * # add to coordinate sequence * bbuffer = b.data # <<<<<<<<<<<<<< @@ -4098,7 +4408,7 @@ */ __pyx_v_bbuffer = ((double *)__pyx_v_b->data); - /* "_geoslib.pyx":405 + /* "_geoslib.pyx":407 * # add to coordinate sequence * bbuffer = b.data * for i from 0 <= i < M: # <<<<<<<<<<<<<< @@ -4108,7 +4418,7 @@ __pyx_t_5 = __pyx_v_M; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_5; __pyx_v_i++) { - /* "_geoslib.pyx":406 + /* "_geoslib.pyx":408 * bbuffer = b.data * for i from 0 <= i < M: * dx = bbuffer[2*i] # <<<<<<<<<<<<<< @@ -4117,7 +4427,7 @@ */ __pyx_v_dx = (__pyx_v_bbuffer[(2 * __pyx_v_i)]); - /* "_geoslib.pyx":407 + /* "_geoslib.pyx":409 * for i from 0 <= i < M: * dx = bbuffer[2*i] * dy = bbuffer[2*i+1] # <<<<<<<<<<<<<< @@ -4126,26 +4436,26 @@ */ __pyx_v_dy = (__pyx_v_bbuffer[((2 * __pyx_v_i) + 1)]); - /* "_geoslib.pyx":410 + /* "_geoslib.pyx":412 * # Because of a bug in the GEOS C API, * # always set X before Y * GEOSCoordSeq_setX(cs, i, dx) # <<<<<<<<<<<<<< * GEOSCoordSeq_setY(cs, i, dy) * */ - GEOSCoordSeq_setX(__pyx_v_cs, __pyx_v_i, __pyx_v_dx); + (void)(GEOSCoordSeq_setX(__pyx_v_cs, __pyx_v_i, __pyx_v_dx)); - /* "_geoslib.pyx":411 + /* "_geoslib.pyx":413 * # always set X before Y * GEOSCoordSeq_setX(cs, i, dx) * GEOSCoordSeq_setY(cs, i, dy) # <<<<<<<<<<<<<< * * # create LineString */ - GEOSCoordSeq_setY(__pyx_v_cs, __pyx_v_i, __pyx_v_dy); + (void)(GEOSCoordSeq_setY(__pyx_v_cs, __pyx_v_i, __pyx_v_dy)); } - /* "_geoslib.pyx":414 + /* "_geoslib.pyx":416 * * # create LineString * self._geom = GEOSGeom_createLineString(cs) # <<<<<<<<<<<<<< @@ -4154,7 +4464,7 @@ */ __pyx_v_self->__pyx_base._geom = GEOSGeom_createLineString(__pyx_v_cs); - /* "_geoslib.pyx":415 + /* "_geoslib.pyx":417 * # create LineString * self._geom = GEOSGeom_createLineString(cs) * self.boundary = b # <<<<<<<<<<<<<< @@ -4167,7 +4477,7 @@ __Pyx_DECREF(__pyx_v_self->__pyx_base.boundary); __pyx_v_self->__pyx_base.boundary = ((PyObject *)__pyx_v_b); - /* "_geoslib.pyx":386 + /* "_geoslib.pyx":388 * * cdef class LineString(BaseGeometry): * def __init__(self, ndarray b): # <<<<<<<<<<<<<< @@ -4190,7 +4500,7 @@ return __pyx_r; } -/* "_geoslib.pyx":419 +/* "_geoslib.pyx":421 * cdef class Point(BaseGeometry): * cdef public x,y * def __init__(self, b): # <<<<<<<<<<<<<< @@ -4202,9 +4512,6 @@ static int __pyx_pw_8_geoslib_5Point_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_8_geoslib_5Point_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_b = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); @@ -4216,17 +4523,18 @@ const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_b)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_b)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 421, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { goto __pyx_L5_argtuple_error; @@ -4237,7 +4545,7 @@ } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 421, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("_geoslib.Point.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -4258,12 +4566,9 @@ __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; double __pyx_t_2; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__init__", 0); - /* "_geoslib.pyx":423 + /* "_geoslib.pyx":425 * cdef GEOSCoordSeq *cs * # Create a coordinate sequence * cs = GEOSCoordSeq_create(1, 2) # <<<<<<<<<<<<<< @@ -4272,43 +4577,43 @@ */ __pyx_v_cs = GEOSCoordSeq_create(1, 2); - /* "_geoslib.pyx":424 + /* "_geoslib.pyx":426 * # Create a coordinate sequence * cs = GEOSCoordSeq_create(1, 2) * dx = b[0]; dy = b[1] # <<<<<<<<<<<<<< * GEOSCoordSeq_setX(cs, 0, dx) * GEOSCoordSeq_setY(cs, 0, dy) */ - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_b, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_b, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 426, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 426, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_dx = __pyx_t_2; - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_b, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_b, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 426, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 426, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_dy = __pyx_t_2; - /* "_geoslib.pyx":425 + /* "_geoslib.pyx":427 * cs = GEOSCoordSeq_create(1, 2) * dx = b[0]; dy = b[1] * GEOSCoordSeq_setX(cs, 0, dx) # <<<<<<<<<<<<<< * GEOSCoordSeq_setY(cs, 0, dy) * self._geom = GEOSGeom_createPoint(cs) */ - GEOSCoordSeq_setX(__pyx_v_cs, 0, __pyx_v_dx); + (void)(GEOSCoordSeq_setX(__pyx_v_cs, 0, __pyx_v_dx)); - /* "_geoslib.pyx":426 + /* "_geoslib.pyx":428 * dx = b[0]; dy = b[1] * GEOSCoordSeq_setX(cs, 0, dx) * GEOSCoordSeq_setY(cs, 0, dy) # <<<<<<<<<<<<<< * self._geom = GEOSGeom_createPoint(cs) * self._npts = 1 */ - GEOSCoordSeq_setY(__pyx_v_cs, 0, __pyx_v_dy); + (void)(GEOSCoordSeq_setY(__pyx_v_cs, 0, __pyx_v_dy)); - /* "_geoslib.pyx":427 + /* "_geoslib.pyx":429 * GEOSCoordSeq_setX(cs, 0, dx) * GEOSCoordSeq_setY(cs, 0, dy) * self._geom = GEOSGeom_createPoint(cs) # <<<<<<<<<<<<<< @@ -4317,7 +4622,7 @@ */ __pyx_v_self->__pyx_base._geom = GEOSGeom_createPoint(__pyx_v_cs); - /* "_geoslib.pyx":428 + /* "_geoslib.pyx":430 * GEOSCoordSeq_setY(cs, 0, dy) * self._geom = GEOSGeom_createPoint(cs) * self._npts = 1 # <<<<<<<<<<<<<< @@ -4326,7 +4631,7 @@ */ __pyx_v_self->__pyx_base._npts = 1; - /* "_geoslib.pyx":429 + /* "_geoslib.pyx":431 * self._geom = GEOSGeom_createPoint(cs) * self._npts = 1 * self.boundary = b # <<<<<<<<<<<<<< @@ -4339,7 +4644,7 @@ __Pyx_DECREF(__pyx_v_self->__pyx_base.boundary); __pyx_v_self->__pyx_base.boundary = __pyx_v_b; - /* "_geoslib.pyx":419 + /* "_geoslib.pyx":421 * cdef class Point(BaseGeometry): * cdef public x,y * def __init__(self, b): # <<<<<<<<<<<<<< @@ -4359,7 +4664,7 @@ return __pyx_r; } -/* "_geoslib.pyx":418 +/* "_geoslib.pyx":420 * * cdef class Point(BaseGeometry): * cdef public x,y # <<<<<<<<<<<<<< @@ -4541,7 +4846,7 @@ return __pyx_r; } -/* "_geoslib.pyx":431 +/* "_geoslib.pyx":433 * self.boundary = b * * cdef _get_coords(GEOSGeom *geom): # <<<<<<<<<<<<<< @@ -4566,15 +4871,12 @@ PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; - Py_ssize_t __pyx_t_7; + int __pyx_t_7; PyObject *__pyx_t_8 = NULL; unsigned int __pyx_t_9; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_get_coords", 0); - /* "_geoslib.pyx":438 + /* "_geoslib.pyx":440 * cdef ndarray b * cdef double *bbuffer * if GEOSGeomTypeId(geom) == GEOS_POLYGON: # <<<<<<<<<<<<<< @@ -4584,7 +4886,7 @@ __pyx_t_1 = ((GEOSGeomTypeId(__pyx_v_geom) == GEOS_POLYGON) != 0); if (__pyx_t_1) { - /* "_geoslib.pyx":439 + /* "_geoslib.pyx":441 * cdef double *bbuffer * if GEOSGeomTypeId(geom) == GEOS_POLYGON: * lr = GEOSGetExteriorRing(geom) # <<<<<<<<<<<<<< @@ -4593,7 +4895,7 @@ */ __pyx_v_lr = GEOSGetExteriorRing(__pyx_v_geom); - /* "_geoslib.pyx":440 + /* "_geoslib.pyx":442 * if GEOSGeomTypeId(geom) == GEOS_POLYGON: * lr = GEOSGetExteriorRing(geom) * cs = GEOSGeom_getCoordSeq(lr) # <<<<<<<<<<<<<< @@ -4602,7 +4904,7 @@ */ __pyx_v_cs = GEOSGeom_getCoordSeq(__pyx_v_lr); - /* "_geoslib.pyx":438 + /* "_geoslib.pyx":440 * cdef ndarray b * cdef double *bbuffer * if GEOSGeomTypeId(geom) == GEOS_POLYGON: # <<<<<<<<<<<<<< @@ -4612,7 +4914,7 @@ goto __pyx_L3; } - /* "_geoslib.pyx":442 + /* "_geoslib.pyx":444 * cs = GEOSGeom_getCoordSeq(lr) * else: * cs = GEOSGeom_getCoordSeq(geom) # <<<<<<<<<<<<<< @@ -4624,30 +4926,30 @@ } __pyx_L3:; - /* "_geoslib.pyx":443 + /* "_geoslib.pyx":445 * else: * cs = GEOSGeom_getCoordSeq(geom) * GEOSCoordSeq_getSize(cs, &M) # <<<<<<<<<<<<<< * b = numpy.empty((M,2), numpy.float64) * bbuffer = b.data */ - GEOSCoordSeq_getSize(__pyx_v_cs, (&__pyx_v_M)); + (void)(GEOSCoordSeq_getSize(__pyx_v_cs, (&__pyx_v_M))); - /* "_geoslib.pyx":444 + /* "_geoslib.pyx":446 * cs = GEOSGeom_getCoordSeq(geom) * GEOSCoordSeq_getSize(cs, &M) * b = numpy.empty((M,2), numpy.float64) # <<<<<<<<<<<<<< * bbuffer = b.data * for i from 0 <= i < M: */ - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 446, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_empty); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_empty); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 446, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyInt_From_unsigned_int(__pyx_v_M); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_From_unsigned_int(__pyx_v_M); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 446, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 446, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); @@ -4655,14 +4957,14 @@ __Pyx_GIVEREF(__pyx_int_2); PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_int_2); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 446, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_float64); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_float64); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 446, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; __pyx_t_7 = 0; - if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) { + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); @@ -4672,26 +4974,48 @@ __pyx_t_7 = 1; } } - __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - if (__pyx_t_3) { - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3); __pyx_t_3 = NULL; - } - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_6); - __pyx_t_5 = 0; - __pyx_t_6 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_4)) { + PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_5, __pyx_t_6}; + __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 446, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { + PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_5, __pyx_t_6}; + __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 446, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } else + #endif + { + __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 446, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + if (__pyx_t_3) { + __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3); __pyx_t_3 = NULL; + } + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_6); + __pyx_t_5 = 0; + __pyx_t_6 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 446, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_8_geoslib_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_8_geoslib_ndarray))))) __PYX_ERR(0, 446, __pyx_L1_error) __pyx_v_b = ((PyArrayObject *)__pyx_t_2); __pyx_t_2 = 0; - /* "_geoslib.pyx":445 + /* "_geoslib.pyx":447 * GEOSCoordSeq_getSize(cs, &M) * b = numpy.empty((M,2), numpy.float64) * bbuffer = b.data # <<<<<<<<<<<<<< @@ -4700,7 +5024,7 @@ */ __pyx_v_bbuffer = ((double *)__pyx_v_b->data); - /* "_geoslib.pyx":446 + /* "_geoslib.pyx":448 * b = numpy.empty((M,2), numpy.float64) * bbuffer = b.data * for i from 0 <= i < M: # <<<<<<<<<<<<<< @@ -4710,25 +5034,25 @@ __pyx_t_9 = __pyx_v_M; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_9; __pyx_v_i++) { - /* "_geoslib.pyx":447 + /* "_geoslib.pyx":449 * bbuffer = b.data * for i from 0 <= i < M: * GEOSCoordSeq_getX(cs, i, &dx) # <<<<<<<<<<<<<< * GEOSCoordSeq_getY(cs, i, &dy) * bbuffer[2*i] = dx */ - GEOSCoordSeq_getX(__pyx_v_cs, __pyx_v_i, (&__pyx_v_dx)); + (void)(GEOSCoordSeq_getX(__pyx_v_cs, __pyx_v_i, (&__pyx_v_dx))); - /* "_geoslib.pyx":448 + /* "_geoslib.pyx":450 * for i from 0 <= i < M: * GEOSCoordSeq_getX(cs, i, &dx) * GEOSCoordSeq_getY(cs, i, &dy) # <<<<<<<<<<<<<< * bbuffer[2*i] = dx * bbuffer[2*i+1] = dy */ - GEOSCoordSeq_getY(__pyx_v_cs, __pyx_v_i, (&__pyx_v_dy)); + (void)(GEOSCoordSeq_getY(__pyx_v_cs, __pyx_v_i, (&__pyx_v_dy))); - /* "_geoslib.pyx":449 + /* "_geoslib.pyx":451 * GEOSCoordSeq_getX(cs, i, &dx) * GEOSCoordSeq_getY(cs, i, &dy) * bbuffer[2*i] = dx # <<<<<<<<<<<<<< @@ -4737,7 +5061,7 @@ */ (__pyx_v_bbuffer[(2 * __pyx_v_i)]) = __pyx_v_dx; - /* "_geoslib.pyx":450 + /* "_geoslib.pyx":452 * GEOSCoordSeq_getY(cs, i, &dy) * bbuffer[2*i] = dx * bbuffer[2*i+1] = dy # <<<<<<<<<<<<<< @@ -4746,7 +5070,7 @@ (__pyx_v_bbuffer[((2 * __pyx_v_i) + 1)]) = __pyx_v_dy; } - /* "_geoslib.pyx":451 + /* "_geoslib.pyx":453 * bbuffer[2*i] = dx * bbuffer[2*i+1] = dy * return b # <<<<<<<<<<<<<< @@ -4756,7 +5080,7 @@ __pyx_r = ((PyObject *)__pyx_v_b); goto __pyx_L0; - /* "_geoslib.pyx":431 + /* "_geoslib.pyx":433 * self.boundary = b * * cdef _get_coords(GEOSGeom *geom): # <<<<<<<<<<<<<< @@ -4797,8 +5121,8 @@ static void __pyx_tp_dealloc_8_geoslib_BaseGeometry(PyObject *o) { struct __pyx_obj_8_geoslib_BaseGeometry *p = (struct __pyx_obj_8_geoslib_BaseGeometry *)o; - #if PY_VERSION_HEX >= 0x030400a1 - if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { + #if CYTHON_USE_TP_FINALIZE + if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { if (PyObject_CallFinalizerFromDealloc(o)) return; } #endif @@ -4861,7 +5185,7 @@ }; static struct PyGetSetDef __pyx_getsets_8_geoslib_BaseGeometry[] = { - {(char *)"boundary", __pyx_getprop_8_geoslib_12BaseGeometry_boundary, __pyx_setprop_8_geoslib_12BaseGeometry_boundary, 0, 0}, + {(char *)"boundary", __pyx_getprop_8_geoslib_12BaseGeometry_boundary, __pyx_setprop_8_geoslib_12BaseGeometry_boundary, (char *)0, 0}, {0, 0, 0, 0, 0} }; @@ -5072,8 +5396,8 @@ static void __pyx_tp_dealloc_8_geoslib_Point(PyObject *o) { struct __pyx_obj_8_geoslib_Point *p = (struct __pyx_obj_8_geoslib_Point *)o; - #if PY_VERSION_HEX >= 0x030400a1 - if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { + #if CYTHON_USE_TP_FINALIZE + if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { if (PyObject_CallFinalizerFromDealloc(o)) return; } #endif @@ -5141,8 +5465,8 @@ }; static struct PyGetSetDef __pyx_getsets_8_geoslib_Point[] = { - {(char *)"x", __pyx_getprop_8_geoslib_5Point_x, __pyx_setprop_8_geoslib_5Point_x, 0, 0}, - {(char *)"y", __pyx_getprop_8_geoslib_5Point_y, __pyx_setprop_8_geoslib_5Point_y, 0, 0}, + {(char *)"x", __pyx_getprop_8_geoslib_5Point_x, __pyx_setprop_8_geoslib_5Point_x, (char *)0, 0}, + {(char *)"y", __pyx_getprop_8_geoslib_5Point_y, __pyx_setprop_8_geoslib_5Point_y, (char *)0, 0}, {0, 0, 0, 0, 0} }; @@ -5209,17 +5533,31 @@ }; #if PY_MAJOR_VERSION >= 3 +#if CYTHON_PEP489_MULTI_PHASE_INIT +static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ +static int __pyx_pymod_exec__geoslib(PyObject* module); /*proto*/ +static PyModuleDef_Slot __pyx_moduledef_slots[] = { + {Py_mod_create, (void*)__pyx_pymod_create}, + {Py_mod_exec, (void*)__pyx_pymod_exec__geoslib}, + {0, NULL} +}; +#endif + static struct PyModuleDef __pyx_moduledef = { - #if PY_VERSION_HEX < 0x03020000 - { PyObject_HEAD_INIT(NULL) NULL, 0, NULL }, - #else PyModuleDef_HEAD_INIT, - #endif "_geoslib", 0, /* m_doc */ + #if CYTHON_PEP489_MULTI_PHASE_INIT + 0, /* m_size */ + #else -1, /* m_size */ + #endif __pyx_methods /* m_methods */, + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_moduledef_slots, /* m_slots */ + #else NULL, /* m_reload */ + #endif NULL, /* m_traverse */ NULL, /* m_clear */ NULL /* m_free */ @@ -5232,6 +5570,7 @@ {&__pyx_n_s_NotImplementedError, __pyx_k_NotImplementedError, sizeof(__pyx_k_NotImplementedError), 0, 0, 1, 1}, {&__pyx_n_s_b, __pyx_k_b, sizeof(__pyx_k_b), 0, 0, 1, 1}, {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1}, + {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, {&__pyx_n_s_copy, __pyx_k_copy, sizeof(__pyx_k_copy), 0, 0, 1, 1}, {&__pyx_n_s_empty, __pyx_k_empty, sizeof(__pyx_k_empty), 0, 0, 1, 1}, {&__pyx_n_s_float64, __pyx_k_float64, sizeof(__pyx_k_float64), 0, 0, 1, 1}, @@ -5251,7 +5590,7 @@ {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_NotImplementedError = __Pyx_GetBuiltinName(__pyx_n_s_NotImplementedError); if (!__pyx_builtin_NotImplementedError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_NotImplementedError = __Pyx_GetBuiltinName(__pyx_n_s_NotImplementedError); if (!__pyx_builtin_NotImplementedError) __PYX_ERR(0, 195, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; @@ -5261,23 +5600,23 @@ __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "_geoslib.pyx":346 + /* "_geoslib.pyx":348 * * # Add closing coordinates to sequence? - * if b[-1,0] != b[0,0] or b[-1,1] != b[0,1]: # <<<<<<<<<<<<<< + * if m > 0 and (b[-1,0] != b[0,0] or b[-1,1] != b[0,1]): # <<<<<<<<<<<<<< * M = m + 1 * else: */ - __pyx_tuple_ = PyTuple_Pack(2, __pyx_int_neg_1, __pyx_int_0); if (unlikely(!__pyx_tuple_)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple_ = PyTuple_Pack(2, __pyx_int_neg_1, __pyx_int_0); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 348, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple_); __Pyx_GIVEREF(__pyx_tuple_); - __pyx_tuple__2 = PyTuple_Pack(2, __pyx_int_0, __pyx_int_0); if (unlikely(!__pyx_tuple__2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__2 = PyTuple_Pack(2, __pyx_int_0, __pyx_int_0); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 348, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__2); __Pyx_GIVEREF(__pyx_tuple__2); - __pyx_tuple__3 = PyTuple_Pack(2, __pyx_int_neg_1, __pyx_int_1); if (unlikely(!__pyx_tuple__3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__3 = PyTuple_Pack(2, __pyx_int_neg_1, __pyx_int_1); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 348, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__3); __Pyx_GIVEREF(__pyx_tuple__3); - __pyx_tuple__4 = PyTuple_Pack(2, __pyx_int_0, __pyx_int_1); if (unlikely(!__pyx_tuple__4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__4 = PyTuple_Pack(2, __pyx_int_0, __pyx_int_1); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 348, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__4); __Pyx_GIVEREF(__pyx_tuple__4); __Pyx_RefNannyFinishContext(); @@ -5288,56 +5627,227 @@ } static int __Pyx_InitGlobals(void) { - if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error) + return 0; + __pyx_L1_error:; + return -1; +} + +static int __Pyx_modinit_global_init_code(void); /*proto*/ +static int __Pyx_modinit_variable_export_code(void); /*proto*/ +static int __Pyx_modinit_function_export_code(void); /*proto*/ +static int __Pyx_modinit_type_init_code(void); /*proto*/ +static int __Pyx_modinit_type_import_code(void); /*proto*/ +static int __Pyx_modinit_variable_import_code(void); /*proto*/ +static int __Pyx_modinit_function_import_code(void); /*proto*/ + +static int __Pyx_modinit_global_init_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0); + /*--- Global init code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_variable_export_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0); + /*--- Variable export code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_function_export_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0); + /*--- Function export code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_type_init_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); + /*--- Type init code ---*/ + __pyx_ptype_8_geoslib_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_8_geoslib_ndarray)) __PYX_ERR(0, 13, __pyx_L1_error) + if (PyType_Ready(&__pyx_type_8_geoslib_BaseGeometry) < 0) __PYX_ERR(0, 138, __pyx_L1_error) + __pyx_type_8_geoslib_BaseGeometry.tp_print = 0; + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_8_geoslib_BaseGeometry.tp_dictoffset && __pyx_type_8_geoslib_BaseGeometry.tp_getattro == PyObject_GenericGetAttr)) { + __pyx_type_8_geoslib_BaseGeometry.tp_getattro = __Pyx_PyObject_GenericGetAttr; + } + if (PyObject_SetAttrString(__pyx_m, "BaseGeometry", (PyObject *)&__pyx_type_8_geoslib_BaseGeometry) < 0) __PYX_ERR(0, 138, __pyx_L1_error) + __pyx_ptype_8_geoslib_BaseGeometry = &__pyx_type_8_geoslib_BaseGeometry; + __pyx_type_8_geoslib_Polygon.tp_base = __pyx_ptype_8_geoslib_BaseGeometry; + if (PyType_Ready(&__pyx_type_8_geoslib_Polygon) < 0) __PYX_ERR(0, 329, __pyx_L1_error) + __pyx_type_8_geoslib_Polygon.tp_print = 0; + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_8_geoslib_Polygon.tp_dictoffset && __pyx_type_8_geoslib_Polygon.tp_getattro == PyObject_GenericGetAttr)) { + __pyx_type_8_geoslib_Polygon.tp_getattro = __Pyx_PyObject_GenericGetAttr; + } + if (PyObject_SetAttrString(__pyx_m, "Polygon", (PyObject *)&__pyx_type_8_geoslib_Polygon) < 0) __PYX_ERR(0, 329, __pyx_L1_error) + __pyx_ptype_8_geoslib_Polygon = &__pyx_type_8_geoslib_Polygon; + __pyx_type_8_geoslib_LineString.tp_base = __pyx_ptype_8_geoslib_BaseGeometry; + if (PyType_Ready(&__pyx_type_8_geoslib_LineString) < 0) __PYX_ERR(0, 387, __pyx_L1_error) + __pyx_type_8_geoslib_LineString.tp_print = 0; + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_8_geoslib_LineString.tp_dictoffset && __pyx_type_8_geoslib_LineString.tp_getattro == PyObject_GenericGetAttr)) { + __pyx_type_8_geoslib_LineString.tp_getattro = __Pyx_PyObject_GenericGetAttr; + } + if (PyObject_SetAttrString(__pyx_m, "LineString", (PyObject *)&__pyx_type_8_geoslib_LineString) < 0) __PYX_ERR(0, 387, __pyx_L1_error) + __pyx_ptype_8_geoslib_LineString = &__pyx_type_8_geoslib_LineString; + __pyx_type_8_geoslib_Point.tp_base = __pyx_ptype_8_geoslib_BaseGeometry; + if (PyType_Ready(&__pyx_type_8_geoslib_Point) < 0) __PYX_ERR(0, 419, __pyx_L1_error) + __pyx_type_8_geoslib_Point.tp_print = 0; + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_8_geoslib_Point.tp_dictoffset && __pyx_type_8_geoslib_Point.tp_getattro == PyObject_GenericGetAttr)) { + __pyx_type_8_geoslib_Point.tp_getattro = __Pyx_PyObject_GenericGetAttr; + } + if (PyObject_SetAttrString(__pyx_m, "Point", (PyObject *)&__pyx_type_8_geoslib_Point) < 0) __PYX_ERR(0, 419, __pyx_L1_error) + __pyx_ptype_8_geoslib_Point = &__pyx_type_8_geoslib_Point; + __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); return -1; } +static int __Pyx_modinit_type_import_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); + /*--- Type import code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_variable_import_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0); + /*--- Variable import code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_function_import_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0); + /*--- Function import code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + + +#if PY_MAJOR_VERSION < 3 +#ifdef CYTHON_NO_PYINIT_EXPORT +#define __Pyx_PyMODINIT_FUNC void +#else +#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC +#endif +#else +#ifdef CYTHON_NO_PYINIT_EXPORT +#define __Pyx_PyMODINIT_FUNC PyObject * +#else +#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC +#endif +#endif +#ifndef CYTHON_SMALL_CODE +#if defined(__clang__) + #define CYTHON_SMALL_CODE +#elif defined(__GNUC__) && (!(defined(__cplusplus)) || (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 4))) + #define CYTHON_SMALL_CODE __attribute__((optimize("Os"))) +#else + #define CYTHON_SMALL_CODE +#endif +#endif + + #if PY_MAJOR_VERSION < 3 -PyMODINIT_FUNC init_geoslib(void); /*proto*/ -PyMODINIT_FUNC init_geoslib(void) +__Pyx_PyMODINIT_FUNC init_geoslib(void) CYTHON_SMALL_CODE; /*proto*/ +__Pyx_PyMODINIT_FUNC init_geoslib(void) #else -PyMODINIT_FUNC PyInit__geoslib(void); /*proto*/ -PyMODINIT_FUNC PyInit__geoslib(void) +__Pyx_PyMODINIT_FUNC PyInit__geoslib(void) CYTHON_SMALL_CODE; /*proto*/ +__Pyx_PyMODINIT_FUNC PyInit__geoslib(void) +#if CYTHON_PEP489_MULTI_PHASE_INIT +{ + return PyModuleDef_Init(&__pyx_moduledef); +} +static int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name) { + PyObject *value = PyObject_GetAttrString(spec, from_name); + int result = 0; + if (likely(value)) { + result = PyDict_SetItemString(moddict, to_name, value); + Py_DECREF(value); + } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) { + PyErr_Clear(); + } else { + result = -1; + } + return result; +} +static PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) { + PyObject *module = NULL, *moddict, *modname; + if (__pyx_m) + return __Pyx_NewRef(__pyx_m); + modname = PyObject_GetAttrString(spec, "name"); + if (unlikely(!modname)) goto bad; + module = PyModule_NewObject(modname); + Py_DECREF(modname); + if (unlikely(!module)) goto bad; + moddict = PyModule_GetDict(module); + if (unlikely(!moddict)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__") < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__") < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__") < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__") < 0)) goto bad; + return module; +bad: + Py_XDECREF(module); + return NULL; +} + + +static int __pyx_pymod_exec__geoslib(PyObject *__pyx_pyinit_module) +#endif #endif { PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; __Pyx_RefNannyDeclarations - #if CYTHON_REFNANNY - __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); - if (!__Pyx_RefNanny) { - PyErr_Clear(); - __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); - if (!__Pyx_RefNanny) - Py_FatalError("failed to import 'refnanny' module"); - } + #if CYTHON_PEP489_MULTI_PHASE_INIT + if (__pyx_m && __pyx_m == __pyx_pyinit_module) return 0; + #elif PY_MAJOR_VERSION >= 3 + if (__pyx_m) return __Pyx_NewRef(__pyx_m); #endif - __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit__geoslib(void)", 0); - if (__Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if CYTHON_REFNANNY +__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); +if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); +} +#endif + __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit__geoslib(void)", 0); + if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) #ifdef __Pyx_CyFunction_USED - if (__pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_FusedFunction_USED - if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_Coroutine_USED - if (__pyx_Coroutine_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_Generator_USED - if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_AsyncGen_USED + if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_StopAsyncIteration_USED - if (__pyx_StopAsyncIteration_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ @@ -5347,69 +5857,56 @@ #endif #endif /*--- Module creation code ---*/ + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_m = __pyx_pyinit_module; + Py_INCREF(__pyx_m); + #else #if PY_MAJOR_VERSION < 3 __pyx_m = Py_InitModule4("_geoslib", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif - if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) Py_INCREF(__pyx_d); - __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) #if CYTHON_COMPILING_IN_PYPY Py_INCREF(__pyx_b); #endif - if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error); /*--- Initialize various global constants etc. ---*/ - if (__Pyx_InitGlobals() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) - if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif if (__pyx_module_is_main__geoslib) { - if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) } #if PY_MAJOR_VERSION >= 3 { - PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) if (!PyDict_GetItemString(modules, "_geoslib")) { - if (unlikely(PyDict_SetItemString(modules, "_geoslib", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(PyDict_SetItemString(modules, "_geoslib", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error) } } #endif /*--- Builtin init code ---*/ - if (__Pyx_InitCachedBuiltins() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) /*--- Constants init code ---*/ - if (__Pyx_InitCachedConstants() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /*--- Global init code ---*/ - /*--- Variable export code ---*/ - /*--- Function export code ---*/ - /*--- Type init code ---*/ - __pyx_ptype_8_geoslib_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_8_geoslib_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyType_Ready(&__pyx_type_8_geoslib_BaseGeometry) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_type_8_geoslib_BaseGeometry.tp_print = 0; - if (PyObject_SetAttrString(__pyx_m, "BaseGeometry", (PyObject *)&__pyx_type_8_geoslib_BaseGeometry) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_8_geoslib_BaseGeometry = &__pyx_type_8_geoslib_BaseGeometry; - __pyx_type_8_geoslib_Polygon.tp_base = __pyx_ptype_8_geoslib_BaseGeometry; - if (PyType_Ready(&__pyx_type_8_geoslib_Polygon) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_type_8_geoslib_Polygon.tp_print = 0; - if (PyObject_SetAttrString(__pyx_m, "Polygon", (PyObject *)&__pyx_type_8_geoslib_Polygon) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_8_geoslib_Polygon = &__pyx_type_8_geoslib_Polygon; - __pyx_type_8_geoslib_LineString.tp_base = __pyx_ptype_8_geoslib_BaseGeometry; - if (PyType_Ready(&__pyx_type_8_geoslib_LineString) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_type_8_geoslib_LineString.tp_print = 0; - if (PyObject_SetAttrString(__pyx_m, "LineString", (PyObject *)&__pyx_type_8_geoslib_LineString) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_8_geoslib_LineString = &__pyx_type_8_geoslib_LineString; - __pyx_type_8_geoslib_Point.tp_base = __pyx_ptype_8_geoslib_BaseGeometry; - if (PyType_Ready(&__pyx_type_8_geoslib_Point) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_type_8_geoslib_Point.tp_print = 0; - if (PyObject_SetAttrString(__pyx_m, "Point", (PyObject *)&__pyx_type_8_geoslib_Point) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_8_geoslib_Point = &__pyx_type_8_geoslib_Point; - /*--- Type import code ---*/ - /*--- Variable import code ---*/ - /*--- Function import code ---*/ + if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Global type/function init code ---*/ + (void)__Pyx_modinit_global_init_code(); + (void)__Pyx_modinit_variable_export_code(); + (void)__Pyx_modinit_function_export_code(); + if (unlikely(__Pyx_modinit_type_init_code() != 0)) goto __pyx_L1_error; + (void)__Pyx_modinit_type_import_code(); + (void)__Pyx_modinit_variable_import_code(); + (void)__Pyx_modinit_function_import_code(); /*--- Execution code ---*/ #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) - if (__Pyx_patch_abc() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif /* "_geoslib.pyx":1 @@ -5417,9 +5914,9 @@ * import numpy * */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_sys, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_Import(__pyx_n_s_sys, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_sys, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s_sys, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "_geoslib.pyx":2 @@ -5428,9 +5925,9 @@ * * __version__ = "0.3" */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_numpy, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s_numpy, __pyx_t_1) < 0) __PYX_ERR(0, 2, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "_geoslib.pyx":4 @@ -5440,7 +5937,7 @@ * * # need some python C API functions for strings. */ - if (PyDict_SetItem(__pyx_d, __pyx_n_s_version, __pyx_kp_s_0_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s_version, __pyx_kp_s_0_3) < 0) __PYX_ERR(0, 4, __pyx_L1_error) /* "_geoslib.pyx":26 * @@ -5458,9 +5955,9 @@ * __geos_major_version__ = GEOS_VERSION_MAJOR * #if __geos_version__ != "2.2.3-CAPI-1.1.1": */ - __pyx_t_1 = __pyx_f_8_geoslib_geos_version(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __pyx_f_8_geoslib_geos_version(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 130, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_geos_version, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s_geos_version, __pyx_t_1) < 0) __PYX_ERR(0, 130, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "_geoslib.pyx":131 @@ -5470,9 +5967,9 @@ * #if __geos_version__ != "2.2.3-CAPI-1.1.1": * # raise ValueError('version 2.2.3 of the geos library is required') */ - __pyx_t_1 = __Pyx_PyInt_From_int(GEOS_VERSION_MAJOR); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_From_int(GEOS_VERSION_MAJOR); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 131, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_geos_major_version, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s_geos_major_version, __pyx_t_1) < 0) __PYX_ERR(0, 131, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "_geoslib.pyx":136 @@ -5489,9 +5986,9 @@ * import numpy * */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /*--- Wrapped vars code ---*/ @@ -5501,7 +5998,7 @@ __Pyx_XDECREF(__pyx_t_1); if (__pyx_m) { if (__pyx_d) { - __Pyx_AddTraceback("init _geoslib", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("init _geoslib", 0, __pyx_lineno, __pyx_filename); } Py_DECREF(__pyx_m); __pyx_m = 0; } else if (!PyErr_Occurred()) { @@ -5509,14 +6006,17 @@ } __pyx_L0:; __Pyx_RefNannyFinishContext(); - #if PY_MAJOR_VERSION < 3 - return; - #else + #if CYTHON_PEP489_MULTI_PHASE_INIT + return (__pyx_m != NULL) ? 0 : -1; + #elif PY_MAJOR_VERSION >= 3 return __pyx_m; + #else + return; #endif } /* --- Runtime support code --- */ +/* Refnanny */ #if CYTHON_REFNANNY static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { PyObject *m = NULL, *p = NULL; @@ -5533,6 +6033,21 @@ } #endif +/* PyObjectGetAttrStr */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro)) + return tp->tp_getattro(obj, attr_name); +#if PY_MAJOR_VERSION < 3 + if (likely(tp->tp_getattr)) + return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); +#endif + return PyObject_GetAttr(obj, attr_name); +} +#endif + +/* GetBuiltinName */ static PyObject *__Pyx_GetBuiltinName(PyObject *name) { PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); if (unlikely(!result)) { @@ -5546,42 +6061,54 @@ return result; } -static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) { -#if CYTHON_COMPILING_IN_CPYTHON - PyThreadState *tstate = PyThreadState_GET(); +/* SaveResetException */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { + #if PY_VERSION_HEX >= 0x030700A3 + *type = tstate->exc_state.exc_type; + *value = tstate->exc_state.exc_value; + *tb = tstate->exc_state.exc_traceback; + #else *type = tstate->exc_type; *value = tstate->exc_value; *tb = tstate->exc_traceback; + #endif Py_XINCREF(*type); Py_XINCREF(*value); Py_XINCREF(*tb); -#else - PyErr_GetExcInfo(type, value, tb); -#endif } -static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) { -#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; - PyThreadState *tstate = PyThreadState_GET(); + #if PY_VERSION_HEX >= 0x030700A3 + tmp_type = tstate->exc_state.exc_type; + tmp_value = tstate->exc_state.exc_value; + tmp_tb = tstate->exc_state.exc_traceback; + tstate->exc_state.exc_type = type; + tstate->exc_state.exc_value = value; + tstate->exc_state.exc_traceback = tb; + #else tmp_type = tstate->exc_type; tmp_value = tstate->exc_value; tmp_tb = tstate->exc_traceback; tstate->exc_type = type; tstate->exc_value = value; tstate->exc_traceback = tb; + #endif Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); -#else - PyErr_SetExcInfo(type, value, tb); -#endif } +#endif +/* GetException */ +#if CYTHON_FAST_THREAD_STATE +static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { +#else static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) { +#endif PyObject *local_type, *local_value, *local_tb; -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_FAST_THREAD_STATE PyObject *tmp_type, *tmp_value, *tmp_tb; - PyThreadState *tstate = PyThreadState_GET(); local_type = tstate->curexc_type; local_value = tstate->curexc_value; local_tb = tstate->curexc_traceback; @@ -5592,7 +6119,7 @@ PyErr_Fetch(&local_type, &local_value, &local_tb); #endif PyErr_NormalizeException(&local_type, &local_value, &local_tb); -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_FAST_THREAD_STATE if (unlikely(tstate->curexc_type)) #else if (unlikely(PyErr_Occurred())) @@ -5610,13 +6137,22 @@ *type = local_type; *value = local_value; *tb = local_tb; -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_FAST_THREAD_STATE + #if PY_VERSION_HEX >= 0x030700A3 + tmp_type = tstate->exc_state.exc_type; + tmp_value = tstate->exc_state.exc_value; + tmp_tb = tstate->exc_state.exc_traceback; + tstate->exc_state.exc_type = local_type; + tstate->exc_state.exc_value = local_value; + tstate->exc_state.exc_traceback = local_tb; + #else tmp_type = tstate->exc_type; tmp_value = tstate->exc_value; tmp_tb = tstate->exc_traceback; tstate->exc_type = local_type; tstate->exc_value = local_value; tstate->exc_traceback = local_tb; + #endif Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); @@ -5634,13 +6170,23 @@ return -1; } -static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) { +/* GetModuleGlobalName */ + static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) { PyObject *result; -#if CYTHON_COMPILING_IN_CPYTHON +#if !CYTHON_AVOID_BORROWED_REFS +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 + result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash); + if (likely(result)) { + Py_INCREF(result); + } else if (unlikely(PyErr_Occurred())) { + result = NULL; + } else { +#else result = PyDict_GetItem(__pyx_d, name); if (likely(result)) { Py_INCREF(result); } else { +#endif #else result = PyObject_GetItem(__pyx_d, name); if (!result) { @@ -5651,7 +6197,151 @@ return result; } -#if CYTHON_COMPILING_IN_CPYTHON +/* PyCFunctionFastCall */ + #if CYTHON_FAST_PYCCALL +static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) { + PyCFunctionObject *func = (PyCFunctionObject*)func_obj; + PyCFunction meth = PyCFunction_GET_FUNCTION(func); + PyObject *self = PyCFunction_GET_SELF(func); + int flags = PyCFunction_GET_FLAGS(func); + assert(PyCFunction_Check(func)); + assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS))); + assert(nargs >= 0); + assert(nargs == 0 || args != NULL); + /* _PyCFunction_FastCallDict() must not be called with an exception set, + because it may clear it (directly or indirectly) and so the + caller loses its exception */ + assert(!PyErr_Occurred()); + if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) { + return (*((__Pyx_PyCFunctionFastWithKeywords)meth)) (self, args, nargs, NULL); + } else { + return (*((__Pyx_PyCFunctionFast)meth)) (self, args, nargs); + } +} +#endif + +/* PyFunctionFastCall */ + #if CYTHON_FAST_PYCALL +#include "frameobject.h" +static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, + PyObject *globals) { + PyFrameObject *f; + PyThreadState *tstate = __Pyx_PyThreadState_Current; + PyObject **fastlocals; + Py_ssize_t i; + PyObject *result; + assert(globals != NULL); + /* XXX Perhaps we should create a specialized + PyFrame_New() that doesn't take locals, but does + take builtins without sanity checking them. + */ + assert(tstate != NULL); + f = PyFrame_New(tstate, co, globals, NULL); + if (f == NULL) { + return NULL; + } + fastlocals = f->f_localsplus; + for (i = 0; i < na; i++) { + Py_INCREF(*args); + fastlocals[i] = *args++; + } + result = PyEval_EvalFrameEx(f,0); + ++tstate->recursion_depth; + Py_DECREF(f); + --tstate->recursion_depth; + return result; +} +#if 1 || PY_VERSION_HEX < 0x030600B1 +static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs) { + PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); + PyObject *globals = PyFunction_GET_GLOBALS(func); + PyObject *argdefs = PyFunction_GET_DEFAULTS(func); + PyObject *closure; +#if PY_MAJOR_VERSION >= 3 + PyObject *kwdefs; +#endif + PyObject *kwtuple, **k; + PyObject **d; + Py_ssize_t nd; + Py_ssize_t nk; + PyObject *result; + assert(kwargs == NULL || PyDict_Check(kwargs)); + nk = kwargs ? PyDict_Size(kwargs) : 0; + if (Py_EnterRecursiveCall((char*)" while calling a Python object")) { + return NULL; + } + if ( +#if PY_MAJOR_VERSION >= 3 + co->co_kwonlyargcount == 0 && +#endif + likely(kwargs == NULL || nk == 0) && + co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) { + if (argdefs == NULL && co->co_argcount == nargs) { + result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals); + goto done; + } + else if (nargs == 0 && argdefs != NULL + && co->co_argcount == Py_SIZE(argdefs)) { + /* function called with no arguments, but all parameters have + a default value: use default values as arguments .*/ + args = &PyTuple_GET_ITEM(argdefs, 0); + result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals); + goto done; + } + } + if (kwargs != NULL) { + Py_ssize_t pos, i; + kwtuple = PyTuple_New(2 * nk); + if (kwtuple == NULL) { + result = NULL; + goto done; + } + k = &PyTuple_GET_ITEM(kwtuple, 0); + pos = i = 0; + while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) { + Py_INCREF(k[i]); + Py_INCREF(k[i+1]); + i += 2; + } + nk = i / 2; + } + else { + kwtuple = NULL; + k = NULL; + } + closure = PyFunction_GET_CLOSURE(func); +#if PY_MAJOR_VERSION >= 3 + kwdefs = PyFunction_GET_KW_DEFAULTS(func); +#endif + if (argdefs != NULL) { + d = &PyTuple_GET_ITEM(argdefs, 0); + nd = Py_SIZE(argdefs); + } + else { + d = NULL; + nd = 0; + } +#if PY_MAJOR_VERSION >= 3 + result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL, + args, nargs, + k, (int)nk, + d, (int)nd, kwdefs, closure); +#else + result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL, + args, nargs, + k, (int)nk, + d, (int)nd, closure); +#endif + Py_XDECREF(kwtuple); +done: + Py_LeaveRecursiveCall(); + return result; +} +#endif +#endif + +/* PyObjectCall */ + #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { PyObject *result; ternaryfunc call = func->ob_type->tp_call; @@ -5670,7 +6360,8 @@ } #endif -#if CYTHON_COMPILING_IN_CPYTHON +/* PyObjectCallMethO */ + #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { PyObject *self, *result; PyCFunction cfunc; @@ -5689,7 +6380,8 @@ } #endif -#if CYTHON_COMPILING_IN_CPYTHON +/* PyObjectCallOneArg */ + #if CYTHON_COMPILING_IN_CPYTHON static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { PyObject *result; PyObject *args = PyTuple_New(1); @@ -5701,13 +6393,18 @@ return result; } static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { -#ifdef __Pyx_CyFunction_USED - if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) { -#else - if (likely(PyCFunction_Check(func))) { +#if CYTHON_FAST_PYCALL + if (PyFunction_Check(func)) { + return __Pyx_PyFunction_FastCall(func, &arg, 1); + } #endif + if (likely(PyCFunction_Check(func))) { if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { return __Pyx_PyObject_CallMethO(func, arg); +#if CYTHON_FAST_PYCCALL + } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) { + return __Pyx_PyCFunction_FastCall(func, &arg, 1); +#endif } } return __Pyx__PyObject_CallOneArg(func, arg); @@ -5723,10 +6420,10 @@ } #endif -static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { -#if CYTHON_COMPILING_IN_CPYTHON +/* PyErrFetchRestore */ + #if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; - PyThreadState *tstate = PyThreadState_GET(); tmp_type = tstate->curexc_type; tmp_value = tstate->curexc_value; tmp_tb = tstate->curexc_traceback; @@ -5736,34 +6433,33 @@ Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); -#else - PyErr_Restore(type, value, tb); -#endif } -static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { -#if CYTHON_COMPILING_IN_CPYTHON - PyThreadState *tstate = PyThreadState_GET(); +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { *type = tstate->curexc_type; *value = tstate->curexc_value; *tb = tstate->curexc_traceback; tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; -#else - PyErr_Fetch(type, value, tb); -#endif } +#endif -static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno, +/* WriteUnraisableException */ + static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno, CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename, int full_traceback, CYTHON_UNUSED int nogil) { PyObject *old_exc, *old_val, *old_tb; PyObject *ctx; + __Pyx_PyThreadState_declare #ifdef WITH_THREAD PyGILState_STATE state; if (nogil) state = PyGILState_Ensure(); +#ifdef _MSC_VER + else state = (PyGILState_STATE)-1; #endif +#endif + __Pyx_PyThreadState_assign __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); if (full_traceback) { Py_XINCREF(old_exc); @@ -5790,35 +6486,32 @@ #endif } -static void __Pyx_RaiseArgumentTypeInvalid(const char* name, PyObject *obj, PyTypeObject *type) { - PyErr_Format(PyExc_TypeError, - "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)", - name, type->tp_name, Py_TYPE(obj)->tp_name); -} -static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, - const char *name, int exact) +/* ArgTypeTest */ + static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact) { if (unlikely(!type)) { PyErr_SetString(PyExc_SystemError, "Missing type object"); return 0; } - if (none_allowed && obj == Py_None) return 1; else if (exact) { - if (likely(Py_TYPE(obj) == type)) return 1; #if PY_MAJOR_VERSION == 2 - else if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; + if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; #endif } else { - if (likely(PyObject_TypeCheck(obj, type))) return 1; + if (likely(__Pyx_TypeCheck(obj, type))) return 1; } - __Pyx_RaiseArgumentTypeInvalid(name, obj, type); + PyErr_Format(PyExc_TypeError, + "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)", + name, type->tp_name, Py_TYPE(obj)->tp_name); return 0; } -#if PY_MAJOR_VERSION < 3 +/* RaiseException */ + #if PY_MAJOR_VERSION < 3 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, CYTHON_UNUSED PyObject *cause) { + __Pyx_PyThreadState_declare Py_XINCREF(type); if (!value || value == Py_None) value = NULL; @@ -5857,6 +6550,7 @@ goto raise_error; } } + __Pyx_PyThreadState_assign __Pyx_ErrRestore(type, value, tb); return; raise_error: @@ -5929,11 +6623,7 @@ "raise: exception class must be a subclass of BaseException"); goto bad; } -#if PY_VERSION_HEX >= 0x03030000 if (cause) { -#else - if (cause && cause != Py_None) { -#endif PyObject *fixed_cause; if (cause == Py_None) { fixed_cause = NULL; @@ -5961,7 +6651,7 @@ PyErr_Restore(tmp_type, tmp_value, tb); Py_XDECREF(tmp_tb); #else - PyThreadState *tstate = PyThreadState_GET(); + PyThreadState *tstate = __Pyx_PyThreadState_Current; PyObject* tmp_tb = tstate->curexc_traceback; if (tb != tmp_tb) { Py_INCREF(tb); @@ -5976,7 +6666,8 @@ } #endif -static void __Pyx_RaiseDoubleKeywordsError( +/* RaiseDoubleKeywords */ + static void __Pyx_RaiseDoubleKeywordsError( const char* func_name, PyObject* kw_name) { @@ -5989,7 +6680,8 @@ #endif } -static int __Pyx_ParseOptionalKeywords( +/* ParseKeywords */ + static int __Pyx_ParseOptionalKeywords( PyObject *kwds, PyObject **argnames[], PyObject *kwds2, @@ -6090,7 +6782,8 @@ return -1; } -static void __Pyx_RaiseArgtupleInvalid( +/* RaiseArgTupleInvalid */ + static void __Pyx_RaiseArgtupleInvalid( const char* func_name, int exact, Py_ssize_t num_min, @@ -6115,10 +6808,16 @@ (num_expected == 1) ? "" : "s", num_found); } -#if CYTHON_COMPILING_IN_CPYTHON +/* PyObjectCallNoArg */ + #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { +#if CYTHON_FAST_PYCALL + if (PyFunction_Check(func)) { + return __Pyx_PyFunction_FastCall(func, NULL, 0); + } +#endif #ifdef __Pyx_CyFunction_USED - if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) { + if (likely(PyCFunction_Check(func) || __Pyx_TypeCheck(func, __pyx_CyFunctionType))) { #else if (likely(PyCFunction_Check(func))) { #endif @@ -6130,19 +6829,21 @@ } #endif -static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { +/* ExtTypeTest */ + static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { if (unlikely(!type)) { PyErr_SetString(PyExc_SystemError, "Missing type object"); return 0; } - if (likely(PyObject_TypeCheck(obj, type))) + if (likely(__Pyx_TypeCheck(obj, type))) return 1; PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", Py_TYPE(obj)->tp_name, type->tp_name); return 0; } -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { +/* GetItemInt */ + static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { PyObject *r; if (!j) return NULL; r = PyObject_GetItem(o, j); @@ -6152,10 +6853,13 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) { -#if CYTHON_COMPILING_IN_CPYTHON - if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o); - if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { - PyObject *r = PyList_GET_ITEM(o, i); +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + Py_ssize_t wrapped_i = i; + if (wraparound & unlikely(i < 0)) { + wrapped_i += PyList_GET_SIZE(o); + } + if ((!boundscheck) || likely((0 <= wrapped_i) & (wrapped_i < PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, wrapped_i); Py_INCREF(r); return r; } @@ -6167,10 +6871,13 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) { -#if CYTHON_COMPILING_IN_CPYTHON - if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o); - if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { - PyObject *r = PyTuple_GET_ITEM(o, i); +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + Py_ssize_t wrapped_i = i; + if (wraparound & unlikely(i < 0)) { + wrapped_i += PyTuple_GET_SIZE(o); + } + if ((!boundscheck) || likely((0 <= wrapped_i) & (wrapped_i < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, wrapped_i); Py_INCREF(r); return r; } @@ -6182,7 +6889,7 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) { -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS if (is_list || PyList_CheckExact(o)) { Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) { @@ -6206,10 +6913,9 @@ if (likely(l >= 0)) { i += l; } else { - if (PyErr_ExceptionMatches(PyExc_OverflowError)) - PyErr_Clear(); - else + if (!PyErr_ExceptionMatches(PyExc_OverflowError)) return NULL; + PyErr_Clear(); } } return m->sq_item(o, i); @@ -6223,13 +6929,93 @@ return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); } -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { +/* ObjectGetItem */ + #if CYTHON_USE_TYPE_SLOTS +static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) { + PyObject *runerr; + Py_ssize_t key_value; + PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence; + if (unlikely(!(m && m->sq_item))) { + PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name); + return NULL; + } + key_value = __Pyx_PyIndex_AsSsize_t(index); + if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) { + return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1); + } + if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) { + PyErr_Clear(); + PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name); + } + return NULL; +} +static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) { + PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping; + if (likely(m && m->mp_subscript)) { + return m->mp_subscript(obj, key); + } + return __Pyx_PyObject_GetIndex(obj, key); +} +#endif + +/* PyObject_GenericGetAttrNoDict */ + #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 +static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) { + PyErr_Format(PyExc_AttributeError, +#if PY_MAJOR_VERSION >= 3 + "'%.50s' object has no attribute '%U'", + tp->tp_name, attr_name); +#else + "'%.50s' object has no attribute '%.400s'", + tp->tp_name, PyString_AS_STRING(attr_name)); +#endif + return NULL; +} +static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) { + PyObject *descr; + PyTypeObject *tp = Py_TYPE(obj); + if (unlikely(!PyString_Check(attr_name))) { + return PyObject_GenericGetAttr(obj, attr_name); + } + assert(!tp->tp_dictoffset); + descr = _PyType_Lookup(tp, attr_name); + if (unlikely(!descr)) { + return __Pyx_RaiseGenericGetAttributeError(tp, attr_name); + } + Py_INCREF(descr); + #if PY_MAJOR_VERSION < 3 + if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS))) + #endif + { + descrgetfunc f = Py_TYPE(descr)->tp_descr_get; + if (unlikely(f)) { + PyObject *res = f(descr, obj, (PyObject *)tp); + Py_DECREF(descr); + return res; + } + } + return descr; +} +#endif + +/* PyObject_GenericGetAttr */ + #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 +static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) { + if (unlikely(Py_TYPE(obj)->tp_dictoffset)) { + return PyObject_GenericGetAttr(obj, attr_name); + } + return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name); +} +#endif + +/* Import */ + static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { PyObject *empty_list = 0; PyObject *module = 0; PyObject *global_dict = 0; PyObject *empty_dict = 0; PyObject *list; - #if PY_VERSION_HEX < 0x03030000 + #if PY_MAJOR_VERSION < 3 PyObject *py_import; py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); if (!py_import) @@ -6253,17 +7039,8 @@ #if PY_MAJOR_VERSION >= 3 if (level == -1) { if (strchr(__Pyx_MODULE_NAME, '.')) { - #if PY_VERSION_HEX < 0x03030000 - PyObject *py_level = PyInt_FromLong(1); - if (!py_level) - goto bad; - module = PyObject_CallFunctionObjArgs(py_import, - name, global_dict, empty_dict, list, py_level, NULL); - Py_DECREF(py_level); - #else module = PyImport_ImportModuleLevelObject( name, global_dict, empty_dict, list, 1); - #endif if (!module) { if (!PyErr_ExceptionMatches(PyExc_ImportError)) goto bad; @@ -6274,7 +7051,7 @@ } #endif if (!module) { - #if PY_VERSION_HEX < 0x03030000 + #if PY_MAJOR_VERSION < 3 PyObject *py_level = PyInt_FromLong(level); if (!py_level) goto bad; @@ -6288,7 +7065,7 @@ } } bad: - #if PY_VERSION_HEX < 0x03030000 + #if PY_MAJOR_VERSION < 3 Py_XDECREF(py_import); #endif Py_XDECREF(empty_list); @@ -6296,7 +7073,48 @@ return module; } -static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { +/* CLineInTraceback */ + #ifndef CYTHON_CLINE_IN_TRACEBACK +static int __Pyx_CLineForTraceback(CYTHON_UNUSED PyThreadState *tstate, int c_line) { + PyObject *use_cline; + PyObject *ptype, *pvalue, *ptraceback; +#if CYTHON_COMPILING_IN_CPYTHON + PyObject **cython_runtime_dict; +#endif + if (unlikely(!__pyx_cython_runtime)) { + return c_line; + } + __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); +#if CYTHON_COMPILING_IN_CPYTHON + cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime); + if (likely(cython_runtime_dict)) { + use_cline = __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback); + } else +#endif + { + PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback); + if (use_cline_obj) { + use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True; + Py_DECREF(use_cline_obj); + } else { + PyErr_Clear(); + use_cline = NULL; + } + } + if (!use_cline) { + c_line = 0; + PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False); + } + else if (PyObject_Not(use_cline) != 0) { + c_line = 0; + } + __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); + return c_line; +} +#endif + +/* CodeObjectCache */ + static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { int start = 0, mid = 0, end = count - 1; if (end >= 0 && code_line > entries[end].code_line) { return count; @@ -6375,7 +7193,8 @@ Py_INCREF(code_object); } -#include "compile.h" +/* AddTraceback */ + #include "compile.h" #include "frameobject.h" #include "traceback.h" static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( @@ -6434,28 +7253,33 @@ int py_line, const char *filename) { PyCodeObject *py_code = 0; PyFrameObject *py_frame = 0; - py_code = __pyx_find_code_object(c_line ? c_line : py_line); + PyThreadState *tstate = __Pyx_PyThreadState_Current; + if (c_line) { + c_line = __Pyx_CLineForTraceback(tstate, c_line); + } + py_code = __pyx_find_code_object(c_line ? -c_line : py_line); if (!py_code) { py_code = __Pyx_CreateCodeObjectForTraceback( funcname, c_line, py_line, filename); if (!py_code) goto bad; - __pyx_insert_code_object(c_line ? c_line : py_line, py_code); + __pyx_insert_code_object(c_line ? -c_line : py_line, py_code); } py_frame = PyFrame_New( - PyThreadState_GET(), /*PyThreadState *tstate,*/ - py_code, /*PyCodeObject *code,*/ - __pyx_d, /*PyObject *globals,*/ - 0 /*PyObject *locals*/ + tstate, /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + __pyx_d, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ ); if (!py_frame) goto bad; - py_frame->f_lineno = py_line; + __Pyx_PyFrame_SetLineNumber(py_frame, py_line); PyTraceBack_Here(py_frame); bad: Py_XDECREF(py_code); Py_XDECREF(py_frame); } -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { +/* CIntToPy */ + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { const int neg_one = (int) -1, const_zero = (int) 0; const int is_unsigned = neg_one > const_zero; if (is_unsigned) { @@ -6463,14 +7287,18 @@ return PyInt_FromLong((long) value); } else if (sizeof(int) <= sizeof(unsigned long)) { return PyLong_FromUnsignedLong((unsigned long) value); +#ifdef HAVE_LONG_LONG } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif } } else { if (sizeof(int) <= sizeof(long)) { return PyInt_FromLong((long) value); +#ifdef HAVE_LONG_LONG } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { return PyLong_FromLongLong((PY_LONG_LONG) value); +#endif } } { @@ -6481,7 +7309,8 @@ } } -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { +/* CIntToPy */ + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { const long neg_one = (long) -1, const_zero = (long) 0; const int is_unsigned = neg_one > const_zero; if (is_unsigned) { @@ -6489,14 +7318,18 @@ return PyInt_FromLong((long) value); } else if (sizeof(long) <= sizeof(unsigned long)) { return PyLong_FromUnsignedLong((unsigned long) value); +#ifdef HAVE_LONG_LONG } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif } } else { if (sizeof(long) <= sizeof(long)) { return PyInt_FromLong((long) value); +#ifdef HAVE_LONG_LONG } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { return PyLong_FromLongLong((PY_LONG_LONG) value); +#endif } } { @@ -6507,7 +7340,8 @@ } } -#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ +/* CIntFromPyVerify */ + #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) @@ -6528,11 +7362,39 @@ return (target_type) value;\ } -#if CYTHON_USE_PYLONG_INTERNALS - #include "longintrepr.h" +/* CIntToPy */ + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_int(unsigned int value) { + const unsigned int neg_one = (unsigned int) -1, const_zero = (unsigned int) 0; + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(unsigned int) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(unsigned int) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(unsigned int) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(unsigned int) <= sizeof(long)) { + return PyInt_FromLong((long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(unsigned int) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); #endif + } + } + { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&value; + return _PyLong_FromByteArray(bytes, sizeof(unsigned int), + little, !is_unsigned); + } +} -static CYTHON_INLINE unsigned int __Pyx_PyInt_As_unsigned_int(PyObject *x) { +/* CIntFromPy */ + static CYTHON_INLINE unsigned int __Pyx_PyInt_As_unsigned_int(PyObject *x) { const unsigned int neg_one = (unsigned int) -1, const_zero = (unsigned int) 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 @@ -6599,15 +7461,17 @@ #endif if (sizeof(unsigned int) <= sizeof(unsigned long)) { __PYX_VERIFY_RETURN_INT_EXC(unsigned int, unsigned long, PyLong_AsUnsignedLong(x)) +#ifdef HAVE_LONG_LONG } else if (sizeof(unsigned int) <= sizeof(unsigned PY_LONG_LONG)) { __PYX_VERIFY_RETURN_INT_EXC(unsigned int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) +#endif } } else { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { case 0: return (unsigned int) 0; - case -1: __PYX_VERIFY_RETURN_INT(unsigned int, sdigit, -(sdigit) digits[0]) + case -1: __PYX_VERIFY_RETURN_INT(unsigned int, sdigit, (sdigit) (-(sdigit)digits[0])) case 1: __PYX_VERIFY_RETURN_INT(unsigned int, digit, +digits[0]) case -2: if (8 * sizeof(unsigned int) - 1 > 1 * PyLong_SHIFT) { @@ -6667,8 +7531,10 @@ #endif if (sizeof(unsigned int) <= sizeof(long)) { __PYX_VERIFY_RETURN_INT_EXC(unsigned int, long, PyLong_AsLong(x)) +#ifdef HAVE_LONG_LONG } else if (sizeof(unsigned int) <= sizeof(PY_LONG_LONG)) { __PYX_VERIFY_RETURN_INT_EXC(unsigned int, PY_LONG_LONG, PyLong_AsLongLong(x)) +#endif } } { @@ -6677,7 +7543,7 @@ "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); #else unsigned int val; - PyObject *v = __Pyx_PyNumber_Int(x); + PyObject *v = __Pyx_PyNumber_IntOrLong(x); #if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; @@ -6700,7 +7566,7 @@ } } else { unsigned int val; - PyObject *tmp = __Pyx_PyNumber_Int(x); + PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); if (!tmp) return (unsigned int) -1; val = __Pyx_PyInt_As_unsigned_int(tmp); Py_DECREF(tmp); @@ -6716,7 +7582,8 @@ return (unsigned int) -1; } -static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { +/* CIntFromPy */ + static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { const int neg_one = (int) -1, const_zero = (int) 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 @@ -6783,15 +7650,17 @@ #endif if (sizeof(int) <= sizeof(unsigned long)) { __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) +#ifdef HAVE_LONG_LONG } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) +#endif } } else { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { case 0: return (int) 0; - case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, -(sdigit) digits[0]) + case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0])) case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0]) case -2: if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) { @@ -6851,8 +7720,10 @@ #endif if (sizeof(int) <= sizeof(long)) { __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) +#ifdef HAVE_LONG_LONG } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) +#endif } } { @@ -6861,7 +7732,7 @@ "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); #else int val; - PyObject *v = __Pyx_PyNumber_Int(x); + PyObject *v = __Pyx_PyNumber_IntOrLong(x); #if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; @@ -6884,7 +7755,7 @@ } } else { int val; - PyObject *tmp = __Pyx_PyNumber_Int(x); + PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); if (!tmp) return (int) -1; val = __Pyx_PyInt_As_int(tmp); Py_DECREF(tmp); @@ -6900,33 +7771,8 @@ return (int) -1; } -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_int(unsigned int value) { - const unsigned int neg_one = (unsigned int) -1, const_zero = (unsigned int) 0; - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(unsigned int) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(unsigned int) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); - } else if (sizeof(unsigned int) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); - } - } else { - if (sizeof(unsigned int) <= sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(unsigned int) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(unsigned int), - little, !is_unsigned); - } -} - -static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { +/* CIntFromPy */ + static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { const long neg_one = (long) -1, const_zero = (long) 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 @@ -6993,15 +7839,17 @@ #endif if (sizeof(long) <= sizeof(unsigned long)) { __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) +#ifdef HAVE_LONG_LONG } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) +#endif } } else { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { case 0: return (long) 0; - case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, -(sdigit) digits[0]) + case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0])) case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0]) case -2: if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) { @@ -7061,8 +7909,10 @@ #endif if (sizeof(long) <= sizeof(long)) { __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) +#ifdef HAVE_LONG_LONG } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) +#endif } } { @@ -7071,7 +7921,7 @@ "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); #else long val; - PyObject *v = __Pyx_PyNumber_Int(x); + PyObject *v = __Pyx_PyNumber_IntOrLong(x); #if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; @@ -7094,7 +7944,7 @@ } } else { long val; - PyObject *tmp = __Pyx_PyNumber_Int(x); + PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); if (!tmp) return (long) -1; val = __Pyx_PyInt_As_long(tmp); Py_DECREF(tmp); @@ -7110,7 +7960,108 @@ return (long) -1; } -static int __Pyx_check_binary_version(void) { +/* FastTypeChecks */ + #if CYTHON_COMPILING_IN_CPYTHON +static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { + while (a) { + a = a->tp_base; + if (a == b) + return 1; + } + return b == &PyBaseObject_Type; +} +static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) { + PyObject *mro; + if (a == b) return 1; + mro = a->tp_mro; + if (likely(mro)) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(mro); + for (i = 0; i < n; i++) { + if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b) + return 1; + } + return 0; + } + return __Pyx_InBases(a, b); +} +#if PY_MAJOR_VERSION == 2 +static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) { + PyObject *exception, *value, *tb; + int res; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&exception, &value, &tb); + res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0; + if (unlikely(res == -1)) { + PyErr_WriteUnraisable(err); + res = 0; + } + if (!res) { + res = PyObject_IsSubclass(err, exc_type2); + if (unlikely(res == -1)) { + PyErr_WriteUnraisable(err); + res = 0; + } + } + __Pyx_ErrRestore(exception, value, tb); + return res; +} +#else +static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) { + int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0; + if (!res) { + res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); + } + return res; +} +#endif +static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { + Py_ssize_t i, n; + assert(PyExceptionClass_Check(exc_type)); + n = PyTuple_GET_SIZE(tuple); +#if PY_MAJOR_VERSION >= 3 + for (i=0; i size) { PyOS_snprintf(warning, sizeof(warning), - "%s.%s size changed, may indicate binary incompatibility", - module_name, class_name); + "%s.%s size changed, may indicate binary incompatibility. Expected %zd, got %zd", + module_name, class_name, basicsize, size); if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; } else if ((size_t)basicsize != size) { PyErr_Format(PyExc_ValueError, - "%.200s.%.200s has the wrong size, try recompiling", - module_name, class_name); + "%.200s.%.200s has the wrong size, try recompiling. Expected %zd, got %zd", + module_name, class_name, basicsize, size); goto bad; } return (PyTypeObject *)result; @@ -7206,7 +8159,8 @@ } #endif -static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { +/* InitStrings */ + static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { #if PY_MAJOR_VERSION < 3 if (t->is_unicode) { @@ -7231,6 +8185,8 @@ #endif if (!*t->p) return -1; + if (PyObject_Hash(*t->p) == -1) + return -1; ++t; } return 0; @@ -7239,50 +8195,57 @@ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) { return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str)); } -static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) { +static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) { Py_ssize_t ignore; return __Pyx_PyObject_AsStringAndSize(o, &ignore); } -static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { -#if CYTHON_COMPILING_IN_CPYTHON && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) - if ( -#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - __Pyx_sys_getdefaultencoding_not_ascii && -#endif - PyUnicode_Check(o)) { -#if PY_VERSION_HEX < 0x03030000 - char* defenc_c; - PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL); - if (!defenc) return NULL; - defenc_c = PyBytes_AS_STRING(defenc); +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT +#if !CYTHON_PEP393_ENABLED +static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { + char* defenc_c; + PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL); + if (!defenc) return NULL; + defenc_c = PyBytes_AS_STRING(defenc); #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - { - char* end = defenc_c + PyBytes_GET_SIZE(defenc); - char* c; - for (c = defenc_c; c < end; c++) { - if ((unsigned char) (*c) >= 128) { - PyUnicode_AsASCIIString(o); - return NULL; - } + { + char* end = defenc_c + PyBytes_GET_SIZE(defenc); + char* c; + for (c = defenc_c; c < end; c++) { + if ((unsigned char) (*c) >= 128) { + PyUnicode_AsASCIIString(o); + return NULL; } } + } #endif - *length = PyBytes_GET_SIZE(defenc); - return defenc_c; + *length = PyBytes_GET_SIZE(defenc); + return defenc_c; +} #else - if (__Pyx_PyUnicode_READY(o) == -1) return NULL; +static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { + if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL; #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - if (PyUnicode_IS_ASCII(o)) { - *length = PyUnicode_GET_LENGTH(o); - return PyUnicode_AsUTF8(o); - } else { - PyUnicode_AsASCIIString(o); - return NULL; - } + if (likely(PyUnicode_IS_ASCII(o))) { + *length = PyUnicode_GET_LENGTH(o); + return PyUnicode_AsUTF8(o); + } else { + PyUnicode_AsASCIIString(o); + return NULL; + } #else - return PyUnicode_AsUTF8AndSize(o, length); + return PyUnicode_AsUTF8AndSize(o, length); +#endif +} +#endif #endif +static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT + if ( +#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + __Pyx_sys_getdefaultencoding_not_ascii && #endif + PyUnicode_Check(o)) { + return __Pyx_PyUnicode_AsStringAndSize(o, length); } else #endif #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) @@ -7306,43 +8269,67 @@ if (is_true | (x == Py_False) | (x == Py_None)) return is_true; else return PyObject_IsTrue(x); } -static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { +static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) { +#if PY_MAJOR_VERSION >= 3 + if (PyLong_Check(result)) { + if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1, + "__int__ returned non-int (type %.200s). " + "The ability to return an instance of a strict subclass of int " + "is deprecated, and may be removed in a future version of Python.", + Py_TYPE(result)->tp_name)) { + Py_DECREF(result); + return NULL; + } + return result; + } +#endif + PyErr_Format(PyExc_TypeError, + "__%.4s__ returned non-%.4s (type %.200s)", + type_name, type_name, Py_TYPE(result)->tp_name); + Py_DECREF(result); + return NULL; +} +static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) { +#if CYTHON_USE_TYPE_SLOTS PyNumberMethods *m; +#endif const char *name = NULL; PyObject *res = NULL; #if PY_MAJOR_VERSION < 3 - if (PyInt_Check(x) || PyLong_Check(x)) + if (likely(PyInt_Check(x) || PyLong_Check(x))) #else - if (PyLong_Check(x)) + if (likely(PyLong_Check(x))) #endif return __Pyx_NewRef(x); +#if CYTHON_USE_TYPE_SLOTS m = Py_TYPE(x)->tp_as_number; -#if PY_MAJOR_VERSION < 3 + #if PY_MAJOR_VERSION < 3 if (m && m->nb_int) { name = "int"; - res = PyNumber_Int(x); + res = m->nb_int(x); } else if (m && m->nb_long) { name = "long"; - res = PyNumber_Long(x); + res = m->nb_long(x); } -#else - if (m && m->nb_int) { + #else + if (likely(m && m->nb_int)) { name = "int"; - res = PyNumber_Long(x); + res = m->nb_int(x); + } + #endif +#else + if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) { + res = PyNumber_Int(x); } #endif - if (res) { + if (likely(res)) { #if PY_MAJOR_VERSION < 3 - if (!PyInt_Check(res) && !PyLong_Check(res)) { + if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) { #else - if (!PyLong_Check(res)) { + if (unlikely(!PyLong_CheckExact(res))) { #endif - PyErr_Format(PyExc_TypeError, - "__%.4s__ returned non-%.4s (type %.200s)", - name, name, Py_TYPE(res)->tp_name); - Py_DECREF(res); - return NULL; + return __Pyx_PyNumber_IntOrLongWrongResultType(res, name); } } else if (!PyErr_Occurred()) { @@ -7413,6 +8400,9 @@ Py_DECREF(x); return ival; } +static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) { + return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False); +} static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { return PyInt_FromSize_t(ival); } diff -Nru basemap-1.1.0+dfsg/src/_geoslib.pyx basemap-1.2.0+dfsg/src/_geoslib.pyx --- basemap-1.1.0+dfsg/src/_geoslib.pyx 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/src/_geoslib.pyx 2018-09-26 01:25:23.000000000 +0000 @@ -335,15 +335,17 @@ cdef GEOSCoordSeq *cs cdef GEOSGeom *lr + + # make sure data is contiguous. # if not, make a local copy. if not PyArray_ISCONTIGUOUS(b): b = b.copy() m = b.shape[0] - + # Add closing coordinates to sequence? - if b[-1,0] != b[0,0] or b[-1,1] != b[0,1]: + if m > 0 and (b[-1,0] != b[0,0] or b[-1,1] != b[0,1]): M = m + 1 else: M = m diff -Nru basemap-1.1.0+dfsg/.travis.yml basemap-1.2.0+dfsg/.travis.yml --- basemap-1.1.0+dfsg/.travis.yml 2017-05-04 20:53:42.000000000 +0000 +++ basemap-1.2.0+dfsg/.travis.yml 2018-09-26 01:25:23.000000000 +0000 @@ -12,7 +12,7 @@ addons: apt: packages: - - libgeos-3.3.8 + - libgeos-3.4.2 # matplotlib requirements - libpng12-dev - libfreetype6-dev