-
Notifications
You must be signed in to change notification settings - Fork 189
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
Python 3 support (PEP 3333) #29
Comments
Came to post same. I'm willing but have literally zero experience with C extensions. If I can be of any help let me know. If you can point me to a decent tool for or document describing porting extensions from 2 to 3 I'll pour over it and try my luck. |
Shouldn't be too hard as there's not much that needs to be ported. As Also see http://rhodesmill.org/brandon/2008/porting-a-c-extension-module-to-python-30/ for general Py2-to-Py3 porting help. If you have any questions feel free to write an e-mail :) |
For the record, here's the PEP 333 to PEP 3333 diff: http://paste.pocoo.org/show/320496/ |
Apologies but I'm not going to be able to accomplish this on my own. Hope something here can be of help to anyone. I simply don't know C. In my fork's current state code compiles such that vPy2 appears to remain unaffected (working) and vPy3 can at least be initialized. I receive a segfault upon making the first request, according to this backtrace. http://docs.python.org/py3k/howto/cporting.html describes changes to:
Longs/IntsThere is one line with two instances of a need to go from StringsThese defines should cover all instances of Module initializationhttp://docs.python.org/py3k/c-api/module.html provides greater detail. cStringIO is deprecatedI believe the I used |
Module initialization: Whoa that's ugly :-( They could at least have provided a routine hiding the truth from us :-( Strings: You should use cStringIO: Good idea, actually I'm not sure why I use cStringIO at all (because the content length is known so a static string object should suffice). But cStringIO has to be turned into a file-like before calling the WSGI application, so either we use the Py3 cStringIO replacement (whatever it is) or we roll out our own wrapper (I could do that). |
btw the segfault is because the passed argument is a NULL pointer simply because there's no request body. |
Yeah it really doesn't help the < 1KLOC either. I actually just removed much of the boilerplate and it doesn't look nearly as bad.
Yeah, not quite well enough. I actually used the official diff and got lost in the yellow, almost all of which refer to bytestrings. You're right. I just replaced all appropriate code with PyBytes and PyUnicode and reversed Google fails to find cStringIO and Python3 referenced together with minor exception. Here's one. I just removed it entirely That was the wrong segfault, sorry. I had already at least traced that one to its source. This one complains about |
I think you're getting screwed up the native string/unicode string thing at little bit, so here are some tips: Use two header files, The response must always be Your segfault is very weird. I guess you messed up refcounts somewhere else... don't worry everybody does :) The current cStringIO replacement (using Thank you very much for your effort! |
Hey Angelo, any news on Py3 support? |
Ping! Any plans to revive this anytime soon? If not, I might take a stab at it. |
Nope, no plans. There is a port by someone else https://github.com/isaiah/bjoern-py3 but I've never tested it, plus it adds too much code (bytesio object). |
An old issue revival to let you know that bjoern is still the only WSGI server with a SO_REUSEPORT implementation. Too bad we can't use it. |
Are you sure? This is a standard feature every server should implement |
I found this project too late :-( All this time I dreaming about lightweight Python web-server, without any dances around nginx. Do you really have no plans about Python3? |
No, but it shouldn't be too complicated to implement, so feel free if you have some experience with CPython C API (or are willing to learn it)! |
Wait, Bjoern doesn't support Python 3, in 2017, and this issue is still open? Wow. I guess this is not a viable option for a project :( |
@jonashaag I picked up and made it working for python3 ... not sure if this is clean enough to be merged but comments/suggestions are welcome. :-) |
if someone else volunteers to do this just ask me about it :)
The text was updated successfully, but these errors were encountered: