Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linked-list type OneToOne causes recursion error #156

Open
doc-hex opened this issue May 11, 2022 · 1 comment
Open

Linked-list type OneToOne causes recursion error #156

doc-hex opened this issue May 11, 2022 · 1 comment

Comments

@doc-hex
Copy link

doc-hex commented May 11, 2022

class Card(rom.Model):
    # ...
    # in a chain of related objects
    next_card = rom.OneToOne('Card', on_delete='restrict')
    prev_card = rom.OneToOne('Card', on_delete='restrict')
  • once an instance is created with non-zero next/prev links, cannot load the instance anymore
  • hits RecursionError: maximum recursion depth exceeded while calling a Python object
  • path is:
    out[i] = cls(_loading=True, **data)
  File "site-packages/rom/model.py", line 259, in __init__
    setattr(self, attr, data)
  File "site-packages/rom/columns.py", line 339, in __set__
    self._init_(obj, *value)
  File "site-packages/rom/columns.py", line 329, in _init_
    value = self._from_redis(value)
  File "site-packages/rom/columns.py", line 798, in _from_redis
    return model.get(value)
  File "site-packages/rom/model.py", line 568, in get
    out[i] = cls(_loading=True, **data)

I am working-around using integer column instead, but wanted to report.

@josiahcarlson
Copy link
Owner

josiahcarlson commented Dec 27, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants