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

KeyError on repr in any ConnectionPool without host/port/db arguments #995

Closed
carsonip opened this issue Jun 12, 2018 · 3 comments
Closed

Comments

@carsonip
Copy link

To reproduce:

import redis
p = redis.ConnectionPool()
repr(p)
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "venv/local/lib/python2.7/site-packages/redis/connection.py", line 939, in __repr__
    self.connection_class.description_format % self.connection_kwargs,
KeyError: 'host'

connection_kwargs does not require host, port and db but repr() requires it and will crash on call.

@michaelDovgal
Copy link

michaelDovgal commented Jun 12, 2018

Just wanted to open the same issue.
Also this issue can be find in StrictRedis objects (same reason)

>>> import redis
>>> pool = redis.ConnectionPool(host='fake_host', port=6379, password=None)
>>> redis_cli = redis.Redis(connection_pool=pool)
>>> redis_cli
*** KeyError: 'db'

@GitHubMota
Copy link

This issue also trouble me. Wish to be fix.

@jedie
Copy link

jedie commented Jan 2, 2019

think i have the same problem:

    def __repr__(self):
        return "%s<%s>" % (
            type(self).__name__,
>           self.connection_class.description_format % self.connection_kwargs,
        )
E       KeyError: 'db'

self       = <[KeyError("'db'") raised in repr()] ConnectionPool object at 0x7fa4f78192b0>

/usr/local/lib/python3.6/site-packages/redis/connection.py:944: KeyError

isn't it?

Happens with redis==3.0.1

jedie added a commit to jedie/django-tools that referenced this issue Jan 2, 2019
jedie added a commit to jedie/django-tools that referenced this issue Jan 2, 2019
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

4 participants