Skip to content

Commit

Permalink
unwrap_pyoptcol is missing except keyword that causes exceptions …
Browse files Browse the repository at this point in the history
…ignored, fixes function bug (#719)

Fixes a bug in the cdef function when `pyoptcol` is `None` and gets mishandled (raised as error). This error is captured in one of the pytests for `point_linestring_distance`. However, due to the cdef function is missing the `except` keyword, the exception gets ignored by the python interpreter and not reraised.

Authors:
  - Michael Wang (https://github.com/isVoid)

Approvers:
  - H. Thomson Comer (https://github.com/thomcom)

URL: #719
  • Loading branch information
isVoid authored Oct 3, 2022
1 parent 868e485 commit c676c3d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions python/cuspatial/cuspatial/_lib/utils.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ from cudf._lib.cpp.column.column_view cimport column_view
from cuspatial._lib.cpp.optional cimport nullopt, optional


cdef optional[column_view] unwrap_pyoptcol(pyoptcol):
cdef optional[column_view] unwrap_pyoptcol(pyoptcol) except *:
# Unwrap python optional Column arg to c optional[column_view]
cdef Column pycol
cdef optional[column_view] c_opt = nullopt
cdef optional[column_view] c_opt
if isinstance(pyoptcol, Column):
pycol = pyoptcol
c_opt = pycol.view()
elif pyoptcol is None:
c_opt = nullopt
else:
raise ValueError("pyoptcol must be a Column or None")
raise ValueError("pyoptcol must be either Column or None.")
return c_opt

0 comments on commit c676c3d

Please sign in to comment.