From: SourceForge.net <no...@so...> - 2007-12-14 17:52:11
|
Bugs item #1850722, was opened at 2007-12-14 11:51 Message generated for change (Comment added) made by pjenvey You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112867&aid=1850722&group_id=12867 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Daniel Menezes (bytecodesbr) >Assigned to: Philip Jenvey (pjenvey) Summary: socket.py - ClientCookie and ClientForm Initial Comment: ==================================================================================================== Jython2.2.1(version from svn trunk - https://jython.svn.sourceforge.net/svnroot/jython/trunk/jython) (Don't work) ==================================================================================================== Steps for test: 1 - Copy the directory ClientCookie and ClientForm.py to c:\jython2.2.1-trunkVerison\Lib 2 - Execute Jython: c:\jython2.2.1-trunkVerison\jython.bat 3 - Paste this code in console: import sys import ClientCookie import ClientForm cookieJar = ClientCookie.CookieJar() opener = ClientCookie.build_opener(ClientCookie.HTTPCookieProcessor(cookieJar)) opener.addheaders = [("User-agent","Mozilla/5.0 (compatible)")] ClientCookie.install_opener(opener) fp = ClientCookie.urlopen("http://www.google.com") forms = ClientForm.ParseResponse(fp) print forms[0] fp.close() 4 - Error: Traceback (innermost last): File "C:\projetos\workspace\jython\catalina\src\teste\teste.py", line 10, in ? File "C:\jython2.2.1-original\Lib\ClientCookie\_urllib2_support.py", line 824, in urlopen File "C:\jython2.2.1-original\Lib\ClientCookie\_Opener.py", line 168, in open File "C:\jython2.2.1-original\Lib\urllib2.py", line 325, in open File "C:\jython2.2.1-original\Lib\urllib2.py", line 306, in _call_chain File "C:\jython2.2.1-original\Lib\ClientCookie\_urllib2_support.py", line 717, in http_open File "C:\jython2.2.1-original\Lib\ClientCookie\_urllib2_support.py", line 708, in do_open File "C:\jython2.2.1-original\Lib\socket.py", line 885, in __init__ AttributeError: 'instance' object has no attribute 'reference_count' ==================================================================================================== Python 2.5 (Work fine) ==================================================================================================== Steps for test: 1 - Install ClientCookie and ClientForm (instructions in pages: -> http://wwwsearch.sourceforge.net/ClientCookie/ -> http://wwwsearch.sourceforge.net/ClientForm/ ) 2 - Execute Python 2.5: C:\Python25>python.exe 3 - Paste this code in console: import sys import ClientCookie import ClientForm cookieJar = ClientCookie.CookieJar() opener = ClientCookie.build_opener(ClientCookie.HTTPCookieProcessor(cookieJar)) opener.addheaders = [("User-agent","Mozilla/5.0 (compatible)")] ClientCookie.install_opener(opener) fp = ClientCookie.urlopen("http://www.google.com") forms = ClientForm.ParseResponse(fp) print forms[0] fp.close() 4 - Result: <f GET http://www.google.com.br/search application/x-www-form-urlencoded <HiddenControl(hl=pt-BR) (readonly)> <TextControl(q=)> <SubmitControl(btnG=Pesquisa Google) (readonly)> <SubmitControl(btnI=Estou com sorte) (readonly)> <RadioControl(meta=[*, lr=lang_pt, cr=countryBR])>> In Python 2.5, the Libs ClientCookie and ClientForm work fine, but in Jython don't work. It's one bug? ---------------------------------------------------------------------- >Comment By: Philip Jenvey (pjenvey) Date: 2007-12-14 17:52 Message: Logged In: YES user_id=145787 Originator: NO Yea, this is a bug. The problem is due to Jython having to do a few extra things in _fileobject to emulate CPython's socket close() semantics (basically emualte a reference counting GC), but apparently they're not done as safely as they could be This also needs to be fixed on the 2.2.x branch ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112867&aid=1850722&group_id=12867 |