Not specifying the port raises exception even though it seems like it shouldn't.

Bug #1083072 reported by landor@landor.se
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Python Memcached
Incomplete
Undecided
Unassigned

Bug Description

>>> import memcache
>>> memcache.Client(['mediapop-staging.moaich.0001.apse1.cache.amazonaws.com'])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/kitsunde/.virtualenvs/media-pop/lib/python2.7/site-packages/memcache.py", line 195, in __init__
    self.set_servers(servers)
  File "/Users/kitsunde/.virtualenvs/media-pop/lib/python2.7/site-packages/memcache.py", line 239, in set_servers
    for s in servers]
  File "/Users/kitsunde/.virtualenvs/media-pop/lib/python2.7/site-packages/memcache.py", line 1058, in __init__
    self.port = int(hostData.get('port', 11211))
TypeError: int() argument must be a string or a number, not 'NoneType'
>>> memcache.Client(['mediapop-staging.moaich.0001.apse1.cache.amazonaws.com:11211'])
<memcache.Client object at 0x106474a10>

It seems like it should default to port 11211, but that hostData['port'] has already been set to None.

Revision history for this message
Sean Reifschneider (jafo) wrote :

I can't reproduce this:

guin:python-memcached$ python
Python 2.7.3 (default, Sep 26 2012, 21:53:58)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import memcache
>>> memcache.Client(['127.0.0.1'])
<memcache.Client object at 0xb74bfa7c>
>>> memcache.Client(['www.tummy.com'])
<memcache.Client object at 0xb74bfaac>
>>> memcache.Client(['mediapop-staging.moaich.0001.apse1.cache.amazonaws.com'])
<memcache.Client object at 0xb74bfadc>

Changed in python-memcached:
status: New → Incomplete
Revision history for this message
Alexey Dushechkin (alexey.dushechkin) wrote :

For the historical purposes: this was fixed in https://github.com/linsomniac/python-memcached/commit/bacb8058152873e46e6a2367452a353e4d98a065 and included in version 1.50 and above. Hovewer, RHEL/CentOS 7 still has python-memcached-1.48-4.el7.noarch and that's why I hit this. I believe this can be safely closed now.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.