1.45 - host parsing bugs
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Python Memcached |
Fix Released
|
Medium
|
Sean Reifschneider |
Bug Description
I just upgraded from 1.40 to 1.45 and have found some bugs in Host.__init__ for parsing a host.
Firstly a name without a colon is rejected. For example is host is "localhost" then you get:
ValueError: Unable to parse connection string: "localhost"
This is because the last pattern requires a colon and port number, but the middle pattern which doesn't requires a "inet:" prefix.
Further down the port is set by this:
self.port = int(hostData.
However the groupdict does not work that way. It returns None rather than the second parameter that would be a default for normal dicts:
>>> x.groupdict(
>>> x.groupdict(
>>>
The fix is to explicitly check the get result and if None then use the default.
The fix for the earlier problem ("localhost" being rejected is to make the colon and port number be optional):
x=re.
Changed in python-memcached: | |
status: | New → Fix Committed |
importance: | Undecided → Medium |
assignee: | nobody → Sean Reifschneider (jafo) |
Changed in python-memcached: | |
status: | Fix Committed → Fix Released |