Skip to content
This repository has been archived by the owner on May 13, 2020. It is now read-only.

Commit

Permalink
Track object ids instead of objects themselves
Browse files Browse the repository at this point in the history
in operator on objects may have unexpected side-effects, like
calling __cmp__() on objects.
  • Loading branch information
kedder committed Feb 10, 2014
1 parent e600a59 commit 04ed0d2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/mongopersist/datamanager.py
Expand Up @@ -259,9 +259,9 @@ def _get_doc_object(self, obj):
# Make sure we write the object representing a document in a
# collection and not a sub-object.
while getattr(obj, '_p_mongo_sub_object', False):
if obj in seen:
if id(obj) in seen:
raise interfaces.CircularReferenceError(obj)
seen.append(obj)
seen.append(id(obj))
obj = obj._p_mongo_doc_object
return obj

Expand Down

0 comments on commit 04ed0d2

Please sign in to comment.