Giter VIP home page Giter VIP logo

Comments (5)

1st1 avatar 1st1 commented on August 21, 2024

OK, you can make a PR.

the all in the init.py fails, because I think all in Cython is a unicode object, something Python 2 doesn't like. I'd advocate changing the init.py to explicitly import everything needed instead of doing a from .. import *. This way you are in full control of what's exposed in the public API.

Good.

assertRaisesRegex which is missing. It'd need to be backported, or the test rewritten
as the regexes used aren't complicated.

Ideally, I'd like to see assertRaisesRegex ported. I'll be doing more development in httptools later (proper http protocol implementation etc), and I'm used to assertRaisesRegex.

subTest, either backported or the test rewritten.

We can write a rudimentary version for py2.

I recommend a tool like tox so we can easily run the tests on both Pythons.

OK.

the Makefile is geared towards Python 3, but doesn't do all that much. I just called the build_ext command myself with Python 2.

I'd prefer to keep the Makefile as is. Or, you can add a few more targets with a '2' suffix.

from httptools.

1st1 avatar 1st1 commented on August 21, 2024

BTW, there is this package: https://github.com/benoitc/http-parser/
It appears it uses the same C parser and supports Python 2.

from httptools.

1st1 avatar 1st1 commented on August 21, 2024

@faassen Are you working on any PR? Because if not (of if you haven't got too far) I'd like to close this issue. Since there is another similar package for Python 2, I see no point in migrating this one.

from httptools.

grigi avatar grigi commented on August 21, 2024

assertRaisesRegex is provided by unittest2, and is only needed for Python <= 2.6
Python 2.7 already supports it: https://docs.python.org/2/library/unittest.html#unittest.TestCase.assertRaisesRegexp
It was renamed in Py3.2: https://docs.python.org/3.5/library/unittest.html#unittest.TestCase.assertRaisesRegex
Adding this to the top of the test (or py2 compatibility shim):

try:
    unittest.TestCase.assertRaisesRegex
except AttributeError:
    unittest.TestCase.assertRaisesRegex = unittest.TestCase.assertRaisesRegexp

Will make it just work.

from httptools.

1st1 avatar 1st1 commented on August 21, 2024

Alright, I'm closing this PR.

from httptools.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.