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

impossible to use keyring.core.init_backend(limit=keyring.core.recommended) #423

Closed
ddstreet opened this issue Feb 21, 2020 · 1 comment
Closed

Comments

@ddstreet
Copy link
Contributor

Describe the bug
This documentation is in the CHANGES.rst file, but it's impossible to use because it results in endless recursion between chainer.py's priority property and backends function.

To Reproduce
Steps to reproduce the behavior:

import keyring
keyring.core.init_backend(keyring.core.recommended)

Traceback (most recent call last):
File "", line 1, in
File "/build/repos/python-keyring/python-keyring/keyring/core.py", line 94, in init_backend
or max(
File "/build/repos/python-keyring/python-keyring/keyring/core.py", line 78, in recommended
return backend.priority >= 1
File "/build/repos/python-keyring/python-keyring/keyring/util/properties.py", line 26, in get
return self.fget.get(None, owner)()
File "/build/repos/python-keyring/python-keyring/keyring/backends/chainer.py", line 26, in priority
return 10 * (len(cls.backends) > 1)
File "/build/repos/python-keyring/python-keyring/keyring/util/properties.py", line 26, in get
return self.fget.get(None, owner)()
File "/build/repos/python-keyring/python-keyring/keyring/backends/chainer.py", line 39, in backends
return sorted(allowed, key=backend.by_priority, reverse=True)
File "/build/repos/python-keyring/python-keyring/keyring/backends/chainer.py", line 34, in
allowed = (
File "/build/repos/python-keyring/python-keyring/keyring/core.py", line 78, in recommended
return backend.priority >= 1

etc...

Expected behavior
restrict backends to only those 'recommended' (priority > 1)

@jaraco
Copy link
Owner

jaraco commented Apr 30, 2020

After creating a test, I'm able to replicate the failure in the test suite. Here's the output:

>       keyring.core.init_backend(keyring.core.recommended)

tests/test_core.py:9: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
keyring/core.py:94: in init_backend
    or max(
keyring/core.py:78: in recommended
    return backend.priority >= 1
keyring/util/properties.py:26: in __get__
    return self.fget.__get__(None, owner)()
keyring/backends/chainer.py:29: in priority
    return 10 if len(cls.backends) > 1 else (fail.Keyring.priority - 1)
keyring/util/properties.py:26: in __get__
    return self.fget.__get__(None, owner)()
keyring/backends/chainer.py:42: in backends
    return sorted(allowed, key=backend.by_priority, reverse=True)
keyring/backends/chainer.py:37: in <genexpr>
    allowed = (
keyring/core.py:78: in recommended
    return backend.priority >= 1
E   RecursionError: maximum recursion depth exceeded while calling a Python object

jaraco added a commit that referenced this issue Apr 30, 2020
@jaraco jaraco closed this as completed in e627314 Apr 30, 2020
jaraco added a commit that referenced this issue Apr 30, 2020
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