-
Notifications
You must be signed in to change notification settings - Fork 568
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix segfault when using unpickled STRtree in another process (#915)
* Add test for STRtree unpickling segfault * Fix segfault when using unpickled STRtree in another process
- Loading branch information
1 parent
6f86501
commit d0c95c1
Showing
3 changed files
with
59 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# See test_strtree.py::test_pickle_persistence | ||
|
||
import sys | ||
import os | ||
sys.path.append(os.getcwd()) | ||
|
||
import pickle | ||
from shapely.geometry import Point | ||
from shapely.geos import geos_version | ||
|
||
|
||
if __name__ == "__main__": | ||
pickled_strtree = sys.stdin.buffer.read() | ||
print("received pickled strtree:", repr(pickled_strtree)) | ||
strtree = pickle.loads(pickled_strtree) | ||
# Exercise API. | ||
print("calling \"query()\"...") | ||
strtree.query(Point(0, 0)) | ||
if geos_version >= (3, 6, 0): | ||
print("calling \"nearest()\"...") | ||
strtree.nearest(Point(0, 0)) | ||
else: | ||
print("skipping \"nearest()\"") | ||
print("done") |