Ticket #5780 defect new

Opened 10 months ago

Last modified 5 weeks ago

words: Unbound variable nickname in IRCUser for invalid user name

Reported by: j2a Owned by:
Priority: normal Milestone:
Component: words Keywords: review
Cc: ralphm Branch:
Author: Launchpad Bug:

Description

If user send NICK command with non-utf8 non-ascii symbols, IRCUser raises UnboundLocalError:

exceptions.UnboundLocalError: local variable 'nickname' referenced before assignment

patch and test is attached.

Attachments

unbound_local_error.patch Download (1.7 KB) - added by j2a 10 months ago.
Fix for UnboundLocalError and test for it
5780v2.patch Download (2.2 KB) - added by stephsolis 5 weeks ago.
Addressed review suggestions

Change History

1

Changed 10 months ago by DefaultCC Plugin

  • cc ralphm added

Changed 10 months ago by j2a

Fix for UnboundLocalError and test for it

2

Changed 10 months ago by j2a

  • type changed from enhancement to defect
  • summary changed from [patch] words: Unbound variable nickname in IRCUser for invalid user name to words: Unbound variable nickname in IRCUser for invalid user name

3

Changed 10 months ago by exarkun

  • keywords review added

Pretty sure j2a meant to do this...

4

Changed 10 months ago by tenth

  • owner set to tenth

5

Changed 10 months ago by exarkun

  • keywords review removed
  • owner changed from tenth to j2a

Thanks.

  1. The docstrings for test_utf8Messages and test_wrongUtf8Nick do half of a good job. They should explain the desired behavior as well as explaining the case they are exercising, though.
  2. Please separate methods from each other by two blank lines and wrap lines at less than 80 columns.
  3. nickname = params[0] isn't likely to raise a UnicodeDecodeError, right? So the line being added inside the try/except could probably go before the try statement begins. It's nice to minimize the amount of code inside try blocks.

Thanks again! It's really great to see you working on this area of Twisted.

6

Changed 5 weeks ago by stephsolis

  • owner changed from j2a to stephsolis
  • status changed from new to assigned

Changed 5 weeks ago by stephsolis

Addressed review suggestions

7

Changed 5 weeks ago by stephsolis

  • owner stephsolis deleted
  • status changed from assigned to new
  • keywords review added
Note: See TracTickets for help on using tickets.