Skip to content

Cannot pickle TZFixedOffset (and therefore datetimes with fixed offsets using C extensions) #305

@movermeyer

Description

@movermeyer

On a system that makes use of the C extensions:

def test_pickle_with_fixed_offset():
    dt = parse_iso8601('2018-11-01 20:42:09.058000+00:00')
    pickled_bytes = pickle.dumps(dt)
    dt2 = pickle.loads(pickled_bytes)
    assert dt == dt2

raises an exception:

def test_pickle_with_fixed_offset():
        dt = parse_iso8601('2018-11-01 20:42:09.058000+00:00')
>       pickled_bytes = pickle.dumps(dt)
E       _pickle.PicklingError: Can't pickle <class 'FixedOffset_type'>: attribute lookup FixedOffset_type on builtins failed

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions