On 29 loka, 06:05, Yo-Yo Ma <
baxterstock...@gmail.com> wrote:
> I'm still working on forming some sort of understanding of what exactly
> causes this and/or what is even going on, so any help is much appreciated.
Based on this bug report there is no way to help. We don't have the
models, or how the results are different. This part looks especially
suspicious:
> queryset = Foo.objects.all()
> queryset = queryset.prefetch_related('bars__baz')
> obj = queryset.get(pk=1)
>
> are different from the results of:
>
> obj = Foo.objects.all().prefetch_related('bars__baz').get(pk=1)
The queries are identical. Only possibility is that there is something
really, really strange going on with the garbage collector. I don't
recall us defining any __del__ methods which could cause anything
serious, so it seems that if there is actually a bug here, it means
the bug is in Python. Actually, I am not sure of the semantics of
Python's garbage collector, it might be that the two above queries are
_exactly_ identical in Python.
My wild guesses:
- some sort of state leak in testing
- non-deterministic bug in prefetch_related (likely caused by random
ordering of the rows in the resultset)
I hope you can provide us more data about this situation,
- Anssi