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

Infinite loop/recursion error when accessing LockFile properties via __getitem__ #54

Closed
mcrichton opened this issue Feb 6, 2024 · 3 comments

Comments

@mcrichton
Copy link

Affects:

plette version 1.0.0

Expected:

accessing lockfile["default"] should return the same value as lockfile.default

Actual:

accessing lockfile["default"] causes an infinite loop (RecursionError)

Cause:

my_lockfile["default"] -> __getitem__(self, "default") -> value = self["default"] -> __getitem__(self, "default") -> ...

Repro:

Using (an admittedly outdated version of) requirementslib with latest plette. Affected line here: https://github.com/sarugaku/requirementslib/blob/d6b5165bfc6f043b1156c209d85f3e09b60aeaa8/src/requirementslib/models/lockfile.py#L79

Can also be easily repro'd in tests by doing lock["default"]

Notes:

The tests in https://github.com/sarugaku/plette/blob/master/tests/test_lockfiles.py do not catch this issue, as they use lock.<...> rather than lock[<...>]

@oz123
Copy link
Contributor

oz123 commented Mar 14, 2024

This should be fixed by #55

Please verify by:

python -i -m plette -f Pipfile.lock
>>> lockfile.dev_packages
>>> lockfile.develop

@mcrichton
Copy link
Author

Tested and working, thank you.

The only change I had to make was removing the (unused) import tomllib as I am using Python 3.10: mcrichton@b395ca8

@oz123
Copy link
Contributor

oz123 commented Apr 25, 2024

Fixed in v2.0.0

@oz123 oz123 closed this as completed Apr 25, 2024
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