[Spambayes] [ spambayes-Bugs-651365 ] getattr recursion in Corpus.py

SourceForge.net noreply at sourceforge.net
Fri Jan 17 12:09:18 EST 2003


Bugs item #651365, was opened at 2002-12-10 04:42
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=498103&aid=651365&group_id=61702

Category: None
Group: None
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Wolfgang Strobl (strobl)
Assigned to: Tim Stone (timstone4)
Summary: getattr recursion in Corpus.py

Initial Comment:
After feeding a bunch of new messages into pop3proxy, 
classifying them and when trying to save the result, I got 
a recursion loop (followed by recursion depth exceeded) 
in \cvshome\spambayes\Corpus.py|__getattr__|269]

After looking into setSubstance, I noticed that 
setSubstance (called by load) only sets the attributes 
payload and hdrtext when the pattern matches. 

I temporarily added an else clause to bmatch, i.e.

     if bmatch:
            self.payload = bmatch.group(2)
            self.hdrtxt = sub[:bmatch.start(2)]
            print ".",
        else:
            self.payload = "nix\r\n"
            self.hdrtxt="nix\r\n"
            print "?", len(sub),

and indeed, when trying to save, I notice that after about 
800 good messages, ~ 100 have an empty message, 
see the output below. 

I don't really know what I'm doing here, but at this fix at 
least allows me to continue.

-------------------------

C:\archiv\cvshome\spambayes>python -u pop3proxy.py -
l 8110 mail.gmd.de
Loading database... Done.
Listener on port 8110 is proxying mail:110
User interface url is http://localhost:8880
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 
0 ? 0 ? 0 ? 0 ?
0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 
0 ? 0 ? 0 ? 0 ? 0 ?
0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 
0 ? 0 ? 0 ? 0 ? 0 ?
0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 
0 ? 0 ? 0 ? 0 ? 0 ?
0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 
0 ? 0 ? 0 ? 0 ? 0 ?
0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 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 0 ? 0 ? 0 ? 0 ?
0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 
0 ? 0 ? 0 ? 0 ? 0 ?
0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 
0 . . . . . . . . .
. . . . . .

-----------------------
Initial traceback:

error: uncaptured python exception, closing channel 
<__main__.UserInterface conn
ected at 0x2213470> 
(exceptions.RuntimeError:maximum recursion depth 
exceeded [C
:\Python22\lib\asyncore.py|poll|95] [C:\Python22
\lib\asyncore.py|handle_read_eve
nt|392] [C:\Python22\lib\asynchat.py|handle_read|112] 
[C:\archiv\cvshome\spambay
es\pop3proxy.py|found_terminator|804] 
[C:\archiv\cvshome\spambayes\pop3proxy.py|
onRequest|830] 
[C:\archiv\cvshome\spambayes\pop3proxy.py|onReview|1
093] [C:\arch
iv\cvs\spambayes\Corpus.py|takeMessage|188] 
[C:\archiv\cvs\spambayes\FileCorpus.
py|addMessage|140] 
[C:\archiv\cvs\spambayes\FileCorpus.py|store|231] 
[C:\archiv\
cvs\spambayes\Corpus.py|getSubstance|318] 
[C:\archiv\cvs\spambayes\Corpus.py|__g
etattr__|269] 
[C:\archiv\cvs\spambayes\Corpus.py|__getattr__|269] 
[C:\archiv\cvs
\spambayes\Corpus.py|__getattr__|269] 
[C:\archiv\cvs\spambayes\Corpus.py|__getat



----------------------------------------------------------------------

>Comment By: Skip Montanaro (montanaro)
Date: 2003-01-17 14:09

Message:
Logged In: YES 
user_id=44345

Fixed by restricting __getattr__ (make it raise AttributeError at appropriate times) and handle the case here where the message text isn't formatted as expected.  See Corpus.py 1.3.

----------------------------------------------------------------------

Comment By: Skip Montanaro (montanaro)
Date: 2003-01-16 10:39

Message:
Logged In: YES 
user_id=44345

Assigning to Tim Stone.  I think this is the same problem I reported on the
list the other day.  I think the offending code is in Corpus.__getitem__.  The
test of amsg - "if not amsg" should be "if amsg is None" I think.  I suspect
a fix further up the line as the OP indicated would probably do the trick.

If you don't do something to set self.hdrtxt I believe it is None and you infloop trying to resolve a non-existent __nonzero__ method.

Something like that. ;-)

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=498103&aid=651365&group_id=61702



More information about the Spambayes mailing list