-
-
Notifications
You must be signed in to change notification settings - Fork 510
Closed
Labels
bugSomething isn't workingSomething isn't workingregressionBehavior has changed for worse with a releaseBehavior has changed for worse with a releasestubsIssues in stubs files (.pyi)Issues in stubs files (.pyi)
Description
Bug report
What's wrong
mypy: error: "bytes" has no attribute "tobytes"
Contrary to shapely.LineString
the wkb
property of django.contrib.gis.geos.LineString
is not of type bytes
, but of type memoryview
.
>>> type(geometry.boundary)
<class 'django.contrib.gis.geos.collections.MultiLineString'>
>>> type(geometry.boundary.wkb)
<class 'memoryview'>
>>> type(geometry.boundary.wkb.tobytes())
<class 'bytes'>
django-stubs/django-stubs/contrib/gis/gdal/geometries.pyi
Lines 62 to 63 in 2e504df
@property | |
def wkb(self) -> bytes: ... |
How is that should be
Probably:
@property
def wkb(self) -> memoryview: ...
cc @ciscorn
Background information:
- Commit updating Django docs: django/django@7c884af
- Commit giving details about
bytes
vsmemoryview
: python/typing@f6c17dd
System information
- OS: Docker image
python:3.9.16-bullseye
python
version: 3.9.16django
version: 4.1.4mypy
version: 0-991django-stubs
version: 1.13.2
intgr and ciscorn
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingregressionBehavior has changed for worse with a releaseBehavior has changed for worse with a releasestubsIssues in stubs files (.pyi)Issues in stubs files (.pyi)