Opened 8 years ago
Closed 8 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 , 8 years ago
Keywords: | py2 added |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 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 , 8 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:4 by , 8 years ago
Has patch: | set |
---|---|
Patch needs improvement: | set |
comment:5 by , 8 years ago
Resolution: | → wontfix |
---|---|
Status: | assigned → closed |
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."
Patches accepted by January 2017 at which point we're dropping Python 2 support in master and could close this as wontfix.