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

core: fix for working with python 3.3 #115

Merged
merged 1 commit into from
Nov 21, 2013

Conversation

melor
Copy link
Contributor

@melor melor commented Oct 22, 2013

The unfixed parse_querystring() raises the following exception
in Python 3.3:

TypeError: Type str doesn't support the buffer API

Also removed iteritems() as it is deprecated and no longer
supported in Python 3.x


The same (or just very similar?) problem is mentioned in https://github.com/gabrielfalcao/HTTPretty/pull/27/files

The original exception:

        try:
            self.sock.sendall(data)
        except TypeError:
            if isinstance(data, collections.Iterable):
                for d in data:
>                   self.sock.sendall(d)

/usr/lib64/python3.3/http/client.py:875:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <httpretty.core.fakesock.socket object at 0x7fe1197e6a90>, data = 71, args = (), kw = {}

    def sendall(self, data, *args, **kw):
        self._sent_data.append(data)

        try:
>           requestline, _ = data.split(b'\r\n', 1)
E           AttributeError: 'int' object has no attribute 'split'

../../env/test/lib/python3.3/site-packages/httpretty-0.7.0-py3.3.egg/httpretty/core.py:346: AttributeError

The unfixed parse_querystring() raises the following exception
in Python 3.3:

  TypeError: Type str doesn't support the buffer API

Also removed iteritems() as it is deprecated and no longer
supported in Python 3.x
@z4r
Copy link
Contributor

z4r commented Nov 14, 2013

Hi @melor, i've the same problem: https://travis-ci.org/z4r/python-coveralls/jobs/13962388

@zulcss
Copy link

zulcss commented Nov 21, 2013

This patch fixes it for me.

gabrielfalcao added a commit that referenced this pull request Nov 21, 2013
core: fix for working with python 3.3
@gabrielfalcao gabrielfalcao merged commit 4691786 into gabrielfalcao:master Nov 21, 2013
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

Successfully merging this pull request may close these issues.

None yet

4 participants