[Patches] [ python-Patches-1116583 ] NameError in cookielib domain check

SourceForge.net noreply at sourceforge.net
Sun Feb 6 03:44:10 CET 2005


Patches item #1116583, was opened at 2005-02-05 00:40
Message generated for change (Comment added) made by jjlee
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1116583&group_id=5470

Category: Library (Lib)
Group: Python 2.4
Status: Closed
Resolution: Accepted
Priority: 5
Submitted By: Chad Miller (chadmiller)
Assigned to: Raymond Hettinger (rhettinger)
Summary: NameError in cookielib domain check

Initial Comment:
Some cookies trigger this cookielib bug.

The bug is analogous to...

if a == ...:
    new_a = a + other_value

if new_a ... :
    foo()

But, "new_a" doesn't exist if the first condition
fails.  I included a lot of lines of context to show
that it's correct without having to see surrounding code.

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

Comment By: John J Lee (jjlee)
Date: 2005-02-06 02:44

Message:
Logged In: YES 
user_id=261020

Well spotted, Chad.  However, I am unable to see how this
bug ever causes an exception in practice: witness
test_cookielib.CookieTests.test_domain_return_ok().

The reason is that neither the request-host nor the
effective request-host ever start with a dot (and it
wouldn't matter if they did, for the purposes of this
method), so the code should be simplified as per patch 1117114.

Clearly, "Some cookies trigger this cookielib bug." implies
my reasoning above is incorrect.  Chad, did you really find
a cookie that triggers this, or do you just have a sharp
eye?  If the former, I'd be very pleased to see a test case
that triggers the bug (even if you can't provide running code).


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

Comment By: Raymond Hettinger (rhettinger)
Date: 2005-02-05 01:33

Message:
Logged In: YES 
user_id=80475

Applied to Lib/cookielib.py 1.5 and 1.4.2.1

Thanks for the patch.

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

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1116583&group_id=5470


More information about the Patches mailing list