Commit 48f6b449 authored by Jason Madden's avatar Jason Madden Committed by GitHub

Merge pull request #1574 from gevent/issue1569

Update PyPy to 7.3.1 on Windows
parents fd31e0dc 23417899
......@@ -19,6 +19,9 @@ env:
- PYTHONUNBUFFERED=1
- PYTHONDONTWRITEBYTECODE=1
- PIP_UPGRADE_STRATEGY=eager
# Don't get warnings about Python 2 support being deprecated. We
# know. The env var works for pip 20.
- PIP_NO_PYTHON_VERSION_WARNING=1
- CC="ccache gcc"
- CCACHE_NOCPP2=true
- CCACHE_SLOPPINESS=file_macro,time_macros,include_file_ctime,include_file_mtime
......
......@@ -17,6 +17,9 @@ environment:
# too often we get failures to resolve DNS names or failures
# to connect on AppVeyor.
GEVENTTEST_USE_RESOURCES: "-network"
# Don't get warnings about Python 2 support being deprecated. We
# know.
PIP_NO_PYTHON_VERSION_WARNING: 1
# Enable this if debugging a resource leak. Otherwise
# it slows things down.
# PYTHONTRACEMALLOC: 10
......@@ -59,7 +62,7 @@ environment:
PYTHON_EXE: python
# 32-bit
- PYTHON: "C:\\pypy2.7-v7.2.0-win32"
- PYTHON: "C:\\pypy2.7-v7.3.1-win32"
PYTHON_ID: "pypy"
PYTHON_EXE: pypy
PYTHON_VERSION: "2.7.x"
......@@ -105,8 +108,8 @@ environment:
# PYTHON_EXE: python
# matrix:
# allow_failures:
# - PYTHON_ID: "pypy"
# allow_failures:
# - PYTHON_ID: "pypy"
install:
# If there is a newer build queued for the same PR, cancel this one.
......@@ -133,12 +136,10 @@ install:
New-Item -ItemType directory -Path "$env:PYTMP" | Out-Null;
}
if ("${env:PYTHON_ID}" -eq "pypy") {
if (!(Test-Path "${env:PYTMP}\pypy2-v7.2.0-win32.zip")) {
(New-Object Net.WebClient).DownloadFile('https://bitbucket.org/pypy/pypy/downloads/pypy2.7-v7.2.0-win32.zip', "${env:PYTMP}\pypy2-v7.2.0-win32.zip");
if (!(Test-Path "${env:PYTMP}\pypy2-v7.3.1-win32.zip")) {
(New-Object Net.WebClient).DownloadFile('https://bitbucket.org/pypy/pypy/downloads/pypy2.7-v7.3.1-win32.zip', "${env:PYTMP}\pypy2-v7.3.1-win32.zip");
}
7z x -y "${env:PYTMP}\pypy2-v7.2.0-win32.zip" -oC:\ | Out-Null;
& "${env:PYTHON}\pypy.exe" "-mensurepip";
7z x -y "${env:PYTMP}\pypy2-v7.3.1-win32.zip" -oC:\ | Out-Null;
}
elseif (-not(Test-Path($env:PYTHON))) {
& appveyor\install.ps1;
......@@ -155,8 +156,10 @@ install:
- "%PYEXE% -c \"import struct; print(struct.calcsize('P') * 8)\""
# Upgrade to the latest version of pip to avoid it displaying warnings
# about it being out of date.
- "%CMD_IN_ENV% %PYEXE% -m pip install --disable-pip-version-check --user --upgrade pip"
# about it being out of date. Do this here instead of above in
# powershell because the annoying 'DEPRECATION:blahblahblah 2.7 blahblahblah'
# breaks powershell.
- "%CMD_IN_ENV% %PYEXE% -mensurepip -U --user"
- ps: "if(Test-Path(\"${env:PYTHON}\\bin\")) {ls ${env:PYTHON}\\bin;}"
- ps: "if(Test-Path(\"${env:PYTHON}\\Scripts\")) {ls ${env:PYTHON}\\Scripts;}"
......
Update tested PyPy version from 7.2.0 on Windows to 7.3.1 and from
7.3.0 to 7.3.1 on Linux and macOS.
PyPy no longer uses the Python allocation functions for libuv and
libev allocations.
#define GIL_DECLARE PyGILState_STATE ___save
#define GIL_ENSURE ___save = PyGILState_Ensure();
#define GIL_RELEASE PyGILState_Release(___save);
#include <stddef.h>
#ifndef GEVENT_ALLOC_C
#define GEVENT_ALLOC_C
#ifdef PYPY_VERSION_NUM
#define GGIL_DECLARE
#define GGIL_ENSURE
#define GGIL_RELEASE
#define GPyObject_Free free
#define GPyObject_Realloc realloc
#else
#include "Python.h"
#define GGIL_DECLARE PyGILState_STATE ___save
#define GGIL_ENSURE ___save = PyGILState_Ensure();
#define GGIL_RELEASE PyGILState_Release(___save);
#define GPyObject_Free PyObject_Free
#define GPyObject_Realloc PyObject_Realloc
#endif
void* gevent_realloc(void* ptr, size_t size)
{
......@@ -8,26 +23,34 @@ void* gevent_realloc(void* ptr, size_t size)
// done with realloc(), assuming that passing in a size of 0 means to
// free the pointer. But the C/++ standard explicitly says that
// this is undefined. So this wrapper function exists to do it all.
GIL_DECLARE;
GGIL_DECLARE;
void* result;
if(!size && !ptr) {
// libev for some reason often tries to free(NULL); I won't specutale
// why. No need to acquire the GIL or do anything in that case.
return NULL;
// libev for some reason often tries to free(NULL); I won't specutale
// why. No need to acquire the GIL or do anything in that case.
return NULL;
}
// Using PyObject_* APIs to get access to pymalloc allocator on
// all versions of CPython; in Python 3, PyMem_* and PyObject_* use
// the same allocator, but in Python 2, only PyObject_* uses pymalloc.
GIL_ENSURE;
GGIL_ENSURE;
if(!size) {
PyObject_Free(ptr);
result = NULL;
GPyObject_Free(ptr);
result = NULL;
}
else {
result = PyObject_Realloc(ptr, size);
result = GPyObject_Realloc(ptr, size);
}
GIL_RELEASE;
GGIL_RELEASE;
return result;
}
#undef GGIL_DECLARE
#undef GGIL_ENSURE
#undef GGIL_RELEASE
#undef GPyObject_Free
#undef GPyObject_Realloc
#endif /* GEVENT_ALLOC_C */
......@@ -4,8 +4,17 @@
#include "ev.h"
#include "corecext.h"
#include "callbacks.h"
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-parameter"
#endif
#ifdef Py_PYTHON_H
/* define gevent_realloc with libev semantics */
#include "../_ffi/alloc.c"
#if PY_MAJOR_VERSION >= 3
#define PyInt_FromLong PyLong_FromLong
#endif
......@@ -25,6 +34,10 @@
#endif
#endif
#define GGIL_DECLARE PyGILState_STATE ___save
#define GGIL_ENSURE ___save = PyGILState_Ensure();
#define GGIL_RELEASE PyGILState_Release(___save);
static CYTHON_INLINE void gevent_check_signals(struct PyGeventLoopObject* loop) {
if (!ev_is_default_loop(loop->_ptr)) {
......@@ -39,10 +52,6 @@ static CYTHON_INLINE void gevent_check_signals(struct PyGeventLoopObject* loop)
((struct PY_TYPE *)(((char *)EV_PTR) - offsetof(struct PY_TYPE, MEMBER)))
/* define gevent_realloc with libev semantics */
#include "../_ffi/alloc.c"
void gevent_noop(struct ev_loop* loop, void* watcher, int revents) {}
static void gevent_stop(PyObject* watcher, struct PyGeventLoopObject* loop) {
......@@ -65,11 +74,11 @@ static void gevent_stop(PyObject* watcher, struct PyGeventLoopObject* loop) {
static void gevent_callback(struct PyGeventLoopObject* loop, PyObject* callback, PyObject* args, PyObject* watcher, void *c_watcher, int revents) {
GIL_DECLARE;
GGIL_DECLARE;
PyObject *result, *py_events;
long length;
py_events = 0;
GIL_ENSURE;
GGIL_ENSURE;
Py_INCREF(loop);
Py_INCREF(callback);
Py_INCREF(args);
......@@ -121,7 +130,7 @@ end:
Py_DECREF(args);
Py_DECREF(callback);
Py_DECREF(loop);
GIL_RELEASE;
GGIL_RELEASE;
}
......@@ -181,8 +190,8 @@ DEFINE_CALLBACKS
void gevent_run_callbacks(struct ev_loop *_loop, void *watcher, int revents) {
struct PyGeventLoopObject* loop;
PyObject *result;
GIL_DECLARE;
GIL_ENSURE;
GGIL_DECLARE;
GGIL_ENSURE;
loop = GET_OBJECT(PyGeventLoopObject, watcher, _prepare);
Py_INCREF(loop);
gevent_check_signals(loop);
......@@ -195,16 +204,24 @@ void gevent_run_callbacks(struct ev_loop *_loop, void *watcher, int revents) {
PyErr_Clear();
}
Py_DECREF(loop);
GIL_RELEASE;
GGIL_RELEASE;
}
/* This is only used on Win32 */
void gevent_periodic_signal_check(struct ev_loop *_loop, void *watcher, int revents) {
GIL_DECLARE;
GIL_ENSURE;
GGIL_DECLARE;
GGIL_ENSURE;
gevent_check_signals(GET_OBJECT(PyGeventLoopObject, watcher, _periodic_signal_checker));
GIL_RELEASE;
GGIL_RELEASE;
}
#undef GGIL_DECLARE
#undef GGIL_ENSURE
#undef GGIL_RELEASE
#endif /* Py_PYTHON_H */
#ifdef __clang__
#pragma clang diagnostic pop
#endif
......@@ -131,14 +131,6 @@ static void gevent_zero_loop(uv_loop_t* handle)
memset(handle, 0, sizeof(uv_loop_t));
}
#if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM <= 0x07020000
/* Pypy 7.2 and below don't have the needed APIs.
See
https://ci.appveyor.com/project/denik/gevent/builds/30029974/job/oqf8pjpm7r28hcy2
*/
static void gevent_set_uv_alloc() {}
#else
#include "_ffi/alloc.c"
static void* _gevent_uv_malloc(size_t size)
......@@ -175,14 +167,9 @@ static void gevent_set_uv_alloc()
_gevent_uv_calloc,
_gevent_uv_free);
}
#endif
#ifdef __clang__
#pragma clang diagnostic pop
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunreachable-code"
#endif
/* Local Variables: */
/* flycheck-clang-include-path: ("../../../deps/libuv/include") */
/* End: */
......@@ -164,14 +164,15 @@ disabled_tests = [
# the file to a temp location during patching.
'test_asyncore.HelperFunctionTests.test_compact_traceback',
'test_signal.WakeupSignalTests.test_wakeup_fd_early',
# expects time.sleep() to return prematurely in case of a signal;
# gevent.sleep() is better than that and does not get interrupted (unless signal handler raises an error)
# gevent.sleep() is better than that and does not get interrupted
# (unless signal handler raises an error)
'test_signal.WakeupSignalTests.test_wakeup_fd_early',
# expects select.select() to raise select.error(EINTR'interrupted
# system call') gevent.select.select() does not get interrupted
# (unless signal handler raises an error) maybe it should?
'test_signal.WakeupSignalTests.test_wakeup_fd_during',
# expects select.select() to raise select.error(EINTR'interrupted system call')
# gevent.select.select() does not get interrupted (unless signal handler raises an error)
# maybe it should?
'test_signal.SiginterruptTest.test_without_siginterrupt',
'test_signal.SiginterruptTest.test_siginterrupt_on',
......@@ -709,10 +710,17 @@ if PYPY:
# These are flaxy, apparently a race condition? Began with PyPy 2.7-7 and 3.6-7
'test_asyncore.TestAPI_UsePoll.test_handle_error',
'test_asyncore.TestAPI_UsePoll.test_handle_read',
]
if WIN:
disabled_tests += [
# Starting in 7.3.1 on Windows, this stopped raising ValueError; it appears to
# be a bug in PyPy.
'test_signal.WakeupFDTests.test_invalid_fd',
# Likewise for 7.3.1. See the comments for PY35
'test_socket.GeneralModuleTests.test_sock_ioctl',
]
if PY36:
disabled_tests += [
# These are flaky, beginning in 3.6-alpha 7.0, not finding some flag
......
......@@ -300,8 +300,15 @@ if TRAVIS and (PYPY or OSX):
'test__threading_2.py',
]
if TRAVIS and OSX:
IGNORED_TESTS += [
# This rarely hangs for unknown reasons. I cannot reproduce
# locally.
'test__issue230.py',
]
if LIBUV:
if sys.platform.startswith("darwin"):
if OSX:
FAILING_TESTS += [
]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment