diff --git a/crates/polars-core/src/series/any_value.rs b/crates/polars-core/src/series/any_value.rs index 6149690c85c5..55ac7b23753b 100644 --- a/crates/polars-core/src/series/any_value.rs +++ b/crates/polars-core/src/series/any_value.rs @@ -912,6 +912,7 @@ fn any_values_to_object( for av in values { match av { AnyValue::Object(val) => builder.append_value(val.as_any()), + AnyValue::ObjectOwned(val) => builder.append_value(val.0.as_any()), AnyValue::Null => builder.append_null(), _ => { polars_bail!(SchemaMismatch: "expected object"); diff --git a/py-polars/tests/unit/datatypes/test_object.py b/py-polars/tests/unit/datatypes/test_object.py index 955461eac959..ff7330687cb4 100644 --- a/py-polars/tests/unit/datatypes/test_object.py +++ b/py-polars/tests/unit/datatypes/test_object.py @@ -199,3 +199,8 @@ def test_object_null_slice() -> None: assert_series_equal(s.slice(0, 2).is_null(), pl.Series("x", [False, True])) assert_series_equal(s.slice(1, 1).is_null(), pl.Series("x", [True])) assert_series_equal(s.slice(2, 1).is_null(), pl.Series("x", [False])) + + +def test_object_sort_scalar_19925() -> None: + a = object() + assert pl.DataFrame({"a": [0], "obj": [a]}).sort("a")["obj"].item() == a