mirror of
https://github.com/jorisvink/kore
synced 2025-03-09 04:29:02 -04:00
Merge branch 'master' into 4.x-releng
This commit is contained in:
commit
a31ec315d0
2
BEERS
2
BEERS
@ -33,7 +33,7 @@ I will note down the beer of your choice between the brackets.
|
||||
[] Raphaël Monrouzeau
|
||||
[] Raymond Pasco
|
||||
[] Remy Noulin
|
||||
[] Rickard Lind x 2
|
||||
[] Rickard Lind x 3
|
||||
[] Shih-Yuan Lee
|
||||
[] Stanislav Yudin
|
||||
[] Stig Telfer
|
||||
|
@ -64,7 +64,7 @@ client_setup(struct connection *c)
|
||||
struct connection *backend;
|
||||
|
||||
/* Paranoia. */
|
||||
name = SSL_get_servername(c->ssl, TLSEXT_NAMETYPE_host_name);
|
||||
name = SSL_get_servername(c->tls, TLSEXT_NAMETYPE_host_name);
|
||||
if (name == NULL) {
|
||||
kore_connection_disconnect(c);
|
||||
return;
|
||||
|
@ -986,7 +986,7 @@ cli_ldflags(int argc, char **argv)
|
||||
printf("%.*s ", (int)len, p);
|
||||
|
||||
#if defined(__MACH__)
|
||||
printf("-dynamiclib -undefined suppress -flat_namespace ");
|
||||
printf("-dynamiclib -undefined dynamic_lookup -flat_namespace ");
|
||||
#else
|
||||
printf("-shared ");
|
||||
#endif
|
||||
@ -2221,7 +2221,7 @@ cli_build_ldflags(struct buildopt *bopt)
|
||||
if (bopt->single_binary == 0) {
|
||||
#if defined(__MACH__)
|
||||
cli_buf_appendf(bopt->ldflags,
|
||||
"-dynamiclib -undefined suppress -flat_namespace ");
|
||||
"-dynamiclib -undefined dynamic_lookup -flat_namespace ");
|
||||
#else
|
||||
cli_buf_appendf(bopt->ldflags, "-shared ");
|
||||
#endif
|
||||
|
77
src/python.c
77
src/python.c
@ -55,10 +55,33 @@
|
||||
|
||||
#include <frameobject.h>
|
||||
|
||||
/*
|
||||
* Python 3.13.x requires that Py_BUILD_CORE is defined before we pull
|
||||
* in the pycore_frame header file, and it loves using unnamed unions
|
||||
* so we have to turn off pendatic mode before including it.
|
||||
*
|
||||
* The f_code member was removed from _PyInterpreterFrame and is replaced
|
||||
* with a PyObject called f_executable. There is an _PyFrame_GetCode()
|
||||
* helper function now.
|
||||
*/
|
||||
#if PY_VERSION_HEX >= 0x030d0000
|
||||
#define Py_BUILD_CORE 1
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wpedantic"
|
||||
#endif
|
||||
|
||||
#if PY_VERSION_HEX < 0x030d0000
|
||||
#define _PyFrame_GetCode(frame) (frame->f_code)
|
||||
#endif
|
||||
|
||||
#if PY_VERSION_HEX >= 0x030b0000
|
||||
#include <internal/pycore_frame.h>
|
||||
#endif
|
||||
|
||||
#if PY_VERSION_HEX >= 0x030d0000
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
#if PY_VERSION_HEX < 0x030A0000
|
||||
typedef enum {
|
||||
PYGEN_RETURN = 0,
|
||||
@ -1201,7 +1224,7 @@ python_resolve_frame_line(void *ptr)
|
||||
|
||||
frame = ptr;
|
||||
addr = _PyInterpreterFrame_LASTI(frame) * sizeof(_Py_CODEUNIT);
|
||||
line = PyCode_Addr2Line(frame->f_code, addr);
|
||||
line = PyCode_Addr2Line(_PyFrame_GetCode(frame), addr);
|
||||
#else
|
||||
line = PyFrame_GetLineNumber(ptr);
|
||||
#endif
|
||||
@ -1232,8 +1255,8 @@ python_coro_trace(const char *label, struct python_coro *coro)
|
||||
#else
|
||||
frame = obj->cr_frame;
|
||||
#endif
|
||||
if (frame != NULL && frame->f_code != NULL) {
|
||||
code = frame->f_code;
|
||||
if (frame != NULL && _PyFrame_GetCode(frame) != NULL) {
|
||||
code = _PyFrame_GetCode(frame);
|
||||
func = PyUnicode_AsUTF8AndSize(code->co_name, NULL);
|
||||
file = PyUnicode_AsUTF8AndSize(code->co_filename, NULL);
|
||||
|
||||
@ -3162,23 +3185,30 @@ pyconnection_x509_cb(void *udata, int islast, int nid, const char *field,
|
||||
static void
|
||||
pytimer_run(void *arg, u_int64_t now)
|
||||
{
|
||||
PyObject *ret;
|
||||
struct pytimer *timer = arg;
|
||||
PyObject *ret;
|
||||
struct kore_timer *run;
|
||||
struct pytimer *timer;
|
||||
|
||||
timer = arg;
|
||||
run = timer->run;
|
||||
timer->run = NULL;
|
||||
|
||||
PyErr_Clear();
|
||||
ret = PyObject_CallFunctionObjArgs(timer->callable, timer->udata, NULL);
|
||||
Py_XDECREF(ret);
|
||||
Py_XDECREF(timer->udata);
|
||||
|
||||
timer->udata = NULL;
|
||||
kore_python_log_error("pytimer_run");
|
||||
|
||||
if (timer->flags & KORE_TIMER_ONESHOT) {
|
||||
timer->run = NULL;
|
||||
run->flags |= KORE_TIMER_ONESHOT;
|
||||
Py_DECREF((PyObject *)timer);
|
||||
}
|
||||
else {
|
||||
timer->run = run;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
pytimer_dealloc(struct pytimer *timer)
|
||||
{
|
||||
@ -3192,28 +3222,25 @@ pytimer_dealloc(struct pytimer *timer)
|
||||
timer->callable = NULL;
|
||||
}
|
||||
|
||||
PyObject_Del((PyObject *)timer);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
pytimer_close(struct pytimer *timer, PyObject *args)
|
||||
{
|
||||
if (timer->run != NULL) {
|
||||
kore_timer_remove(timer->run);
|
||||
timer->run = NULL;
|
||||
}
|
||||
|
||||
if (timer->callable != NULL) {
|
||||
Py_DECREF(timer->callable);
|
||||
timer->callable = NULL;
|
||||
}
|
||||
|
||||
if (timer->udata != NULL) {
|
||||
Py_DECREF(timer->udata);
|
||||
timer->udata = NULL;
|
||||
}
|
||||
|
||||
Py_INCREF((PyObject *)timer);
|
||||
PyObject_Del((PyObject *)timer);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
pytimer_close(struct pytimer *timer, PyObject *args)
|
||||
{
|
||||
if (timer->run != NULL) {
|
||||
kore_timer_remove(timer->run);
|
||||
timer->run = NULL;
|
||||
Py_DECREF((PyObject *)timer);
|
||||
} else {
|
||||
timer->flags |= KORE_TIMER_ONESHOT;
|
||||
}
|
||||
|
||||
Py_RETURN_TRUE;
|
||||
}
|
||||
|
||||
|
@ -70,6 +70,9 @@ static struct sock_filter filter_kore[] = {
|
||||
#endif
|
||||
#if defined(SYS_newfstatat)
|
||||
KORE_SYSCALL_ALLOW(newfstatat),
|
||||
#endif
|
||||
#if defined(SYS_faccessat2)
|
||||
KORE_SYSCALL_ALLOW(faccessat2),
|
||||
#endif
|
||||
KORE_SYSCALL_ALLOW(write),
|
||||
KORE_SYSCALL_ALLOW(fcntl),
|
||||
|
Loading…
x
Reference in New Issue
Block a user