davidcox/genson — Issue #28: bizarre parsing failure
Author: yamins81
Created: 2012-02-06 19:38:03+00:00
State: open

Dave, the following genson string fails to parse (the error message is a bit byzantine and ends in an infinite recursion ... see below.)

genson_string = """{"a": choice([[{},
{"a": 0, "b": {"a": {"b": [{"c": choice([0,1])
}]
}
}
}
]])}"""
genson.loads(genson_string)

I would post a somewhat reduced example, but everything I try to do to simplify the string seems to make the problem disappear.
This problem does not occur in my feature/hyperopt branch of genson.

---------------------------------------------
ERROR MESSAGE TEST (PARTIAL):

/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/pyparsing.pyc in _parseCache(self, instring, loc, doActions, callPreParse)
996 else:
997 try:
--> 998 value = self._parseNoCache( instring, loc, doActions, callPreParse )
999 ParserElement._exprArgCache[ lookup ] = (value[0],value[1].copy())
1000 return value

/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/pyparsing.pyc in _parseNoCache(self, instring, loc, doActions, callPreParse)
947 tokens = self.postParse( instring, loc, tokens )
948
--> 949 retTokens = ParseResults( tokens, self.resultsName, asList=self.saveAsList, modal=self.modalResults )
950 if self.parseAction and (doActions or self.callDuringTry):
951 if debugging:

/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/pyparsing.pyc in __new__(cls, toklist, name, asList, modal)
270 __slots__ = ( "__toklist", "__tokdict", "__doinit", "__name", "__parent", "__accumNames", "__weakref__" )
271 def __new__(cls, toklist, name=None, asList=True, modal=True ):
--> 272 if isinstance(toklist, cls):
273 return toklist
274 retobj = object.__new__(cls)

RuntimeError: maximum recursion depth exceeded while calling a Python object