Skip to content

Commit c172cab

Browse files
timsaucerCopilot
andauthored
Update crates/core/src/context.rs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 4ef7fb8 commit c172cab

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

crates/core/src/context.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,11 @@ impl PySessionConfig {
188188
}
189189

190190
pub fn with_extension(&self, extension: Bound<PyAny>) -> PyResult<Self> {
191+
if !extension.hasattr("__datafusion_extension_options__")? {
192+
return Err(pyo3::exceptions::PyAttributeError::new_err(
193+
"Expected extension object to define __datafusion_extension_options__()",
194+
));
195+
}
191196
let capsule = extension.call_method0("__datafusion_extension_options__")?;
192197
let capsule = capsule.cast::<PyCapsule>()?;
193198

0 commit comments

Comments
 (0)