Opened 7 years ago

Closed 7 years ago

#7835 closed defect (fixed)

TypeError in due to attempt to concatenate list with tuple (typo?)

Reported by: peer Owned by: atagar
Priority: Medium Milestone:
Component: Archived/Stem Version:
Severity: Keywords:
Cc: Actual Points:
Parent ID: #7843 Points:
Reviewer: Sponsor:


For StreamClosureReason, the code attempts to join a list with a tuple by using parentheses (tuple) instead of square brackets (list).

File "stem/", line 579, in <module>
TypeError: can only concatenate list (not "tuple") to list

Child Tickets

Change History (5)

comment:1 Changed 7 years ago by atagar

Status: newneeds_information

Hi peer. Oddly I'm not getting that. The keys() method of the Enum class provides a tuple, so both arguments should be tuples.

Mind providing repro steps for getting that stacktrace? What version of python are you using?

comment:2 Changed 7 years ago by peer

Status: needs_informationnew

The issue occurs on Ubuntu 12.10 with Python 2.7.3 and 3.2.3.

To reproduce, the statement "from stem.descriptor.reader import DescriptorReader" is enough.

The library generated from calling python(3) install --home=~ on Ubuntu 12.10 results code that is slightly different from the source.

The generated version has

StreamClosureReason = stem.util.enum.UppercaseEnum(*(list(RelayEndReason.keys()) + ("END", "PRIVATE_ADDR",)))

while the source has

StreamClosureReason = stem.util.enum.UppercaseEnum(*(RelayEndReason.keys() + ("END", "PRIVATE_ADDR",)))

comment:3 Changed 7 years ago by atagar

Parent ID: #7843

Ah ha, ok. The python 2.x output remains unchanged (just checked it) so this must be an issue with the 2to3 conversion for the python 3.x series. I've been meaning to figure out a way of running our tests on the 3.x build output but haven't gotten to it yet. Filed #7843 and making this a child of it.

comment:4 Changed 7 years ago by peer

For python 3.x, changing the parentheses to square brackets took care of the warning. However, there were also parsing issues.

Python 2.x seems to work. Thanks.

comment:5 Changed 7 years ago by atagar

Resolution: fixed
Status: newclosed

This is fixed in the python3 branch where I'm working on support for the 3.x series...

Note: See TracTickets for help on using tickets.