Issue #164 resolved

ForeignKey emitter recursion can be infinite and crashes python

Erik LaBianca
created an issue

It's arguable that doing this is a poor design, but it's sure confusing when the python interpreter goes boom for the first time. It's only an issue in the TIP where there is a case for emitting RelatedManagers.

If you have two models, A and B, with a relationship between them, and include the relationship field in both handlers "fields" property, trying to emit either handler will blow up with a stack overflow.

I've implemented a simple recursion stack that prevents double-serializing any object at http://bitbucket.org/easel/django-piston/changeset/f92035638c9f

It might be a better idea to just throw an exception instead of return None, judgement call I guess.

Comments (2)

  1. Log in to comment