jgehrcke / gipc

gevent-cooperative child processes and inter-process communication
https://gehrcke.de/gipc
MIT License
83 stars 13 forks source link

Only use multiprocessing.reduction on Windows #24

Closed olliemath closed 6 years ago

olliemath commented 7 years ago

This allows Unix users to run under PyPy - taking care of Issue #23 for them.

jgehrcke commented 7 years ago

Hey! Thank you for using gipc, and thanks for your patch! I think we should not merge it as-is, for at least two reasons:

1) Gevent does not support PyPy on Windows. Quote from gevent's README:

PyPy is not supported on Windows. (gevent’s CFFI backend is not available on Windows.)

I think a more correct and explicit solution is to fail fast with a corresponding error message upon detecting the Windows/PyPy platform.

2) In the meantime this import does not fail anymore with PyPy3.5:

PyPy3.5 5.9.0:

$ python
Python 3.5.3 (d72f9800a42b46a8056951b1da2426d2c2d8d502, Oct 03 2017, 13:59:28)
[PyPy 5.9.0-beta0 with GCC 7.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
And now for something completely different: ``what we achieved today: we
discussed the ponyness of time-machines''
>>>> import multiprocessing.reduction
>>>> 

PyPy 5.6.0:

$ python
Python 2.7.12 (aff251e543859ce4508159dd9f1a82a2f553de00, Nov 12 2016, 08:50:18)
[PyPy 5.6.0 with GCC 6.2.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>> import multiprocessing.reduction
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/jp/.pyenv/versions/pypy-5.6.0/lib-python/2.7/multiprocessing/reduction.py", line 55, in <module>
    raise ImportError('pickling of connections not supported')
ImportError: pickling of connections not supported
>>>> 

It still fails with PyPy2.7-5.9.0:

$ python
Python 2.7.13 (84a2f3e6a7f88f2fe698e473998755b3bd1a12e2, Oct 03 2017, 16:11:46)
[PyPy 5.9.0 with GCC 7.1.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>> import multiprocessing.reduction
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/jp/.pyenv/versions/pypy2.7-5.9.0/lib-python/2.7/multiprocessing/reduction.py", line 55, in <module>
    raise ImportError('pickling of connections not supported')
ImportError: pickling of connections not supported
jgehrcke commented 6 years ago

I have decided to go ahead with your patch. After thinking about this again, I believe "fail fast" and "fail explicitly" is probably not the right approach here, because we might have PyPy support on Windows for gevent sooner than we think; who knows :-).

I am closing & reopening this PR now to make Travis execute the CI.

jgehrcke commented 6 years ago

Thank you!

jgehrcke commented 6 years ago

As a follow-up to this, we're now going to test on PyPy2.7 via Travis: https://github.com/jgehrcke/gipc/pull/33