diff --git a/CHANGELOG.md b/CHANGELOG.md index ab1048e..974d88c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,7 +20,7 @@ # Unreleased -* +* Fix the build for PyPy2 ([#116](https://github.com/closeio/ciso8601/pull/116)) # 2.x.x diff --git a/module.c b/module.c index eef85d4..0ce53f1 100644 --- a/module.c +++ b/module.c @@ -17,7 +17,7 @@ // https://foss.heptapod.net/pypy/pypy/-/merge_requests/826 #ifdef PYPY_VERSION #define SUPPORTS_37_TIMEZONE_API \ - (PYPY_VERSION_NUM >= 0x07030600) + (PYPY_VERSION_NUM >= 0x07030600) && PY_VERSION_AT_LEAST_37 #else #define SUPPORTS_37_TIMEZONE_API \ PY_VERSION_AT_LEAST_37 diff --git a/tests/tests.py b/tests/tests.py index d1ce2e1..bba8c4c 100644 --- a/tests/tests.py +++ b/tests/tests.py @@ -62,8 +62,9 @@ def test_returns_built_in_utc_if_available(self): # PyPy added support for it in 7.3.6 timestamp = '2018-01-01T00:00:00.00Z' - if (platform.python_implementation() == 'CPython' and sys.version_info >= (3, 7)) or \ - (platform.python_implementation() == 'PyPy' and sys.pypy_version_info >= (7, 3, 6)): + if sys.version_info >= (3, 7) and \ + (platform.python_implementation() == 'CPython' + or (platform.python_implementation() == 'PyPy' and sys.pypy_version_info >= (7, 3, 6))): self.assertIs(parse_datetime(timestamp).tzinfo, datetime.timezone.utc) else: self.assertIsInstance(parse_datetime(timestamp).tzinfo, FixedOffset)