Commit 8d3ce476 authored by Jason Madden's avatar Jason Madden

Fixes for PyPy 7.3.1

parent 0506d010
......@@ -395,3 +395,4 @@ static void gevent_zero_prepare(uv_prepare_t* handle);
static void gevent_zero_check(uv_check_t* handle);
static void gevent_zero_loop(uv_loop_t* handle);
static void gevent_set_uv_alloc();
static void gevent_test_setup();
......@@ -132,6 +132,10 @@ static void gevent_zero_loop(uv_loop_t* handle)
memset(handle, 0, sizeof(uv_loop_t));
}
/***
* Allocation functions
*/
#include "_ffi/alloc.c"
static void* _gevent_uv_malloc(size_t size)
......@@ -169,6 +173,50 @@ static void gevent_set_uv_alloc()
_gevent_uv_free);
}
/***
* Utility Functions
*/
#ifdef __APPLE__
#include <mach/mach.h>
#include <mach/mach_time.h>
#include <pthread.h>
// based on code from libuv
static void gevent_move_pthread_to_realtime_scheduling_class(pthread_t pthread)
{
mach_timebase_info_data_t timebase_info;
mach_timebase_info(&timebase_info);
const uint64_t NANOS_PER_MSEC = 1000000ULL;
double clock2abs = ((double)timebase_info.denom / (double)timebase_info.numer) * NANOS_PER_MSEC;
thread_time_constraint_policy_data_t policy;
policy.period = 0;
policy.computation = (uint32_t)(5 * clock2abs); // 5 ms of work
policy.constraint = (uint32_t)(10 * clock2abs);
policy.preemptible = FALSE;
int kr = thread_policy_set(
pthread_mach_thread_np(pthread),
THREAD_TIME_CONSTRAINT_POLICY,
(thread_policy_t)&policy,
THREAD_TIME_CONSTRAINT_POLICY_COUNT);
if (kr != KERN_SUCCESS) {
mach_error("thread_policy_set:", kr);
exit(1);
}
}
static void gevent_test_setup()
{
gevent_move_pthread_to_realtime_scheduling_class(pthread_self());
}
#else
static void gevent_test_setup() {}
#endif
#ifdef __clang__
#pragma clang diagnostic pop
#pragma clang diagnostic push
......
......@@ -44,6 +44,14 @@ else:
# for the same reasons as above.
faulthandler.enable()
try:
from gevent.libuv import _corecffi
except ImportError:
pass
else:
_corecffi.lib.gevent_test_setup() # pylint:disable=no-member
del _corecffi
from .sysinfo import VERBOSE
from .sysinfo import WIN
from .sysinfo import LINUX
......
......@@ -601,7 +601,7 @@ if PY2:
'test_ssl.ContextTests.test_options',
]
if PYPY and sys.pypy_version_info[:3] == (7, 3, 0): # pylint:disable=no-member
if PYPY and sys.pypy_version_info[:2] == (7, 3): # pylint:disable=no-member
if OSX:
disabled_tests += [
......@@ -613,6 +613,15 @@ if PYPY and sys.pypy_version_info[:3] == (7, 3, 0): # pylint:disable=no-member
'test_ssl.ThreadedTests.test_default_ecdh_curve',
]
if PYPY3 and TRAVIS:
disabled_tests += [
# If socket.SOCK_CLOEXEC is defined, this creates a socket
# and tests its type with ``sock.type & socket.SOCK_CLOEXEC``
# We have a ``@property`` for ``type`` that takes care of
# ``SOCK_NONBLOCK`` on Linux, but otherwise it's just a pass-through.
# This started failing with PyPy 7.3.1 and it's not clear why.
'test_socket.InheritanceTest.test_SOCK_CLOEXEC',
]
def _make_run_with_original(mod_name, func_name):
@contextlib.contextmanager
......
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