Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does this mechanize poke private implementation of socket.py? #108

Open
thinksource opened this issue Apr 29, 2015 · 0 comments
Open

Does this mechanize poke private implementation of socket.py? #108

thinksource opened this issue Apr 29, 2015 · 0 comments

Comments

@thinksource
Copy link

I use pypy 2.5.1 and mechanize.
The erorr:

Traceback (most recent call last):
  File "app_main.py", line 75, in run_toplevel
  File "mmtmain.py", line 8, in <module>
    from converter.mmtconverter import MMTConverter
  File "C:\Dataload\Dataload Executables\AO3Dataload\src\converter\mmtconverter.
py", line 17, in <module>
    import mechanize
  File "C:\pypy\site-packages\mechanize\__init__.py", line 122, in <module>
    from _mechanize import \
  File "C:\pypy\site-packages\mechanize\_mechanize.py", line 14, in <module>
    from _html import DefaultFactory
  File "C:\pypy\site-packages\mechanize\_html.py", line 19, in <module>
    import _form
  File "C:\pypy\site-packages\mechanize\_form.py", line 74, in <module>
    import _request
  File "C:\pypy\site-packages\mechanize\_request.py", line 15, in <module>
    import _urllib2_fork
  File "C:\pypy\site-packages\mechanize\_urllib2_fork.py", line 70, in <module>
    socket._fileobject("fake socket", close=True)
  File "C:\pypy\lib-python\2.7\socket.py", line 301, in __init__
    sock._reuse()
AttributeError: 'str' object has no attribute '_reuse'

When I go to the 301 of the socket.py:

        # Note that a few libraries (like eventlet) poke at the
        # private implementation of socket.py, passing custom
        # objects to _fileobject().  These libraries need the
        # following fix for use on PyPy: the custom objects need
        # methods _reuse() and _drop() that maintains an explicit
        # reference counter, starting at 0.  When it drops back to
        # zero, close() must be called.
        sock._reuse()

For me, I think mechanize should implement their socket.py.
I just want to konw how to explicit call the counter method _reuser() and _drop()
what is the explicit function's variable here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant