pola-rs/polars · error
this type isn't exposed to python
Error message
this type isn't exposed to python
What it means
Conversion branch marker in PyDataType::to_python for the pyo3 bridge: the Rust DataType variant being converted into a Python polars dtype object is an Unknown (non-Int) kind that has no exposed Python equivalent, so the sentinel 'this type isn't exposed to python' error fires during the conversion match.
Source
Thrown at pyo3-polars/pyo3-polars/src/types.rs:484
})
.collect::<PyResult<Vec<_>>>()?;
let fields = PyList::new(py, iter)?;
let struct_class = pl.getattr(intern!(py, "Struct")).unwrap();
struct_class.call1((fields,))
},
DataType::Null => {
let class = pl.getattr(intern!(py, "Null")).unwrap();
class.call0()
},
DataType::Unknown(UnknownKind::Int(v)) => {
PyDataType(materialize_dyn_int(*v).dtype()).into_pyobject(py)
},
DataType::Unknown(_) => {
let class = pl.getattr(intern!(py, "Unknown")).unwrap();
class.call0()
},
DataType::BinaryOffset => {
panic!("this type isn't exposed to python")
},
#[allow(unreachable_patterns)]
_ => panic!("activate dtype"),
}
}
}
impl<'py> IntoPyObject<'py> for PySchema {
type Target = PyDict;
type Output = Bound<'py, Self::Target>;
type Error = PyErr;
fn into_pyobject(self, py: Python<'py>) -> Result<Self::Output, Self::Error> {
let dict = PyDict::new(py);
for (k, v) in self.0.iter() {
dict.set_item(k.as_str(), PyDataType(v.clone()).into_pyobject(py)?)?;
}
Ok(dict)View on GitHub (pinned to 9b5d73fd00)
Solutions
- Use a type that pyo3-polars exposes to Python; convert the value to a supported polars type before returning it.
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at pyo3-polars/pyo3-polars/src/types.rs:484 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of pola-rs/polars@9b5d73fd00 (2026-08-19).
Data as JSON: /api/errors/bb6a94f25e53010a.
Report an issue: GitHub.