@snorfalorpagus ,给你:
尝试沿LINESTRING EMPTY
对象插入一个点时应该抛出回溯或警告,但会使内核崩溃。
.png
问题报告结束)# python shapely_interpolate_segmentation_fault.py
import faulthandler
faulthandler.enable()
from shapely.geometry import Point, LineString
test_line = LineString(((0,0), (1,1), (2,1)))
print(test_line)
empty_line = test_line.parallel_offset(10., side='right')
print(empty_line)
empty_line.interpolate(.5, normalized=True)
$ python shapely_interpolate_segmentation_fault.py
LINESTRING (0 0, 1 1, 2 1)
LINESTRING EMPTY
Fatal Python error: Segmentation fault
Current thread 0x000000010ce7f5c0 (most recent call first):
File "/Users/user/miniconda3/envs/py3_at1866/lib/python3.6/site-packages/shapely/linref.py", line 22 in __call__
File "/Users/user/miniconda3/envs/py3_at1866/lib/python3.6/site-packages/shapely/geometry/base.py", line 777 in interpolate
File "/Users/user/miniconda3/envs/py3_at1866/lib/python3.6/site-packages/shapely/impl.py", line 37 in wrapper
File "shapely_interpolate_segmentation_fault.py", line 9 in <module>
Segmentation fault: 11
conda
嗯,有一个 exceptNull 装饰器,但它似乎没有被经常使用。 可能在这里很完美?
https://github.com/Toblerity/Shapely/blob/master/shapely/geometry/base.py#L160
https://github.com/Toblerity/Shapely/search?q=exceptnull&unscoped_q=exceptnull
@kannes我认为excepNull
装饰器是正确的使用方法。 你想提交 PR 吗?
@snorfalorpagus @kannes我可以提交 PR。 它只是将exceptNull
装饰器添加到interpolate
吗?
+ 一个简单的单元测试
行。 我会努力让它今天提交。
使用GitHawk发送
最有用的评论
嗯,有一个 exceptNull 装饰器,但它似乎没有被经常使用。 可能在这里很完美?
https://github.com/Toblerity/Shapely/blob/master/shapely/geometry/base.py#L160
https://github.com/Toblerity/Shapely/search?q=exceptnull&unscoped_q=exceptnull