Skip to content

[Python] tzinfo_to_string should accept None #20172

@asfimport

Description

@asfimport

Currently tzinfo_to_string errors with Not an instance of datetime.tzinfo when timezone is None. 

>>> tz = None
>>> import pyarrow
>>> pyarrow.lib.tzinfo_to_string(None)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "pyarrow/types.pxi", line 2080, in pyarrow.lib.tzinfo_to_string
    return frombytes(GetResultValue(TzinfoToString(<PyObject*>tz)))
  File "pyarrow/error.pxi", line 143, in pyarrow.lib.pyarrow_internal_check_status
    return check_status(status)
  File "pyarrow/error.pxi", line 122, in pyarrow.lib.check_status
    raise ArrowTypeError(message)
pyarrow.lib.ArrowTypeError: Not an instance of datetime.tzinfo

tzinfo_to_string should accept None also. With this arrays() in python/pyarrow/tests/strategies.py in case of timestamp dtype should also accept None.

See

Reporter: Alenka Frim / @AlenkaF

Note: This issue was originally created as ARROW-16056. Please see the migration documentation for further details.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions