Skip to content

Commit

Permalink
Fix python3 pyspatialite import
Browse files Browse the repository at this point in the history
  • Loading branch information
dmarteau committed Sep 27, 2016
1 parent 49e64ab commit 34588f3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 4 additions & 1 deletion python/ext-libs/pyspatialite/lib/dbapi2.py
Expand Up @@ -50,7 +50,10 @@ def TimestampFromTicks(ticks):
version_info = tuple([int(x) for x in version.split(".")])
sqlite_version_info = tuple([int(x) for x in sqlite_version.split(".")])

Binary = buffer
# buffer is no longer supported is python 3
# memoryview fit 2.7 and 3+
# see https://docs.python.org/2/c-api/buffer.html
Binary = memoryview

def register_adapters_and_converters():
def adapt_date(val):
Expand Down
4 changes: 4 additions & 0 deletions python/ext-libs/pyspatialite/src/module.c
Expand Up @@ -329,7 +329,11 @@ static struct PyModuleDef _sqlite3module = {
};
#endif

#if PY_MAJOR_VERSION < 3
PyMODINIT_FUNC init_spatialite(void)
#else
PyMODINIT_FUNC PyInit__spatialite(void)
#endif
{
PyObject *module, *dict;
PyObject *tmp_obj;
Expand Down

0 comments on commit 34588f3

Please sign in to comment.