From 54158aea44e76cab32f16bfa37e714f47db515ac Mon Sep 17 00:00:00 2001 From: Luke Dowling Date: Sun, 13 Oct 2024 00:05:52 +1100 Subject: [PATCH] Removed updates to other files --- python/pyarrow/scalar.pxi | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/python/pyarrow/scalar.pxi b/python/pyarrow/scalar.pxi index 2f9f379355b29..9b3816ddb30af 100644 --- a/python/pyarrow/scalar.pxi +++ b/python/pyarrow/scalar.pxi @@ -1226,6 +1226,15 @@ def scalar(value, type=None, *, from_pandas=None, MemoryPool memory_pool=None): extension_type = type type = type.storage_type + if _is_array_like(value): + value = get_values(value, &is_pandas_object) + + options.size = 1 + + if type is not None: + ty = ensure_type(type) + options.type = ty.sp_type + cdef shared_ptr[CArray] c_array cdef shared_ptr[CScalar] c_scalar @@ -1240,16 +1249,6 @@ def scalar(value, type=None, *, from_pandas=None, MemoryPool memory_pool=None): result = ExtensionScalar.from_storage(extension_type, result) return result - - if _is_array_like(value): - value = get_values(value, &is_pandas_object) - - options.size = 1 - - if type is not None: - ty = ensure_type(type) - options.type = ty.sp_type - if from_pandas is None: options.from_pandas = is_pandas_object else: