pola-rs/polars · error

activate dtype

Error message

activate dtype

What it means

Internal conversion path in the pyo3 bridge (types.rs) marking that a Rust-side materialized dynamic integer dtype must be 'activated' — i.e. round-tripped through PyDataType/materialize_dyn_int — before it can be handed to Python, because the raw dynamic-int type has no direct Python representation.

Source

Thrown at pyo3-polars/pyo3-polars/src/types.rs:487

                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

  1. Activate the corresponding dtype feature/flag before conversion; check which dtype is being converted and enable its support.
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at pyo3-polars/pyo3-polars/src/types.rs:487 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/d54a0d7a5bc978ba. Report an issue: GitHub.