Shapely: LineString.interpolate()からのセグメンテーション違反

作成日 2018年10月30日  ·  5コメント  ·  ソース: Toblerity/Shapely

@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

オペレーティング・システム

  • Mac OS X 10.14

形の良いバージョンと出所

  • condaからインストールされた1.6b4

dead_kernel

bug

最も参考になるコメント

うーん、exceptNullデコレータがありますが、あまり使われていないようです。 ここで完璧かもしれませんか?

https://github.com/Toblerity/Shapely/blob/master/shapely/geometry/base.py#L160

https://github.com/Toblerity/Shapely/search?q=exceptnull&unscoped_q=exceptnull

全てのコメント5件

うーん、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 @kannesPRを提出できます。 exceptNullデコレータをinterpolateに追加するだけでしょうか?

+簡単な単体テスト

わかった。 今日は提出してもらいたいと思います。

GitHawkで送信

このページは役に立ちましたか?
0 / 5 - 0 評価