diff --git a/.gitignore b/.gitignore index 87088474..dcd8ed7d 100644 --- a/.gitignore +++ b/.gitignore @@ -32,6 +32,7 @@ profile.html /docs/site/* pyproject.lock /poetry.lock +setup.py # editor diff --git a/Makefile b/Makefile index a3a3ef44..0540be28 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,7 @@ setup: setup-python test: @py.test --cov=pendulum --cov-config .coveragerc tests/ -sq -release: wheels_x64 cp_wheels_x64 wheels_i686 cp_wheels_i686 wheel +release: wheels_x64 cp_wheels_x64 wheel publish: @poetry publish --no-build diff --git a/pendulum/helpers.py b/pendulum/helpers.py index 2d6c9e37..5085a38b 100644 --- a/pendulum/helpers.py +++ b/pendulum/helpers.py @@ -2,6 +2,7 @@ import pendulum import os +import struct from math import copysign from datetime import datetime, date, timedelta @@ -11,7 +12,7 @@ with_extensions = os.getenv("PENDULUM_EXTENSIONS", "1") == "1" try: - if not with_extensions: + if not with_extensions or struct.calcsize("P") == 4: raise ImportError() from ._extensions._helpers import ( diff --git a/pendulum/parsing/__init__.py b/pendulum/parsing/__init__.py index 58f60a99..eef430d6 100644 --- a/pendulum/parsing/__init__.py +++ b/pendulum/parsing/__init__.py @@ -1,12 +1,19 @@ -import re import copy +import os +import re +import struct from datetime import datetime, date, time from dateutil import parser from .exceptions import ParserError +with_extensions = os.getenv("PENDULUM_EXTENSIONS", "1") == "1" + try: + if not with_extensions or struct.calcsize("P") == 4: + raise ImportError() + from ._iso8601 import parse_iso8601 except ImportError: from .iso8601 import parse_iso8601