Skip to content

Commit

Permalink
Drop Python 3.7 and lower
Browse files Browse the repository at this point in the history
  • Loading branch information
Secrus committed Aug 15, 2023
1 parent 071bf63 commit 2068356
Show file tree
Hide file tree
Showing 4 changed files with 523 additions and 546 deletions.
20 changes: 8 additions & 12 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,14 @@ Pendulum
.. image:: https://img.shields.io/pypi/l/pendulum.svg
:target: https://pypi.python.org/pypi/pendulum

.. image:: https://img.shields.io/codecov/c/github/sdispater/pendulum/master.svg
:target: https://codecov.io/gh/sdispater/pendulum/branch/master

.. image:: https://github.com/sdispater/pendulum/actions/workflows/tests.yml/badge.svg
:alt: Pendulum Build status
:target: https://github.com/sdispater/pendulum/actions


Python datetimes made easy.

Supports Python **2.7** and **3.4+**.
Supports Python **3.8 and newer**.


.. code-block:: python
Expand Down Expand Up @@ -56,6 +53,13 @@ Supports Python **2.7** and **3.4+**.
'2013-03-31T03:00:00+02:00'
Resources
=========

* `Official Website <https://pendulum.eustace.io>`_
* `Documentation <https://pendulum.eustace.io/docs/>`_
* `Issue Tracker <https://github.com/sdispater/pendulum/issues>`_

Why Pendulum?
=============

Expand Down Expand Up @@ -121,14 +125,6 @@ a possible solution, if any:
return '' if val is None else val.isoformat()
Resources
=========

* `Official Website <https://pendulum.eustace.io>`_
* `Documentation <https://pendulum.eustace.io/docs/>`_
* `Issue Tracker <https://github.com/sdispater/pendulum/issues>`_


Contributing
============

Expand Down
11 changes: 3 additions & 8 deletions pendulum/datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import calendar
import datetime
import sys
import traceback

from typing import TYPE_CHECKING
Expand Down Expand Up @@ -1243,13 +1242,9 @@ def __add__(self, other: datetime.timedelta) -> Self:
if not isinstance(other, datetime.timedelta):
return NotImplemented

if sys.version_info >= (3, 8):
# This is a workaround for Python 3.8+
# since calling astimezone() will call this method
# instead of the base datetime class one.
caller = traceback.extract_stack(limit=2)[0].name
if caller == "astimezone":
return super().__add__(other)
caller = traceback.extract_stack(limit=2)[0].name
if caller == "astimezone":
return super().__add__(other)

return self._add_timedelta_(other)

Expand Down
Loading

0 comments on commit 2068356

Please sign in to comment.