diff --git a/python.spec b/python.spec index 221d9ad..0ddf27f 100644 --- a/python.spec +++ b/python.spec @@ -20,7 +20,7 @@ Summary: An interpreted, interactive, object-oriented programming language. Name: %{python} Version: 2.5.1 -Release: 19%{?dist} +Release: 20%{?dist} License: Python Software Foundation License v2 Group: Development/Languages Provides: python-abi = %{pybasever} @@ -52,6 +52,9 @@ Patch60: python-2.5.1-db46.patch Patch101: python-2.3.4-lib64-regex.patch Patch102: python-2.5-lib64.patch +# New API from 2.6 +Patch260: python2.6-set_wakeup_fd4.patch + Patch999: python-2.5.CVE-2007-4965-int-overflow.patch @@ -208,6 +211,8 @@ code that uses more than just unittest and/or test_support.py. %patch101 -p1 -b .lib64-regex %endif +%patch260 -p1 -b .set_wakeup_fd + %patch999 -p1 -b .cve2007-4965 # This shouldn't be necesarry, but is right now (2.2a3) @@ -459,6 +464,7 @@ rm -fr $RPM_BUILD_ROOT %files devel %defattr(-,root,root) /usr/include/* +%doc Misc/README.valgrind Misc/valgrind-python.supp Misc/gdbinit %dir %{_libdir}/python%{pybasever}/config %{_libdir}/python%{pybasever}/config/* %{_libdir}/libpython%{pybasever}.so @@ -496,6 +502,14 @@ rm -fr $RPM_BUILD_ROOT %{_libdir}/python%{pybasever}/lib-dynload/_testcapimodule.so %changelog +* Mon Jan 7 2008 James Antill - 2.5.1-20 +- Add valgrind support files, as doc, to python-devel +- Relates: rhbz#418621 +- Add new API from 2.6, set_wakeup_fd ... use at own risk, presumably won't +- change but I have no control to guarantee that. +- Resolves: rhbz#427794 +- Add gdbinit support file, as doc, to python-devel + * Fri Jan 4 2008 Tom "spot" Callaway - 2.5.1-19 - rebuild for new tcl/tk in rawhide diff --git a/python2.6-set_wakeup_fd4.patch b/python2.6-set_wakeup_fd4.patch new file mode 100644 index 0000000..76920a1 --- /dev/null +++ b/python2.6-set_wakeup_fd4.patch @@ -0,0 +1,86 @@ +diff -rup Python-2.5.1-orig/Modules/signalmodule.c Python-2.5.1/Modules/signalmodule.c +--- Python-2.5.1-orig/Modules/signalmodule.c 2006-01-19 01:09:39.000000000 -0500 ++++ Python-2.5.1/Modules/signalmodule.c 2008-01-07 12:32:00.000000000 -0500 +@@ -12,6 +12,8 @@ + + #include + ++#include ++ + #ifndef SIG_ERR + #define SIG_ERR ((PyOS_sighandler_t)(-1)) + #endif +@@ -75,6 +77,8 @@ static struct { + PyObject *func; + } Handlers[NSIG]; + ++static int wakeup_fd = -1; ++ + static int is_tripped = 0; /* Speed up sigcheck() when none tripped */ + + static PyObject *DefaultHandler; +@@ -112,6 +116,7 @@ checksignals_witharg(void * unused) + static void + signal_handler(int sig_num) + { ++ const char dummy_byte = '\0'; + #ifdef WITH_THREAD + #ifdef WITH_PTH + if (PyThread_get_thread_ident() != main_thread) { +@@ -125,6 +130,8 @@ signal_handler(int sig_num) + is_tripped++; + Handlers[sig_num].tripped = 1; + Py_AddPendingCall(checksignals_witharg, NULL); ++ if (wakeup_fd != -1) ++ write(wakeup_fd, &dummy_byte, 1); + #ifdef WITH_THREAD + } + #endif +@@ -264,6 +271,39 @@ None -- if an unknown handler is in effe + anything else -- the callable Python object used as a handler"); + + ++static PyObject * ++signal_set_wakeup_fd(PyObject *self, PyObject *args) ++{ ++ struct stat buf; ++ int fd, old_fd; ++ if (!PyArg_ParseTuple(args, "i:set_wakeup_fd", &fd)) ++ return NULL; ++#ifdef WITH_THREAD ++ if (PyThread_get_thread_ident() != main_thread) { ++ PyErr_SetString(PyExc_ValueError, ++ "set_wakeup_fd only works in main thread"); ++ return NULL; ++ } ++#endif ++ if (fd != -1 && fstat(fd, &buf) != 0) { ++ PyErr_SetString(PyExc_ValueError, "invalid fd"); ++ return NULL; ++ } ++ old_fd = wakeup_fd; ++ wakeup_fd = fd; ++ return PyLong_FromLong(old_fd); ++} ++ ++PyDoc_STRVAR(set_wakeup_fd_doc, ++"set_wakeup_fd(fd) -> fd\n\ ++\n\ ++Sets the fd to be written to (with '\\0') when a signal\n\ ++comes in. A library can use this to wakeup select or poll.\n\ ++The previous fd is returned.\n\ ++\n\ ++The fd must be non-blocking."); ++ ++ + /* List of functions defined in the module */ + static PyMethodDef signal_methods[] = { + #ifdef HAVE_ALARM +@@ -271,6 +311,7 @@ static PyMethodDef signal_methods[] = { + #endif + {"signal", signal_signal, METH_VARARGS, signal_doc}, + {"getsignal", signal_getsignal, METH_VARARGS, getsignal_doc}, ++ {"set_wakeup_fd", signal_set_wakeup_fd, METH_VARARGS, set_wakeup_fd_doc}, + #ifdef HAVE_PAUSE + {"pause", (PyCFunction)signal_pause, + METH_NOARGS,pause_doc},