Skip to content

Commit 34588f3

Browse files
committed
Fix python3 pyspatialite import
1 parent 49e64ab commit 34588f3

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

python/ext-libs/pyspatialite/lib/dbapi2.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,10 @@ def TimestampFromTicks(ticks):
5050
version_info = tuple([int(x) for x in version.split(".")])
5151
sqlite_version_info = tuple([int(x) for x in sqlite_version.split(".")])
5252

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

5558
def register_adapters_and_converters():
5659
def adapt_date(val):

python/ext-libs/pyspatialite/src/module.c

+4
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,11 @@ static struct PyModuleDef _sqlite3module = {
329329
};
330330
#endif
331331

332+
#if PY_MAJOR_VERSION < 3
332333
PyMODINIT_FUNC init_spatialite(void)
334+
#else
335+
PyMODINIT_FUNC PyInit__spatialite(void)
336+
#endif
333337
{
334338
PyObject *module, *dict;
335339
PyObject *tmp_obj;

0 commit comments

Comments
 (0)