Opened 8 years ago

Closed 7 years ago

#27088 closed Bug (wontfix)

GEOSGeometry should accept Python 2.7 memoryview

Reported by: Carl Meyer Owned by: Michał Ociepka
Component: GIS Version: 1.10
Severity: Normal Keywords: py2
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

Django's custom django.util.six module has its own memoryview alias which is buffer on Py2 and memoryview on Py3, and GEOSGeometry enforces that its input (if any kind of buffer) be an instance of django.util.six.memoryview (https://github.com/django/django/blob/master/django/contrib/gis/geos/geometry.py#L73).

However, Python 2.7 has backported the Py3 memoryview type, and its use is preferred over Py2 buffer for cross-compatible code: https://docs.python.org/2/c-api/buffer.html

GEOSGeometry should accept Py2 memoryview instances.

(For backwards-compatibility reasons, even though Python 2.7 is now the minimum supported version, we probably can't remove django.util.six.memoryview or change it to refer to memoryview on Py2, because Py2 buffer and memoryview don't have fully compatible APIs.)

Change History (5)

comment:1 by Tim Graham, 8 years ago

Keywords: py2 added
Triage Stage: UnreviewedAccepted

Patches accepted by January 2017 at which point we're dropping Python 2 support in master and could close this as wontfix.

comment:2 by Jani Tiainen, 8 years ago

Documentation https://docs.djangoproject.com/en/1.10/ref/contrib/gis/geos/#django.contrib.gis.geos.GEOSGeometry.wkb at refers value type to be "Python buffer". Couldn't actually to find any examples where buffer is used as an input so wonder how many would be affected by the change.

comment:3 by Michał Ociepka, 7 years ago

Owner: changed from nobody to Michał Ociepka
Status: newassigned

comment:4 by Michał Ociepka, 7 years ago

Has patch: set
Patch needs improvement: set

comment:5 by Tim Graham, 7 years ago

Resolution: wontfix
Status: assignedclosed

From the person who worked on the pull request, "There is not elegant way to solve this issue. If Django drops support to python 3 it is pointless to continue."

Note: See TracTickets for help on using tickets.
Back to Top