Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Begin fixing functional tests for deform 2.0-branch #77

Merged
merged 1 commit into from
Aug 19, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions deformdemo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@


PY3 = sys.version_info[0] == 3
PY38MIN = sys.version_info[0] == 3 and sys.version_info[1] >= 8

if PY3:

Expand Down Expand Up @@ -69,16 +70,12 @@ def __call__(self, method):
# eliminate u''
def my_safe_repr(obj, context, maxlevels, level, sort_dicts=True):

from inspect import signature

if type(obj) == unicode:
obj = obj.encode("utf-8")

# Python 3.8 changed the call signature of pprint._safe_repr.
# In order to support both Python 3.8 and earlier versions
# we have to check its signature before calling
sig = signature(pprint._safe_repr)
if len(sig.parameters) == 5:
# by adding sort_dicts.
if PY38MIN:
return pprint._safe_repr(obj, context, maxlevels, level, sort_dicts)
else:
return pprint._safe_repr(obj, context, maxlevels, level)
Expand Down