From a8a95c2ecc4a6bc2e5890760eba0d480e0777692 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Fri, 30 Jul 2004 22:35:51 +0000 Subject: [PATCH] Fixed the one-channel bug. --- src/conf.py | 1 - src/irclib.py | 3 +-- src/ircmsgs.py | 9 ++++----- src/ircutils.py | 10 ++++------ src/utils.py | 4 ++++ 5 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/conf.py b/src/conf.py index 8623d3d42..f9f2f6b15 100644 --- a/src/conf.py +++ b/src/conf.py @@ -202,7 +202,6 @@ class SpaceSeparatedSetOfChannels(registry.SpaceSeparatedListOf): self.value.remove(removal) def registerNetwork(name, password='', servers=()): - name = intern(name) network = registerGroup(supybot.networks, name) registerGlobalValue(network, 'password', registry.String(password, """Determines what password will be used on %s. Yes, we know that diff --git a/src/irclib.py b/src/irclib.py index 37b6843cc..04f549823 100644 --- a/src/irclib.py +++ b/src/irclib.py @@ -639,11 +639,10 @@ class Irc(IrcCommandDispatcher): def doNick(self, msg): """Handles NICK messages.""" if msg.nick == self.nick: - newNick = intern(msg.args[0]) + newNick = msg.args[0] self.nick = newNick (nick, user, domain) = ircutils.splitHostmask(msg.prefix) self.prefix = ircutils.joinHostmask(self.nick, user, domain) - self.prefix = intern(self.prefix) elif conf.supybot.followIdentificationThroughNickChanges(): # We use elif here because this means it's someone else's nick # change, not our own. diff --git a/src/ircmsgs.py b/src/ircmsgs.py index 5ab67538b..d9df9226c 100644 --- a/src/ircmsgs.py +++ b/src/ircmsgs.py @@ -125,14 +125,13 @@ class IrcMsg(object): else: self.args = msg.args else: - self.prefix = intern(prefix) - self.command = intern(command) + self.prefix = prefix + self.command = command assert all(ircutils.isValidArgument, args) self.args = args - self.args = tuple(map(intern, self.args)) + self.args = tuple(self.args) if ircutils.isUserHostmask(self.prefix): - (self.nick,self.user,self.host) = \ - map(intern, ircutils.splitHostmask(self.prefix)) + (self.nick,self.user,self.host)=ircutils.splitHostmask(self.prefix) else: (self.nick, self.user, self.host) = (self.prefix,)*3 diff --git a/src/ircutils.py b/src/ircutils.py index 039c7d001..fec0da431 100644 --- a/src/ircutils.py +++ b/src/ircutils.py @@ -103,7 +103,7 @@ _lowertrans = string.maketrans(string.ascii_uppercase + r'\[]~', string.ascii_lowercase + r'|{}^') def toLower(s): """Returns the string s lowered according to IRC case rules.""" - return intern(s.translate(_lowertrans)) + return s.translate(_lowertrans) def strEqual(nick1, nick2): """Returns True if nick1 == nick2 according to IRC case rules.""" @@ -475,12 +475,10 @@ def unDccIP(i): class IrcString(str): """This class does case-insensitive comparison and hashing of nicks.""" def __new__(cls, s=''): - return str.__new__(cls, intern(s)) + x = super(IrcString, cls).__new__(cls, s) + x.lowered = toLower(x) + return x - def __init__(self, s): - assert isinstance(s, basestring), \ - 'Cannot make an IrcString from %r' % s - self.lowered = toLower(s) def __eq__(self, s): try: diff --git a/src/utils.py b/src/utils.py index c3ecb8b36..7f1b3b2ae 100755 --- a/src/utils.py +++ b/src/utils.py @@ -39,6 +39,7 @@ import supybot.fix as fix import os import re +import sys import md5 import new import sha @@ -51,6 +52,7 @@ import compiler import textwrap import UserDict import itertools +import traceback import htmlentitydefs from itertools import imap, ifilter @@ -669,6 +671,8 @@ def mungeEmailForWeb(s): s = s.replace('.', ' DOT ') return s +def stackTrace(): + traceback.print_stack(sys._getframe()) if __name__ == '__main__': import sys, doctest