-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
PyPy 2.7 unable to handle 3.X exceptions #1659
Comments
here's a standalone repro: https://github.com/graingert/psutil-pypy-echild |
an even smaller repro, this works on cpython2 or pypy3 but fails on pypy2 Python 2.7.13 (7.1.1+dfsg-1, Aug 09 2019, 05:11:07)
I think reverting https://github.com/giampaolo/psutil/pull/1544/files will fix it |
@giampaolo here's the error in pypy: https://bitbucket.org/pypy/pypy/issues/3149/compatability-excpeptions-using-a edit: heptapod link: https://foss.heptapod.net/pypy/pypy/-/issues/3149 |
@giampaolo the fix is now in pypy waiting a release |
Another repo: import os
from psutil._compat import FileNotFoundError
try:
raise os.listdir('???')
except FileNotFoundError:
pass
What do you mean? |
May be related to this: https://doc.pypy.org/en/latest/cpython_differences.html#subclasses-of-built-in-types |
The fix is here: https://bitbucket.org/pypy/pypy/commits/11a00b95fd59 edit: heptapod link: https://foss.heptapod.net/pypy/pypy/-/commit/c0d1321538200285f9307eb9c8b806af0f360af6 |
Does this mean current psutil code will work with next version of pypy? If not, do you know a workaround (in psutil) to make it work with current/older pypy versions? If option 2 is not possible I'm keen on going with option 1 (wait for new pypy release) and return error in |
There will be a future release of pypy2 with the fix in it
Tbh I think the subclasshook is a rather ugly hack and the fact that it was removed intentionally in cpython3 makes me think it should not be used. I'd prefer it if you revert to using |
This change was introduced not long ago: #1544. Latest working version is psutil 5.6.3. Sorry but I prefer to leave things as is. cPython 2 is deprecated and so should be pypy2, especially a bugged version which will be fixed and released soon anyway. The gain of #1544 in terms of code maintainability is high and reverting #1544 manually would be a bit tricky too. I can add a more detailed error message though. |
cPython 2 is deprecated and so should be pypy2
pypy2 isn't going anywhere
…On Fri, 14 Feb 2020, 00:14 giampaolo, ***@***.***> wrote:
Closed #1659 <#1659>.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1659?email_source=notifications&email_token=AADFATBLJQ2UEWYBKK3AD33RCXO5BA5CNFSM4KEXBU7KYY3PNVWWK3TUL52HS4DFWZEXG43VMVCXMZLOORHG65DJMZUWGYLUNFXW5KTDN5WW2ZLOORPWSZGOWUCMS2Q#event-3036989802>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADFATEJ4ZSZ5BFFQFWNIALRCXO5BANCNFSM4KEXBU7A>
.
|
Also cPython 2. BTW, I don't plan on dropping Python 2 support any time soon (will happen years from now). I'm just giving up on a specific broken PyPy2 version which hopefully will be fixed soon. |
See giampaolo/psutil#1659 We can remove this exclusion once the next version of pypy2 is released.
See giampaolo/psutil#1659 We can remove this exclusion once the next version of pypy2 is released.
one thing for sure, The exception subclass FileExistsError throw for OSError is only for PY3 so, it will be appropriate to have Line 113 in 4d6a086
meanwhile work around is: wget https://github.com/giampaolo/psutil/archive/release-5.7.0.tar.gz;
tar -xf release-5.7.0.tar.gz;
sed -i 's/platform.python_implementation()/PY3 and platform.python_implementation()/g' \
psutil-release-5.7.0/psutil/_compat.py;
pypy -m pip install psutil-release-5.7.0/ -- while issue will be the Exceptions handling of os.kill(PID, 0) , expecting py3 Exceptions. |
Pin psutil to a version that works for PyPy2, pending release of new PyPy. See giampaolo/psutil#1659
…or Cython, and don't install/include generated .c/.h files in wheels Andrew Athan (1): corrected a typo in comments Anthony Sottile (1): Fix references to six.PY3 in case python4 becomes a thing Arnon Yaari (2): Solaris 10: define SUNOS_NO_IFADDRS to make libuv compile correctly AIX: fix compilation of libuv Carlo Teubner (1): docs/api/gevent.rst: fix typo Carson Ip (1): Fix minor typo in docstring Felix Schwarz (1): API docs: remove duplicated entries for gevent.{queue,server} Felix Yan (3): Fix a typo in doc/intro.rst Correct a typo in baseserver.py (#1470) Correct a typo in patched_tests_setup.py Ivanq (1): Update tblib version for pytest compatibility Jason Madden (229): Back to development: 1.4.1 Document dependence on 3.4.3+ Updating supported python versions. 3.7 should be the default on travis now. Add .pem missing for 3.7 tests. Handle _CRLock wherever it is found, when possible. Copy the STARTUPINFO. Fixes #1352 and fixes #1351. Lint. Add test file missing for PyPy 3.6-7 Update tests for Python 2.7.16 Locally clean runs of PyPy2.7 and CPython 2.7 Fix https://bugs.python.org/issue32270 to get Python 3.7.2 test_subprocess working. Even more care with socket lifetimes. Getting a clean 3.7, 2.7 and 2.7pypy run locally now. Take the ban-hammer to test_ssl.py on Travis+pypy Skip some tests on Appveyor 2.7.15 now that we're on 2.7.16 tests. More appveyor 2.7.15 tests Clean run of PyPy3.6-7 locally. Version simplifications. Patch the 'thread' module provided by 'future' if it's already imported, which is likely because pkg_resources imports it if installed. Sync windows socketpair with Python 3.5+ Tweak for appveyor DNS returning interesting things for www.gevent.org. [travis skip] Avoid a memory leak when wrapping an io.BufferedWriter around a socket. Fix an AttributeError testing under leak tests. Correct a discrpency with __builtins__ in pure-Python vs Cython compiled mode. Avoid unbounded memory usage in deep spawn trees. Fixes #1371. Add a test case. Update to PyPy 7.1. Revert update of PyPy3 to 7.1; checksum mismatch in pyenv right now. PyPy 7.1 tweaks on appveyor. libev-cffi: Use nlink_t and let the compiler fill in the definition. Don't typedef nlink_t in libuv-cffi, it's not defined on Windows. We don't use it anyway. Silence the dnspython warnings. Remove now-unused import struct. Upgrade to PyPy3.6-7.1. Fixes #1373. Add change note for #1378 Performance and correctness improvements for Greenlets. Make the optional backends optional in test__all__ and test__execmodules. Apply logging updates to test__socket_dns as well. Do something reasonable when psutil isn't available for tests. Let tests continue without objgraph; if you ask for leakchecks you get warnings. Tests work without the backport of mock. Make zope.interface optional for tests too. socket/dns test cleanups for CI. Allow time to propagate (PyPy). Lengthen processes.py timeout (windows pypy) Clean up a ResourceWarning and actually test what we're trying to test on CPython 3. Switch to building manylinux2010 wheels with libuv. Fixes #1346 Add pyproject.toml and drop ci-requirements.txt in favor of just dev-requirements.txt Be specific about our desired build system. Another attempt at fixing the pycparser problem. Update tox.ini. Fixes #1391 Update tox.ini. Fixes #1391 Require dnspython 1.16 and backport a fix from 2.0 Update to libuv 1.27.0 Restore missing file that configure.ac wants. Tested on linux non-embedded. [appveyor skip] Catch a rare, racy error on PyPy subprocess. Test all backends non-embedded. not 'allbackendtest', that sets coverage reporting and we don't want that. Update to libev 4.25 Refactor the Travis build to make the matrix explicit and faster. Eliminate Makefile Tweak .coveragerc for coveralls. We need to install pylint when we don't have the cache. First part of adding c-ares Restore the ares_build.h.dist needed for windows. Attempt workaround for broken c-ares on Win/Py2 Add change note about .onion to ares resolver docs. Fix Sphinx 2.0 warnings. The RTD pseudo-sidebar that we get now (injected from a script?) messes up the page layout. Remove it. Add .readthedocs.yml. Fixes #1406 Tweak appveyor and instructions for #1412. Fixes #1412 Need to quate on appveyor. First part of fixing #1349: Allow test.support.is_resource_enabled to do its usual thing in monkey-patched tests (and eventually our own tests). Forgot to set the condition for appveyor. Fix pylint warnings about dynamic module. Enable test.support.is_resource_enabled for monkey-patched tests The testrunner now has an argument for resources, and sets those up based on that or the environment variable. Thread is_resource_enabled through the gevent tests. Produce a better environment string for USE_RESOURCES, and actually pass the right version to the environment variable so we're not just adding on. The monkey test runner needs to handle SkipTest exceptions. Let the examples be skipped if resources aren't around. Split the remaining example tests into their own files. Hmm, dns_mass_resolve.py started taking 'too long' threadpool example timed out too. We used to run those standalone, so increase them all. Re-working docs to make space to document the new testrunner options. Fleshing out testing and building documentation. Tweak to workaround recurrent DNS failures on appveyor. Nope, we still need to upgrade setuptools at least. Try not eager. Document development better, including the testrunner options and network resource usage. Add change not about test resource usage [skip ci] Get libev-cffi building and using a non-embedded libev.so We need EV_COMMON for the CFFI embedded case. Try to fix the dump command. Get non-embedded libuv working on POSIX at least. Clean up configuring for embedded CFFI modules. Enable configure caching to try to speed up builds, especially of cares. Fix caching for the non-embedded cases; The embedded cases don't work because of pip's use of isolation into random temp directories, which may also be impacting ccache's effectiveness. Switch to building a wheel and then installing to better cache. [appveyor skip] Need to uninstall gevent first if we're installing from a wheel. [appveyor skip] Temporarily disable config caching. [appveyor skip] Caching on. [appveyor skip] Update MANIFEST.in for more exclusions if we configure in place. Preparing release 1.5a1 Back to development: 1.5a2 Remove 3.4 from the macOS build script as it is no longer supported. Reorganize the changelog for clarity. [skip ci] Remove old release scripts that no longer work and document the new workflow in development.rst. Make dnspython optional for testing. Stop lying to libev about compiling with llvm on darwin (macOS). Update some libev/libuv info [skip ci] Clarify the speedups for greenlet spawning were a result of #1379. [skip ci] Fix broken doc link. [skip ci] Add a paragraph about older gevent versions on linux not having libuv support. [skip ci] Disable parallel extension builds; it can break compiling Fix regression in tblib. perf changed to pyperf [skip ci] Updating SSL certs and tests to fix failures. Add link to pr #1440 Fix pylint. Basic support for CPython 3.8.0b4. Add the 3.8 test cases. Fix lint. Fix the other place that refs the version in .travis.yml. Fix false detection in test__all__. Hmm, why is test__core giving fits on py38/libuv/travis? Can't reproduce locally. Disable that failing test on 3.8b4 for now. Whoops, fix Python 2. Implement verify_client_post_handshake; appveyor has TLS 1.3 now so those tests are running there. Support TLS1.3, OpenSSL 1.1.1 (and Python 3.7.4) (#1460) Update changenote. Preparing release 1.5a2 Back to development: 1.5a3 Add 3.8 to wheel builders. [skip ci] Python version updates. A change in subprocess._active broke Windows tests, so update test versions. Fix SSL tests on Python 3.8. More Python 3.8 fixes, and another attempt at the PyPy fix. More PyPy tweaks. Try a few times Fix test__ssl on Python 3.6-7.2 Consistently handle text and binary modes in the three FileObject classes. Fixes for universal newlines on Python 2 And again for sys.stderr. Rewrite fileobject core to handle always create FileIO if needed, not just on Py2. Update documentation. Typo fix. [skip ci] Fix #1464 and fix #1465 by making LockType sleep on failure to non-blocking acquire the lock. Travis: Update test dependencies when installing and fix coverage Make Semaphores fair. Coverage updates. Simplifiy test__pywsgi.py gevent.pywsgi: Support keep-alive in HTTP/1.0 Improve safety for libuv async and idle watchers. Consistently raise exception when using a threadpool from the wrong thread. Documentation updates for threadpool.py Get the spawn benchmark working again [skip ci] Fix an interaction between the switch interval and libuv that could introduce delays processing large batches of callbacks. Fix the threadpool in things launched with python -m gevent.monkey Refactoring threadpool worker to make failures in test__issue6 and related easier to find and fix. Fix TestPatchedTPE.test__future. Fix test__getaddrinfo_import on Py2 Give up, skip on Py2 Simplify threadpool worker tracking. Fix potential crashes in the FFI backends if a watcher was closed and stopped in the middle of a callback from the event loop and then raised an exception. Make gevent.killall do what Greenlet.kill does. Remove spurious print() call. Preparing release 1.5a3 Back to development: 1.5a4 release scripts: let appveyor-download.py accept a build version. Update CPython and PyPy versions. Update tests Fix tests on older versions of 3.7 and 3.8 for appveyor. Update 3.6pypy tests. All pass on OSX with pypy3.6-7.3 Tweaks for PyPy3 on Linux. Tweaks for PyPy3 on Linux. Update tests for pypy2.7 Update libev to 4.31 Support new backends in libev. Workaround Travis having too old a kernel to use the linux AIO backend. Down to one failure, stdlib test_ssl ThreadedTests.test_asyncore_server. Solve the socket problem by carefully managing when to close Update to libuv 1.34 deps/libuv/src/unix/sysinfo-memory.c no longer needed on linux. The random* files are needed to build non-embedded. Tweak timeout for test__pywsgi.py on windows. More timing tweaks. Use the PyObject APIs for libev with corecext. Not on pypy 7.2 Let tests run without having gevent installed, just on pythonpath. Fixes #1409 No longer reading the error. Avoid calling super during code-paths used by FileObjectThread. Fix Popen.communicate() to raise exceptions from reading the streams. Need to skip on appveyor. Use a higher resolution clock for timing. Generalize test__core. Add failing tests [skip ci] Add an implementation of contextvars. Include traceback in threadpool logging. Hoping to find where test__subprocess_interrupted is failing on Py2 Tweak include paths. Need to apply same lock_tests pattern for PyPy3 as we do for everything else. Use PollSelector as DefaultSelector after monkey-patching if available. Fix tests on windows, where SelectSelector._select is a normal method. Fix tests on windows, where PollSelector may not be defined. Refactor test__all__ to make it easier to spot errors. PyPy 7.2 on Windows has a failure with it; this won't fix it but is the first step. Make PyPy on windows non-optional so we catch such failures easier. Lint. Packaging updates: use common_utility_include_dir for Cython, and don't install/include generated .c/.h files in wheels Rework the way the in-place patcher works. Another pass for corner cases. Add POLLERR for Windows. Remove the deprecated magic proxy gevent.signal. Additional debug logging for coverage. Need to explicitly include coveragsite/sitecustomize.py Re-organize 1.5a3 changes to call out FileObject changes more clearly. [skip ci] Heed the warnings from TravisCI about jobs/matrix being aliases and overwriting each other. Attempting to fix psutil dep due to giampaolo/psutil#1659 Add change note for #1541. Bump Python 3.7.6 -> 3.7.7, 3.8.1 -> 3.8.2 Same issue on PyPy2 now as PyPy3 had. Preparing release 1.5a4 Back to development: 1.5a5 Make RLock.acquire accept the timeout parameter. Documentation tweaks. Need weakref Fix AttributeError when wrapping a FileObject around already-opened text streams. Add change note for #1549 and #1548. [skip ci] Update release notes; add towncrier configuration. [skip ci] Update date. Preparing release 1.5.0 towncrier works everywhere now Whitespace Jon Parise (1): Dynamic class in gevent.resolver.thread.Resolver.__repr__ Julien Danjou (1): monkey: allow to execute a module rather than only a script Robert Iannucci (1): Update processes.py example to work on windows. Victor Stinner (1): Use CodeType.replace() if available junnplus (2): remove useless variable remove unused
Details: * Pinned psutil to <=5.6.3 on PyPy to avoid an installation error (see giampaolo/psutil#1659) * Disabled unit tests for resourcetest modules on PyPy because PyPy does not implement sys.getsizeof(). Signed-off-by: Andreas Maier <andreas.r.maier@gmx.de>
Details: * Pinned psutil to <=5.6.3 on PyPy to avoid an installation error (see giampaolo/psutil#1659) * Disabled unit tests for resourcetest modules on PyPy because PyPy does not implement sys.getsizeof(). Signed-off-by: Andreas Maier <andreas.r.maier@gmx.de>
Details: * Pinned psutil to <=5.6.3 on PyPy to avoid an installation error (see giampaolo/psutil#1659) * Disabled unit tests for resourcetest modules on PyPy because PyPy does not implement sys.getsizeof(). Signed-off-by: Andreas Maier <andreas.r.maier@gmx.de>
Details: * Pinned psutil to <=5.6.3 on PyPy to avoid an installation error (see giampaolo/psutil#1659) * Disabled unit tests for resourcetest modules on PyPy because PyPy does not implement sys.getsizeof(). Signed-off-by: Andreas Maier <andreas.r.maier@gmx.de>
Details: * Pinned psutil to <=5.6.3 on PyPy to avoid an installation error (see giampaolo/psutil#1659) Signed-off-by: Andreas Maier <andreas.r.maier@gmx.de>
Details: * Pinned psutil to <=5.6.3 on PyPy to avoid an installation error (see giampaolo/psutil#1659) Signed-off-by: Andreas Maier <andreas.r.maier@gmx.de>
Details: * Pinned psutil to <=5.6.3 on PyPy to avoid an installation error (see giampaolo/psutil#1659) Signed-off-by: Andreas Maier <andreas.r.maier@gmx.de>
Details: * Pinned psutil to <=5.6.3 on PyPy to avoid an installation error (see giampaolo/psutil#1659) Signed-off-by: Andreas Maier <andreas.r.maier@gmx.de>
Details: * Pinned psutil to <=5.6.3 on PyPy to avoid an installation error (see giampaolo/psutil#1659) Signed-off-by: Andreas Maier <andreas.r.maier@gmx.de>
Details: * Pinned psutil to <=5.6.3 on PyPy to avoid an installation error (see giampaolo/psutil#1659) Signed-off-by: Andreas Maier <andreas.r.maier@gmx.de>
Details: * Pinned psutil to <=5.6.3 on PyPy to avoid an installation error (see giampaolo/psutil#1659) Signed-off-by: Andreas Maier <andreas.r.maier@gmx.de>
Details: * Pinned psutil to <=5.6.3 on PyPy to avoid an installation error (see giampaolo/psutil#1659) Signed-off-by: Andreas Maier <andreas.r.maier@gmx.de>
See giampaolo/psutil#1659 We can remove this exclusion once the next version of pypy2 is released.
Platform
Bug description
child_proc.wait(3)
raising OSError.errno = errno.ECHILDeven though it should be caught here:
psutil/psutil/_psposix.py
Line 87 in 78c8669
https://github.com/graingert/billiard/blob/351a7d5546841e7a34ec78076a6bf5d41ba7faac/t/unit/test_spawn.py#L29
The text was updated successfully, but these errors were encountered: