rpms/python/devel python2.6-set_wakeup_fd4.patch, NONE, 1.1 python.spec, 1.126, 1.127
James Antill (james)
fedora-extras-commits at redhat.com
Mon Jan 7 17:39:46 UTC 2008
Author: james
Update of /cvs/pkgs/rpms/python/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv7082
Modified Files:
python.spec
Added Files:
python2.6-set_wakeup_fd4.patch
Log Message:
* Mon Jan 7 2008 James Antill <jantill at redhat.com> - 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
python2.6-set_wakeup_fd4.patch:
--- NEW FILE python2.6-set_wakeup_fd4.patch ---
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 <signal.h>
+#include <sys/stat.h>
+
#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},
Index: python.spec
===================================================================
RCS file: /cvs/pkgs/rpms/python/devel/python.spec,v
retrieving revision 1.126
retrieving revision 1.127
diff -u -r1.126 -r1.127
--- python.spec 4 Jan 2008 15:29:24 -0000 1.126
+++ python.spec 7 Jan 2008 17:39:04 -0000 1.127
@@ -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 @@
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 @@
%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 @@
%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 @@
%{_libdir}/python%{pybasever}/lib-dynload/_testcapimodule.so
%changelog
+* Mon Jan 7 2008 James Antill <jantill at redhat.com> - 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 <tcallawa at redhat.com> - 2.5.1-19
- rebuild for new tcl/tk in rawhide
More information about the fedora-extras-commits
mailing list