Skip to content

Commit

Permalink
Add version guardrail.
Browse files Browse the repository at this point in the history
  • Loading branch information
dfalbel committed Aug 10, 2023
1 parent 93a0ca9 commit 6a08ade
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/python.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3485,7 +3485,18 @@ PyObject* r_to_py_pandas_nullable_series (const RObject& column, const bool conv
Rcpp::stop("R type not handled. Please supply one of int, double, logical");
}

if (!constructor) throw PythonException(py_fetch_error());
if (!constructor) {
// if the constructor is not available it means that the user doesn't have
// the minimum pandas version.
// we show a warning and force the numpy construction.
Rcpp::warning(
"Nullable data types require pandas version >= 1.5.0."
"Forcing numpy cast. Use `options(reticulate.pandas_force_numpy = TRUE)`"
"to disable this warning."
);

return r_to_py_numpy(column, convert);
}

// tuples own the objects - thus we don't leak the value and mask
PyObjectPtr args(PyTuple_New(3));
Expand Down

0 comments on commit 6a08ade

Please sign in to comment.