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

fix of #1023 with changes from #1028 #1051

Merged
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions inst/private/check_and_convert.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@

sp = py.sympy;
_sym = py.tuple({sp.Basic, sp.MatrixBase});
string_types = sp.compatibility.string_types;
integer_types = sp.compatibility.integer_types;
string_types = py.str;
integer_types = py.int;
end


Expand Down
12 changes: 9 additions & 3 deletions inst/private/python_header.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
from __future__ import division

import sys

from sympy.core.compatibility import unicode

sys.ps1 = ""; sys.ps2 = ""


Expand Down Expand Up @@ -50,7 +53,8 @@ def echo_exception_stdout(mystr):
import collections
from re import split
# patch pretty printer, issue #952
_mypp = pretty.__globals__["PrettyPrinter"]
from sympy.printing.pretty.pretty import PrettyPrinter
_mypp = PrettyPrinter
def _my_rev_print(cls, f, **kwargs):
g = f.func(*reversed(f.args), evaluate=False)
return cls._print_Function(g, **kwargs)
Expand Down Expand Up @@ -184,7 +188,8 @@ def octoutput(x, et):
c = ET.SubElement(et, "list")
for y in x:
octoutput(y, c)
elif isinstance(x, sp.compatibility.integer_types):
elif isinstance(x, int) or \
(sys.version_info[0] <= 2 and isinstance(x, long)):
a = ET.SubElement(et, "item")
f = ET.SubElement(a, "f")
f.text = str(OCTCODE_INT)
Expand All @@ -205,7 +210,8 @@ def octoutput(x, et):
f.text = d2hex(x.real)
f = ET.SubElement(a, "f")
f.text = d2hex(x.imag)
elif isinstance(x, sp.compatibility.string_types):
elif isinstance(x, str) or \
(sys.version_info[0] <= 2 and isinstance(x, unicode)):
a = ET.SubElement(et, "item")
f = ET.SubElement(a, "f")
f.text = str(OCTCODE_STR)
Expand Down
3 changes: 2 additions & 1 deletion inst/private/python_ipc_native.m
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@
'import collections'
'from re import split'
'# patch pretty printer, issue #952'
'_mypp = pretty.__globals__["PrettyPrinter"]'
'from sympy.printing.pretty.pretty import PrettyPrinter'
'_mypp = PrettyPrinter'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome I was just looking at this. For older sympy maybe we need to keep the old form? I haven't figured out the earlier sympy where this works....

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to work on sympy 1.6. I think I will just do a try: except: and fall back on the old way, until we have our CI up and running again

'def _my_rev_print(cls, f, **kwargs):'
' g = f.func(*reversed(f.args), evaluate=False)'
' return cls._print_Function(g, **kwargs)'
Expand Down