Skip to content

Commit e832238

Browse files
authored
Merge pull request #377 from ekawas-vrify/patch-1
Fix UnboundLocalError when reading byte_stream
2 parents 6fa929c + bcf842d commit e832238

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,13 @@ part of your geospatial project.
9393

9494
# Version Changes
9595

96-
## Next
96+
97+
## 3.0.3.dev
98+
### Bug fix
99+
- Prevented UnboundLocalError when reading non-single point M and Z type Shapefiles (@ekawas-vrify).
97100

98101
### Testing.
99-
- Test PyShp on the Python 3.14 official release (officially released this week, no longer in beta)
102+
- Test PyShp on the Python 3.14 official release (officially released this week, no longer in beta).
100103

101104
## 3.0.2
102105

@@ -1572,6 +1575,7 @@ Casey Meisenzahl
15721575
Charles Arnold
15731576
David A. Riggs
15741577
davidh-ssec
1578+
Edward Kawas
15751579
Evan Heidtmann
15761580
ezcitron
15771581
fiveham

changelog.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
VERSION NEXT
1+
VERSION 3.0.3.dev
2+
3+
2025-10-25
4+
Bug fix:
5+
* Prevented UnboundLocalError when reading non-single point M and Z type Shapefiles (@ekawas-vrify).
26

37
2025-10-10
48
Testing:

src/shapefile.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
from __future__ import annotations
1010

11-
__version__ = "3.0.3.dev0"
11+
__version__ = "3.0.3.dev"
1212

1313
import array
1414
import doctest
@@ -1492,7 +1492,8 @@ class _HasM(_CanHaveBBox):
14921492
@staticmethod
14931493
def _read_ms_from_byte_stream(
14941494
b_io: ReadSeekableBinStream, nPoints: int, next_shape: int
1495-
) -> tuple[MBox, list[float | None]]:
1495+
) -> tuple[MBox | None, list[float | None]]:
1496+
mbox = None # Ensure mbox is always defined
14961497
if next_shape - b_io.tell() >= 16:
14971498
mbox = unpack("<2d", b_io.read(16))
14981499
# Measure values less than -10e38 are nodata values according to the spec

0 commit comments

Comments
 (0)