Issue1850722

classification
Title: socket.py - ClientCookie and ClientForm
Type: Severity: normal
Components: None Versions:
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: pjenvey Nosy List: bytecodesbr, pjenvey
Priority: normal Keywords:

Created on 2007-12-14.11:51:50 by bytecodesbr, last changed 2007-12-29.02:01:11 by pjenvey.

Files
File name Uploaded Description Edit Remove
ClientCookie_and_ClientForm.zip bytecodesbr, 2007-12-14.11:51:50 For test
Messages
msg2041 (view) Author: Daniel Menezes (bytecodesbr) Date: 2007-12-14.11:51:50
====================================================================================================
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?
msg2042 (view) Author: Philip Jenvey (pjenvey) Date: 2007-12-14.17:52:03
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
msg2043 (view) Author: Philip Jenvey (pjenvey) Date: 2007-12-24.19:38:16
this is fixed on trunk in r3863

I'll merge it over to the release branch in a week or so, so it can be included in the 2.2.2 release
msg2044 (view) Author: Philip Jenvey (pjenvey) Date: 2007-12-29.02:01:11
merged to the branch in r3885
History
Date User Action Args
2007-12-14 11:51:50bytecodesbrcreate