Status: NeedsDecision
Owner: ----
CC: asmeurer,  smi...@gmail.com,  mrock...@gmail.com
Labels: Type-Defect Priority-High Python3

New issue 2682 by vlada.pe...@gmail.com: Python 3: Infite recursion with Dict
http://code.google.com/p/sympy/issues/detail?id=2682

File "/home/vperic/devel/sympy/sympy-py3k/sympy/core/containers.py", line 176, in keys
return Tuple(*iter(self.keys()))
File "/home/vperic/devel/sympy/sympy-py3k/sympy/core/containers.py", line 176, in keys
return Tuple(*iter(self.keys()))
RuntimeError: maximum recursion depth exceeded

This was caused by pull request 570 (https://github.com/sympy/sympy/pull/570), which added the Dict class. Some methods are defined on these SymPy Dicts, which match the names of built-in functions, which are now removed in Python 3 (mostly replaced by the more efficient views). As such, they are converted by 2to3 in a nonsense manner. The affected methods are iterkeys, itervalues and has_key. The has_key method should be removed in any case I think - has_key() has been deprecated for a while now in favor if "key in d" syntax in Python dicts. We could say this is 2to3's fault, but as it's basically confusing our own Dict with the built-in dict I don't really blame it. Anyway, relying on an upstream fix for this is not very realistic.

The solution is basically to rename these methods so 2to3 doesn't convert them. I'm not sure to what though, what does everyone think? I'd really like to get this fixed ASAP as the recursion errors are very annoying (the traceback takes a lot of space and so it's hard to see real issues). I'm CCing everyone who was involved in the pull request. For the record, there are 5 errors in tests and 2 in doctests.




--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" group.
To post to this group, send email to sympy-issues@googlegroups.com.
To unsubscribe from this group, send email to 
sympy-issues+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sympy-issues?hl=en.

Reply via email to