#1008·pendulum

Timezones are not hashable

Author: eroviraCreated Sep 12, 2026Updated Sep 12, 2026
  • I am on the latest Pendulum version.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • OS version and name: Ubuntu 24.04.4 LTS
  • Pendulum version: 3.2.0

Issue

I noticed Pendulum Timezone objects are not hashable since version 3.1.0 but they were in version 3.0.0.

Minimal reproducible example (versions 3.1.0 and 3.2.0)

Python 3.11.8 (main, Jul 25 2025, 15:41:07) [GCC 13.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pendulum
>>> hash(pendulum.Timezone("UTC"))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unhashable type: 'Timezone'

Expected behavior (version 3.0.0)

Python 3.11.8 (main, Jul 25 2025, 15:41:07) [GCC 13.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pendulum
>>> hash(pendulum.Timezone("UTC"))
8423064200767

I believe this is a side-effect of this commit https://github.com/python-pendulum/pendulum/commit/6383c07 where __eq__ was defined, but __hash__ wasn't, breaking Python's definition of hashable.

In version 3.0.0 (and probably in earlier versions as well) the Timezone class inherited both methods, resulting in the class being hashable.

Since I think non-hashability wasn't intended, I'm reporting this as a bug.

Hopefully I'll be able to implement a fix myself, but if not, I hope someone else can.

Thank you!

Source: python-pendulum/pendulum