Update to 2.6

This commit is contained in:
Ignacio Vazquez-Abrams 2008-11-29 02:03:47 +00:00
parent feaea240e3
commit a7ef9c1067
23 changed files with 225 additions and 1100 deletions

View File

@ -1 +1 @@
Python-2.5.2.tar.bz2
Python-2.6.tar.bz2

1
import.log Normal file
View File

@ -0,0 +1 @@
python-2_6-1:HEAD:python-2.6-1.src.rpm:1227924213

View File

@ -1,10 +0,0 @@
--- Python-2.3.4/Lib/pydoc.py.no-doc 2004-07-16 11:29:01.000000000 -0400
+++ Python-2.3.4/Lib/pydoc.py 2004-07-16 11:32:52.000000000 -0400
@@ -1524,6 +1524,7 @@
homedir = os.environ.get('PYTHONHOME')
for dir in [os.environ.get('PYTHONDOCS'),
homedir and os.path.join(homedir, 'doc'),
+ '/usr/share/doc/python-docs-%s/html' % split(sys.version)[0],
os.path.join(execdir, 'doc'),
'/usr/doc/python-docs-' + split(sys.version)[0],
'/usr/doc/python-' + split(sys.version)[0],

View File

@ -1,156 +0,0 @@
Index: Lib/test/test_hashlib.py
===================================================================
--- Lib/test/test_hashlib.py (revision 64642)
+++ Lib/test/test_hashlib.py (working copy)
@@ -9,8 +9,8 @@
import hashlib
import unittest
from test import test_support
+from test.test_support import _4G, precisionbigmemtest
-
def hexstr(s):
import string
h = string.hexdigits
@@ -55,7 +55,6 @@
m2.update(aas + bees + cees)
self.assertEqual(m1.digest(), m2.digest())
-
def check(self, name, data, digest):
# test the direct constructors
computed = getattr(hashlib, name)(data).hexdigest()
@@ -74,8 +73,23 @@
def test_case_md5_2(self):
self.check('md5', 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789',
'd174ab98d277d9f5a5611c2c9f419d9f')
+
+ @precisionbigmemtest(size=_4G + 5, memuse=1)
+ def test_case_md5_huge(self, size):
+ if size == _4G + 5:
+ try:
+ self.check('md5', 'A'*size, 'c9af2dff37468ce5dfee8f2cfc0a9c6d')
+ except OverflowError:
+ pass # 32-bit arch
+
+ @precisionbigmemtest(size=_4G - 1, memuse=1)
+ def test_case_md5_uintmax(self, size):
+ if size == _4G - 1:
+ try:
+ self.check('md5', 'A'*size, '28138d306ff1b8281f1a9067e1a1a2b3')
+ except OverflowError:
+ pass # 32-bit arch
-
# use the three examples from Federal Information Processing Standards
# Publication 180-1, Secure Hash Standard, 1995 April 17
# http://www.itl.nist.gov/div897/pubs/fip180-1.htm
Index: Modules/_hashopenssl.c
===================================================================
--- Modules/_hashopenssl.c (revision 64642)
+++ Modules/_hashopenssl.c (working copy)
@@ -19,7 +19,9 @@
/* EVP is the preferred interface to hashing in OpenSSL */
#include <openssl/evp.h>
+#define MUNCH_SIZE INT_MAX
+
#ifndef HASH_OBJ_CONSTRUCTOR
#define HASH_OBJ_CONSTRUCTOR 0
#endif
@@ -164,9 +166,18 @@
if (!PyArg_ParseTuple(args, "s#:update", &cp, &len))
return NULL;
+ if (len > 0 && len <= MUNCH_SIZE) {
EVP_DigestUpdate(&self->ctx, cp, Py_SAFE_DOWNCAST(len, Py_ssize_t,
unsigned int));
-
+ } else {
+ Py_ssize_t offset = 0;
+ while (len) {
+ unsigned int process = len > MUNCH_SIZE ? MUNCH_SIZE : len;
+ EVP_DigestUpdate(&self->ctx, cp + offset, process);
+ len -= process;
+ offset += process;
+ }
+ }
Py_INCREF(Py_None);
return Py_None;
}
@@ -255,10 +266,21 @@
self->name = name_obj;
Py_INCREF(self->name);
- if (cp && len)
+ if (cp && len) {
+ if (len > 0 && len <= MUNCH_SIZE) {
EVP_DigestUpdate(&self->ctx, cp, Py_SAFE_DOWNCAST(len, Py_ssize_t,
unsigned int));
-
+ } else {
+ Py_ssize_t offset = 0;
+ while (len) {
+ unsigned int process = len > MUNCH_SIZE ? MUNCH_SIZE : len;
+ EVP_DigestUpdate(&self->ctx, cp + offset, process);
+ len -= process;
+ offset += process;
+ }
+ }
+ }
+
return 0;
}
#endif
@@ -328,7 +350,7 @@
static PyObject *
EVPnew(PyObject *name_obj,
const EVP_MD *digest, const EVP_MD_CTX *initial_ctx,
- const unsigned char *cp, unsigned int len)
+ const unsigned char *cp, Py_ssize_t len)
{
EVPobject *self;
@@ -346,8 +368,20 @@
EVP_DigestInit(&self->ctx, digest);
}
- if (cp && len)
- EVP_DigestUpdate(&self->ctx, cp, len);
+ if (cp && len) {
+ if (len > 0 && len <= MUNCH_SIZE) {
+ EVP_DigestUpdate(&self->ctx, cp, Py_SAFE_DOWNCAST(len, Py_ssize_t,
+ unsigned int));
+ } else {
+ Py_ssize_t offset = 0;
+ while (len) {
+ unsigned int process = len > MUNCH_SIZE ? MUNCH_SIZE : len;
+ EVP_DigestUpdate(&self->ctx, cp + offset, process);
+ len -= process;
+ offset += process;
+ }
+ }
+ }
return (PyObject *)self;
}
@@ -384,8 +418,7 @@
digest = EVP_get_digestbyname(name);
- return EVPnew(name_obj, digest, NULL, cp, Py_SAFE_DOWNCAST(len, Py_ssize_t,
- unsigned int));
+ return EVPnew(name_obj, digest, NULL, cp, len);
}
/*
@@ -410,7 +443,7 @@
CONST_ ## NAME ## _name_obj, \
NULL, \
CONST_new_ ## NAME ## _ctx_p, \
- cp, Py_SAFE_DOWNCAST(len, Py_ssize_t, unsigned int)); \
+ cp, len); \
}
/* a PyMethodDef structure for the constructor */

View File

@ -1,11 +0,0 @@
--- Python-2.5/Lib/distutils/command/install.py.egginfo 2006-12-06 17:12:57.000000000 -0500
+++ Python-2.5/Lib/distutils/command/install.py 2006-12-06 17:13:10.000000000 -0500
@@ -601,7 +601,7 @@
('install_headers', has_headers),
('install_scripts', has_scripts),
('install_data', has_data),
- ('install_egg_info', lambda self:True),
+ ('install_egg_info', lambda self:False),
]
# class install

View File

@ -1,11 +0,0 @@
--- Python-2.5-orig/Modules/_tkinter.c 2006-08-11 22:33:36.000000000 -0400
+++ Python-2.5/Modules/_tkinter.c 2007-10-19 01:04:42.000000000 -0400
@@ -938,7 +938,7 @@
#if defined(Py_UNICODE_WIDE) && TCL_UTF_MAX == 3
Tcl_UniChar *outbuf;
Py_ssize_t i;
- assert(size < size * sizeof(Tcl_UniChar));
+ assert(size == 0 || size < size * sizeof(Tcl_UniChar));
outbuf = (Tcl_UniChar*)ckalloc(size * sizeof(Tcl_UniChar));
if (!outbuf) {
PyErr_NoMemory();

View File

@ -1,13 +0,0 @@
--- Python-2.5/Lib/xmlrpclib.py.orig 2007-04-10 10:29:14.000000000 -0400
+++ Python-2.5/Lib/xmlrpclib.py 2007-06-19 12:08:04.000000000 -0400
@@ -630,6 +630,9 @@
try:
f = self.dispatch[type(value)]
except KeyError:
- raise TypeError, "cannot marshal %s objects" % type(value)
+ if isinstance(value, object):
+ self.dump_instance(value, write)
+ else:
+ raise TypeError, "cannot marshal %s objects" % type(value)
else:
f(self, value, write)

View File

@ -1,21 +0,0 @@
diff -rup Python-2.5.1-orig/Lib/ctypes/util.py Python-2.5.1/Lib/ctypes/util.py
--- Python-2.5.1-orig/Lib/ctypes/util.py 2007-01-17 14:53:24.000000000 -0500
+++ Python-2.5.1/Lib/ctypes/util.py 2007-10-24 11:06:12.000000000 -0400
@@ -71,9 +71,13 @@ elif os.name == "posix":
if not f:
return None
cmd = "objdump -p -j .dynamic 2>/dev/null " + f
- res = re.search(r'\sSONAME\s+([^\s]+)', os.popen(cmd).read())
+ try:
+ res = re.search(r'\sSONAME\s+([^\s]+)', os.popen(cmd).read())
+ except:
+ res = None
if not res:
- return None
+ return os.path.basename(f) # This is good for GLibc, I think, and a
+ # dep on binutils is big (for live CDs).
return res.group(1)
if (sys.platform.startswith("freebsd")
Only in Python-2.5.1/Lib/ctypes: util.py~
Only in Python-2.5.1/Lib/ctypes: util.py.binutils-no-dep

View File

@ -1,44 +0,0 @@
diff -up Python-2.5.1/Modules/_ctypes/libffi/src/x86/unix64.S.execstack Python-2.5.1/Modules/_ctypes/libffi/src/x86/unix64.S
--- Python-2.5.1/Modules/_ctypes/libffi/src/x86/unix64.S.execstack 2007-08-10 10:34:06.000000000 +0200
+++ Python-2.5.1/Modules/_ctypes/libffi/src/x86/unix64.S 2007-08-10 10:34:06.000000000 +0200
@@ -410,3 +410,7 @@ ffi_closure_unix64:
.LEFDE3:
#endif /* __x86_64__ */
+
+#ifdef __ELF__
+.section .note.GNU-stack,"",%progbits
+#endif
diff -up Python-2.5.1/Modules/_ctypes/libffi/src/powerpc/sysv.S.execstack Python-2.5.1/Modules/_ctypes/libffi/src/powerpc/sysv.S
--- Python-2.5.1/Modules/_ctypes/libffi/src/powerpc/sysv.S.execstack 2007-08-10 10:39:03.000000000 +0200
+++ Python-2.5.1/Modules/_ctypes/libffi/src/powerpc/sysv.S 2007-08-10 10:39:59.000000000 +0200
@@ -215,3 +215,7 @@ END(ffi_call_SYSV)
.align 2
.LEFDE1:
#endif
+
+#ifdef __ELF__
+.section .note.GNU-stack,"",%progbits
+#endif
diff -up Python-2.5.1/Modules/_ctypes/libffi/src/powerpc/linux64_closure.S.execstack Python-2.5.1/Modules/_ctypes/libffi/src/powerpc/linux64_closure.S
--- Python-2.5.1/Modules/_ctypes/libffi/src/powerpc/linux64_closure.S.execstack 2007-08-10 10:39:23.000000000 +0200
+++ Python-2.5.1/Modules/_ctypes/libffi/src/powerpc/linux64_closure.S 2007-08-10 10:39:58.000000000 +0200
@@ -204,3 +204,7 @@ ffi_closure_LINUX64:
.align 3
.LEFDE1:
#endif
+
+#ifdef __ELF__
+.section .note.GNU-stack,"",%progbits
+#endif
diff -up Python-2.5.1/Modules/_ctypes/libffi/src/powerpc/linux64.S.execstack Python-2.5.1/Modules/_ctypes/libffi/src/powerpc/linux64.S
--- Python-2.5.1/Modules/_ctypes/libffi/src/powerpc/linux64.S.execstack 2007-08-10 10:39:13.000000000 +0200
+++ Python-2.5.1/Modules/_ctypes/libffi/src/powerpc/linux64.S 2007-08-10 10:40:01.000000000 +0200
@@ -178,3 +178,7 @@ ffi_call_LINUX64:
.align 3
.LEFDE1:
#endif
+
+#ifdef __ELF__
+.section .note.GNU-stack,"",%progbits
+#endif

View File

@ -1,33 +0,0 @@
diff -up Python-2.5.1/setup.py.db46 Python-2.5.1/setup.py
--- Python-2.5.1/setup.py.db46 2007-08-14 12:53:45.000000000 -0400
+++ Python-2.5.1/setup.py 2007-08-14 14:11:08.000000000 -0400
@@ -606,9 +606,9 @@ class PyBuildExt(build_ext):
# a release. Most open source OSes come with one or more
# versions of BerkeleyDB already installed.
- max_db_ver = (4, 5)
+ max_db_ver = (4, 6)
min_db_ver = (3, 3)
- db_setup_debug = False # verbose debug prints from this script?
+ db_setup_debug = True # verbose debug prints from this script?
# construct a list of paths to look for the header file in on
# top of the normal inc_dirs.
@@ -623,7 +623,7 @@ class PyBuildExt(build_ext):
'/sw/include/db3',
]
# 4.x minor number specific paths
- for x in (0,1,2,3,4,5):
+ for x in (0,1,2,3,4,5,6):
db_inc_paths.append('/usr/include/db4%d' % x)
db_inc_paths.append('/usr/include/db4.%d' % x)
db_inc_paths.append('/usr/local/BerkeleyDB.4.%d/include' % x)
@@ -646,7 +646,7 @@ class PyBuildExt(build_ext):
for dn in inc_dirs:
std_variants.append(os.path.join(dn, 'db3'))
std_variants.append(os.path.join(dn, 'db4'))
- for x in (0,1,2,3,4):
+ for x in (0,1,2,3,4,5,6):
std_variants.append(os.path.join(dn, "db4%d"%x))
std_variants.append(os.path.join(dn, "db4.%d"%x))
for x in (2,3):

View File

@ -1,93 +0,0 @@
diff -up Python-2.5.1/Modules/_bsddb.c.db46 Python-2.5.1/Modules/_bsddb.c
--- Python-2.5.1/Modules/_bsddb.c.db46 2007-01-04 21:09:06.000000000 -0500
+++ Python-2.5.1/Modules/_bsddb.c 2008-07-10 09:58:55.000000000 -0400
@@ -5306,11 +5306,13 @@ static PyObject*
DBEnv_getattr(DBEnvObject* self, char *name)
{
if (!strcmp(name, "db_home")) {
+ const char *home = NULL;
CHECK_ENV_NOT_CLOSED(self);
- if (self->db_env->db_home == NULL) {
+ self->db_env->get_home(self->db_env, &home);
+ if (home == NULL) {
RETURN_NONE();
}
- return PyString_FromString(self->db_env->db_home);
+ return PyString_FromString(home);
}
return Py_FindMethod(DBEnv_methods, (PyObject* )self, name);
@@ -5932,22 +5934,37 @@ DL_EXPORT(void) init_bsddb(void)
ADD_INT(d, DB_TIME_NOTGRANTED);
ADD_INT(d, DB_TXN_NOT_DURABLE);
ADD_INT(d, DB_TXN_WRITE_NOSYNC);
- ADD_INT(d, DB_LOG_AUTOREMOVE);
- ADD_INT(d, DB_DIRECT_LOG);
ADD_INT(d, DB_DIRECT_DB);
ADD_INT(d, DB_INIT_REP);
ADD_INT(d, DB_ENCRYPT);
ADD_INT(d, DB_CHKSUM);
#endif
+#if (DBVER >= 42) && (DBVER < 47)
+ ADD_INT(d, DB_LOG_AUTOREMOVE);
+ ADD_INT(d, DB_DIRECT_LOG);
+#endif
+
+#if (DBVER >= 47)
+ ADD_INT(d, DB_LOG_DIRECT);
+ ADD_INT(d, DB_LOG_DSYNC);
+ ADD_INT(d, DB_LOG_IN_MEMORY);
+ ADD_INT(d, DB_LOG_AUTO_REMOVE);
+ ADD_INT(d, DB_LOG_ZERO);
+#endif
+
#if (DBVER >= 43)
- ADD_INT(d, DB_LOG_INMEMORY);
ADD_INT(d, DB_BUFFER_SMALL);
ADD_INT(d, DB_SEQ_DEC);
ADD_INT(d, DB_SEQ_INC);
ADD_INT(d, DB_SEQ_WRAP);
#endif
+#if (DBVER >= 43) && (DBVER < 47)
+ ADD_INT(d, DB_LOG_INMEMORY);
+ ADD_INT(d, DB_DSYNC_LOG);
+#endif
+
#if (DBVER >= 41)
ADD_INT(d, DB_ENCRYPT_AES);
ADD_INT(d, DB_AUTO_COMMIT);
diff -up Python-2.5.1/setup.py.db46 Python-2.5.1/setup.py
--- Python-2.5.1/setup.py.db46 2008-07-10 09:55:08.000000000 -0400
+++ Python-2.5.1/setup.py 2008-07-10 09:55:08.000000000 -0400
@@ -606,9 +606,9 @@ class PyBuildExt(build_ext):
# a release. Most open source OSes come with one or more
# versions of BerkeleyDB already installed.
- max_db_ver = (4, 5)
+ max_db_ver = (4, 7)
min_db_ver = (3, 3)
- db_setup_debug = False # verbose debug prints from this script?
+ db_setup_debug = True # verbose debug prints from this script?
# construct a list of paths to look for the header file in on
# top of the normal inc_dirs.
@@ -623,7 +623,7 @@ class PyBuildExt(build_ext):
'/sw/include/db3',
]
# 4.x minor number specific paths
- for x in (0,1,2,3,4,5):
+ for x in (0,1,2,3,4,5,6,7):
db_inc_paths.append('/usr/include/db4%d' % x)
db_inc_paths.append('/usr/include/db4.%d' % x)
db_inc_paths.append('/usr/local/BerkeleyDB.4.%d/include' % x)
@@ -646,7 +646,7 @@ class PyBuildExt(build_ext):
for dn in inc_dirs:
std_variants.append(os.path.join(dn, 'db3'))
std_variants.append(os.path.join(dn, 'db4'))
- for x in (0,1,2,3,4):
+ for x in (0,1,2,3,4,5,6,7):
std_variants.append(os.path.join(dn, "db4%d"%x))
std_variants.append(os.path.join(dn, "db4.%d"%x))
for x in (2,3):

View File

@ -1,18 +0,0 @@
--- Python-2.5.1/Modules/posixmodule.c.orig 2007-04-04 14:30:56.000000000 -0400
+++ Python-2.5.1/Modules/posixmodule.c 2008-06-14 17:35:47.000000000 -0400
@@ -2160,7 +2160,6 @@
struct dirent *ep;
int arg_is_unicode = 1;
- errno = 0;
if (!PyArg_ParseTuple(args, "U:listdir", &v)) {
arg_is_unicode = 0;
PyErr_Clear();
@@ -2176,6 +2175,7 @@
return NULL;
}
for (;;) {
+ errno = 0;
Py_BEGIN_ALLOW_THREADS
ep = readdir(dirp);
Py_END_ALLOW_THREADS

View File

@ -1,33 +0,0 @@
diff -up Python-2.5.1/Modules/_sqlite/cache.h.pysqlite Python-2.5.1/Modules/_sqlite/cache.h
--- Python-2.5.1/Modules/_sqlite/cache.h.pysqlite 2006-04-23 16:24:26.000000000 +0100
+++ Python-2.5.1/Modules/_sqlite/cache.h 2007-10-25 11:21:31.000000000 +0100
@@ -64,7 +64,7 @@ extern PyTypeObject CacheType;
int node_init(Node* self, PyObject* args, PyObject* kwargs);
void node_dealloc(Node* self);
-int cache_init(Cache* self, PyObject* args, PyObject* kwargs);
+int pysqlite_cache_init(Cache* self, PyObject* args, PyObject* kwargs);
void cache_dealloc(Cache* self);
PyObject* cache_get(Cache* self, PyObject* args);
diff -up Python-2.5.1/Modules/_sqlite/cache.c.pysqlite Python-2.5.1/Modules/_sqlite/cache.c
--- Python-2.5.1/Modules/_sqlite/cache.c.pysqlite 2006-04-23 16:24:26.000000000 +0100
+++ Python-2.5.1/Modules/_sqlite/cache.c 2007-10-25 11:22:10.000000000 +0100
@@ -54,7 +54,7 @@ void node_dealloc(Node* self)
self->ob_type->tp_free((PyObject*)self);
}
-int cache_init(Cache* self, PyObject* args, PyObject* kwargs)
+int pysqlite_cache_init(Cache* self, PyObject* args, PyObject* kwargs)
{
PyObject* factory;
int size = 10;
@@ -352,7 +352,7 @@ PyTypeObject CacheType = {
0, /* tp_descr_get */
0, /* tp_descr_set */
0, /* tp_dictoffset */
- (initproc)cache_init, /* tp_init */
+ (initproc)pysqlite_cache_init, /* tp_init */
0, /* tp_alloc */
0, /* tp_new */
0 /* tp_free */

View File

@ -1,78 +0,0 @@
diff -ru Python-2.5.2-orig/Modules/_bsddb.c Python-2.5.2/Modules/_bsddb.c
--- Python-2.5.2-orig/Modules/_bsddb.c 2008-02-03 02:26:23.000000000 -0500
+++ Python-2.5.2/Modules/_bsddb.c 2008-09-24 17:01:50.000000000 -0400
@@ -5335,11 +5335,13 @@
DBEnv_getattr(DBEnvObject* self, char *name)
{
if (!strcmp(name, "db_home")) {
+ const char *home = NULL;
CHECK_ENV_NOT_CLOSED(self);
- if (self->db_env->db_home == NULL) {
+ self->db_env->get_home(self->db_env, &home);
+ if (home == NULL) {
RETURN_NONE();
}
- return PyString_FromString(self->db_env->db_home);
+ return PyString_FromString(home);
}
return Py_FindMethod(DBEnv_methods, (PyObject* )self, name);
@@ -5961,22 +5963,37 @@
ADD_INT(d, DB_TIME_NOTGRANTED);
ADD_INT(d, DB_TXN_NOT_DURABLE);
ADD_INT(d, DB_TXN_WRITE_NOSYNC);
- ADD_INT(d, DB_LOG_AUTOREMOVE);
- ADD_INT(d, DB_DIRECT_LOG);
ADD_INT(d, DB_DIRECT_DB);
ADD_INT(d, DB_INIT_REP);
ADD_INT(d, DB_ENCRYPT);
ADD_INT(d, DB_CHKSUM);
#endif
+#if (DBVER >= 42) && (DBVER < 47)
+ ADD_INT(d, DB_LOG_AUTOREMOVE);
+ ADD_INT(d, DB_DIRECT_LOG);
+#endif
+
+#if (DBVER >= 47)
+ ADD_INT(d, DB_LOG_DIRECT);
+ ADD_INT(d, DB_LOG_DSYNC);
+ ADD_INT(d, DB_LOG_IN_MEMORY);
+ ADD_INT(d, DB_LOG_AUTO_REMOVE);
+ ADD_INT(d, DB_LOG_ZERO);
+#endif
+
#if (DBVER >= 43)
- ADD_INT(d, DB_LOG_INMEMORY);
ADD_INT(d, DB_BUFFER_SMALL);
ADD_INT(d, DB_SEQ_DEC);
ADD_INT(d, DB_SEQ_INC);
ADD_INT(d, DB_SEQ_WRAP);
#endif
+#if (DBVER >= 43) && (DBVER < 47)
+ ADD_INT(d, DB_LOG_INMEMORY);
+ ADD_INT(d, DB_DSYNC_LOG);
+#endif
+
#if (DBVER >= 41)
ADD_INT(d, DB_ENCRYPT_AES);
ADD_INT(d, DB_AUTO_COMMIT);
diff -ru Python-2.5.2-orig/setup.py Python-2.5.2/setup.py
--- Python-2.5.2-orig/setup.py 2008-09-24 17:01:02.000000000 -0400
+++ Python-2.5.2/setup.py 2008-09-24 17:03:05.000000000 -0400
@@ -608,12 +608,12 @@
# a release. Most open source OSes come with one or more
# versions of BerkeleyDB already installed.
- max_db_ver = (4, 5)
+ max_db_ver = (4, 7)
# NOTE: while the _bsddb.c code links against BerkeleyDB 4.6.x
# we leave that version disabled by default as it has proven to be
# quite a buggy library release on many platforms.
min_db_ver = (3, 3)
- db_setup_debug = False # verbose debug prints from this script?
+ db_setup_debug = True # verbose debug prints from this script?
# construct a list of paths to look for the header file in on
# top of the normal inc_dirs.

View File

@ -1,86 +0,0 @@
diff -ru Python-2.5.2-orig/Modules/signalmodule.c Python-2.5.2/Modules/signalmodule.c
--- Python-2.5.2-orig/Modules/signalmodule.c 2007-12-10 18:03:55.000000000 -0500
+++ Python-2.5.2/Modules/signalmodule.c 2008-09-24 17:32:45.000000000 -0400
@@ -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 @@
PyObject *func;
} Handlers[NSIG];
+static int wakeup_fd = -1;
+
/* Speed up sigcheck() when none tripped */
static volatile sig_atomic_t is_tripped = 0;
@@ -113,6 +117,7 @@
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) {
@@ -128,6 +133,8 @@
cleared in PyErr_CheckSignals() before .tripped. */
is_tripped = 1;
Py_AddPendingCall(checksignals_witharg, NULL);
+ if (wakeup_fd != -1)
+ write(wakeup_fd, &dummy_byte, 1);
#ifdef WITH_THREAD
}
#endif
@@ -267,6 +274,39 @@
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
@@ -274,6 +314,7 @@
#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},

View File

@ -1,221 +0,0 @@
diff -ru Python-2.5-orig/Modules/imageop.c Python-2.5/Modules/imageop.c
--- Python-2.5-orig/Modules/imageop.c 2006-01-19 01:09:39.000000000 -0500
+++ Python-2.5/Modules/imageop.c 2007-10-19 01:11:33.000000000 -0400
@@ -78,7 +78,7 @@
char *cp, *ncp;
short *nsp;
Py_Int32 *nlp;
- int len, size, x, y, newx1, newx2, newy1, newy2;
+ int len, size, x, y, newx1, newx2, newy1, newy2, nlen;
int ix, iy, xstep, ystep;
PyObject *rv;
@@ -90,13 +90,19 @@
PyErr_SetString(ImageopError, "Size should be 1, 2 or 4");
return 0;
}
- if ( len != size*x*y ) {
+ if (( len != size*x*y ) ||
+ ( size != ((len / x) / y) )) {
PyErr_SetString(ImageopError, "String has incorrect length");
return 0;
}
xstep = (newx1 < newx2)? 1 : -1;
ystep = (newy1 < newy2)? 1 : -1;
+ nlen = (abs(newx2-newx1)+1)*(abs(newy2-newy1)+1)*size;
+ if ( size != ((nlen / (abs(newx2-newx1)+1)) / (abs(newy2-newy1)+1)) ) {
+ PyErr_SetString(ImageopError, "String has incorrect length");
+ return 0;
+ }
rv = PyString_FromStringAndSize(NULL,
(abs(newx2-newx1)+1)*(abs(newy2-newy1)+1)*size);
if ( rv == 0 )
@@ -132,7 +138,7 @@
char *cp, *ncp;
short *nsp;
Py_Int32 *nlp;
- int len, size, x, y, newx, newy;
+ int len, size, x, y, newx, newy, nlen;
int ix, iy;
int oix, oiy;
PyObject *rv;
@@ -145,12 +151,18 @@
PyErr_SetString(ImageopError, "Size should be 1, 2 or 4");
return 0;
}
- if ( len != size*x*y ) {
+ if ( ( len != size*x*y ) ||
+ ( size != ((len / x) / y) ) ) {
+ PyErr_SetString(ImageopError, "String has incorrect length");
+ return 0;
+ }
+ nlen = newx*newy*size;
+ if ( size != ((nlen / newx) / newy) ) {
PyErr_SetString(ImageopError, "String has incorrect length");
return 0;
}
- rv = PyString_FromStringAndSize(NULL, newx*newy*size);
+ rv = PyString_FromStringAndSize(NULL, nlen);
if ( rv == 0 )
return 0;
ncp = (char *)PyString_AsString(rv);
@@ -190,7 +202,8 @@
PyErr_SetString(ImageopError, "Size should be 1 or 4");
return 0;
}
- if ( maxx*maxy*width != len ) {
+ if ( ( maxx*maxy*width != len ) ||
+ ( maxx != ((len / maxy) / width) ) ) {
PyErr_SetString(ImageopError, "String has incorrect length");
return 0;
}
@@ -240,7 +253,8 @@
if ( !PyArg_ParseTuple(args, "s#iii", &cp, &len, &x, &y, &tres) )
return 0;
- if ( x*y != len ) {
+ if ( ( x*y != len ) ||
+ ( x != len / y ) ) {
PyErr_SetString(ImageopError, "String has incorrect length");
return 0;
}
@@ -281,7 +295,8 @@
if ( !PyArg_ParseTuple(args, "s#ii", &cp, &len, &x, &y) )
return 0;
- if ( x*y != len ) {
+ if ( ( x*y != len ) ||
+ ( x != len / y ) ) {
PyErr_SetString(ImageopError, "String has incorrect length");
return 0;
}
@@ -320,7 +335,8 @@
if ( !PyArg_ParseTuple(args, "s#ii", &cp, &len, &x, &y) )
return 0;
- if ( x*y != len ) {
+ if ( ( x*y != len ) ||
+ ( x != len / y ) ) {
PyErr_SetString(ImageopError, "String has incorrect length");
return 0;
}
@@ -358,7 +374,8 @@
if ( !PyArg_ParseTuple(args, "s#ii", &cp, &len, &x, &y) )
return 0;
- if ( x*y != len ) {
+ if ( ( x*y != len ) ||
+ ( x != len / y ) ) {
PyErr_SetString(ImageopError, "String has incorrect length");
return 0;
}
@@ -404,7 +421,8 @@
if ( !PyArg_ParseTuple(args, "s#ii", &cp, &len, &x, &y) )
return 0;
- if ( x*y != len ) {
+ if ( ( x*y != len ) ||
+ ( x != len / y ) ) {
PyErr_SetString(ImageopError, "String has incorrect length");
return 0;
}
@@ -443,7 +461,11 @@
if ( !PyArg_ParseTuple(args, "s#iiii", &cp, &len, &x, &y, &v0, &v1) )
return 0;
- nlen = x*y;
+ nlen = x*y;
+ if ( x != (nlen / y) ) {
+ PyErr_SetString(ImageopError, "String has incorrect length");
+ return 0;
+ }
if ( (nlen+7)/8 != len ) {
PyErr_SetString(ImageopError, "String has incorrect length");
return 0;
@@ -481,6 +503,10 @@
return 0;
nlen = x*y;
+ if ( x != (nlen / y) ) {
+ PyErr_SetString(ImageopError, "String has incorrect length");
+ return 0;
+ }
if ( (nlen+3)/4 != len ) {
PyErr_SetString(ImageopError, "String has incorrect length");
return 0;
@@ -517,6 +543,10 @@
return 0;
nlen = x*y;
+ if ( x != (nlen / y) ) {
+ PyErr_SetString(ImageopError, "String has incorrect length");
+ return 0;
+ }
if ( (nlen+1)/2 != len ) {
PyErr_SetString(ImageopError, "String has incorrect length");
return 0;
@@ -554,6 +584,10 @@
return 0;
nlen = x*y;
+ if ( x != (nlen / y) ) {
+ PyErr_SetString(ImageopError, "String has incorrect length");
+ return 0;
+ }
if ( nlen*4 != len ) {
PyErr_SetString(ImageopError, "String has incorrect length");
return 0;
@@ -598,6 +632,10 @@
return 0;
nlen = x*y;
+ if ( x != (nlen / y) ) {
+ PyErr_SetString(ImageopError, "String has incorrect length");
+ return 0;
+ }
if ( nlen != len ) {
PyErr_SetString(ImageopError, "String has incorrect length");
return 0;
@@ -648,6 +686,10 @@
return 0;
nlen = x*y;
+ if ( x != (nlen / y) ) {
+ PyErr_SetString(ImageopError, "String has incorrect length");
+ return 0;
+ }
if ( nlen*4 != len ) {
PyErr_SetString(ImageopError, "String has incorrect length");
return 0;
@@ -693,6 +735,10 @@
return 0;
nlen = x*y;
+ if ( x != (nlen / y) ) {
+ PyErr_SetString(ImageopError, "String has incorrect length");
+ return 0;
+ }
if ( nlen != len ) {
PyErr_SetString(ImageopError, "String has incorrect length");
return 0;
Only in Python-2.5/Modules: imageop.c~
Only in Python-2.5/Modules: imageop.c.cve2007-4965
diff -ru Python-2.5-orig/Modules/rgbimgmodule.c Python-2.5/Modules/rgbimgmodule.c
--- Python-2.5-orig/Modules/rgbimgmodule.c 2006-08-11 23:18:50.000000000 -0400
+++ Python-2.5/Modules/rgbimgmodule.c 2007-10-19 01:05:44.000000000 -0400
@@ -299,6 +299,11 @@
xsize = image.xsize;
ysize = image.ysize;
zsize = image.zsize;
+ tablen = xsize * ysize * zsize * sizeof(Py_Int32);
+ if (xsize != (((tablen / ysize) / zsize) / sizeof(Py_Int32))) {
+ PyErr_NoMemory();
+ goto finally;
+ }
if (rle) {
tablen = ysize * zsize * sizeof(Py_Int32);
starttab = (Py_Int32 *)malloc(tablen);
Only in Python-2.5/Modules: rgbimgmodule.c.cve2007-4965
Only in Python-2.5/Modules: _tkinter.c.tkinter

View File

@ -1,8 +1,22 @@
--- Python-2.4.1/pyconfig.h.in.canonicalize 2004-10-13 11:30:55.000000000 -0400
+++ Python-2.4.1/pyconfig.h.in 2005-10-06 14:04:06.000000000 -0400
@@ -58,6 +58,9 @@
/* Define if pthread_sigmask() does not work on your system. */
#undef HAVE_BROKEN_PTHREAD_SIGMASK
diff -up Python-2.6/configure.in.canonicalize Python-2.6/configure.in
--- Python-2.6/configure.in.canonicalize 2008-09-07 15:18:16.000000000 -0400
+++ Python-2.6/configure.in 2008-11-24 02:09:29.000000000 -0500
@@ -2445,7 +2445,8 @@ fi
AC_MSG_RESULT(MACHDEP_OBJS)
# checks for library functions
-AC_CHECK_FUNCS(alarm setitimer getitimer bind_textdomain_codeset chown \
+AC_CHECK_FUNCS(alarm setitimer getitimer bind_textdomain_codeset \
+ canonicalize_file_name chown \
clock confstr ctermid execv fchmod fchown fork fpathconf ftime ftruncate \
gai_strerror getgroups getlogin getloadavg getpeername getpgid getpid \
getpriority getpwent getspnam getspent getsid getwd \
diff -up Python-2.6/pyconfig.h.in.canonicalize Python-2.6/pyconfig.h.in
--- Python-2.6/pyconfig.h.in.canonicalize 2008-09-07 01:15:18.000000000 -0400
+++ Python-2.6/pyconfig.h.in 2008-11-24 02:07:11.000000000 -0500
@@ -79,6 +79,9 @@
/* Define to 1 if you have the `chflags' function. */
#undef HAVE_CHFLAGS
+/* Define to 1 if you have the `canonicalize_file_name' function. */
+#undef HAVE_CANONICALIZE_FILE_NAME
@ -10,9 +24,10 @@
/* Define to 1 if you have the `chown' function. */
#undef HAVE_CHOWN
--- Python-2.4.1/Python/sysmodule.c.canonicalize 2005-01-27 13:58:30.000000000 -0500
+++ Python-2.4.1/Python/sysmodule.c 2005-10-06 14:56:37.000000000 -0400
@@ -1168,11 +1168,13 @@
diff -up Python-2.6/Python/sysmodule.c.canonicalize Python-2.6/Python/sysmodule.c
--- Python-2.6/Python/sysmodule.c.canonicalize 2008-07-10 13:13:55.000000000 -0400
+++ Python-2.6/Python/sysmodule.c 2008-11-24 02:07:11.000000000 -0500
@@ -1524,11 +1524,13 @@ makeargvobject(int argc, char **argv)
void
PySys_SetArgv(int argc, char **argv)
{
@ -26,9 +41,9 @@
PyObject *av = makeargvobject(argc, argv);
PyObject *path = PySys_GetObject("path");
if (av == NULL)
@@ -1184,6 +1186,64 @@
@@ -1540,6 +1542,64 @@ PySys_SetArgv(int argc, char **argv)
char *p = NULL;
int n = 0;
Py_ssize_t n = 0;
PyObject *a;
+#ifdef HAVE_CANONICALIZE_FILE_NAME
+ char *link = NULL, *argv0copy = NULL;
@ -91,7 +106,7 @@
#ifdef HAVE_READLINK
char link[MAXPATHLEN+1];
char argv0copy[2*MAXPATHLEN+1];
@@ -1256,9 +1316,14 @@
@@ -1612,9 +1672,14 @@ PySys_SetArgv(int argc, char **argv)
#endif /* Unix */
}
#endif /* All others */
@ -106,16 +121,3 @@
if (PyList_Insert(path, 0, a) < 0)
Py_FatalError("sys.path.insert(0) failed");
Py_DECREF(a);
--- Python-2.4.1/configure.in.canonicalize 2005-03-28 18:23:34.000000000 -0500
+++ Python-2.4.1/configure.in 2005-10-06 14:04:06.000000000 -0400
@@ -2096,8 +2096,8 @@
AC_MSG_RESULT(MACHDEP_OBJS)
# checks for library functions
-AC_CHECK_FUNCS(alarm bind_textdomain_codeset chown clock confstr ctermid \
- execv fork fpathconf ftime ftruncate \
+AC_CHECK_FUNCS(alarm bind_textdomain_codeset canonicalize_file_name chown \
+ clock confstr ctermid execv fork fpathconf ftime ftruncate \
gai_strerror getgroups getlogin getloadavg getpeername getpgid getpid \
getpriority getpwent getsid getwd \
kill killpg lchown lstat mkfifo mknod mktime \

View File

@ -1,5 +1,6 @@
--- Python-2.5.1/Include/pyexpat.h.rhconfig 2006-06-19 19:21:25.000000000 -0400
+++ Python-2.5.1/Include/pyexpat.h 2007-06-27 10:12:45.000000000 -0400
diff -up Python-2.6/Include/pyexpat.h.rhconfig Python-2.6/Include/pyexpat.h
--- Python-2.6/Include/pyexpat.h.rhconfig 2006-06-19 19:21:25.000000000 -0400
+++ Python-2.6/Include/pyexpat.h 2008-11-24 02:00:47.000000000 -0500
@@ -5,6 +5,19 @@
#define PyExpat_CAPI_MAGIC "pyexpat.expat_CAPI 1.0"
@ -20,9 +21,10 @@
struct PyExpat_CAPI
{
char* magic; /* set to PyExpat_CAPI_MAGIC */
--- Python-2.5.1/Modules/Setup.dist.rhconfig 2006-08-06 03:26:21.000000000 -0400
+++ Python-2.5.1/Modules/Setup.dist 2007-06-27 10:12:45.000000000 -0400
@@ -149,7 +149,7 @@ GLHACK=-Dclear=__GLclear
diff -up Python-2.6/Modules/Setup.dist.rhconfig Python-2.6/Modules/Setup.dist
--- Python-2.6/Modules/Setup.dist.rhconfig 2008-09-21 03:31:52.000000000 -0400
+++ Python-2.6/Modules/Setup.dist 2008-11-24 02:03:41.000000000 -0500
@@ -152,7 +152,7 @@ GLHACK=-Dclear=__GLclear
# modules are to be built as shared libraries (see above for more
# detail; also note that *static* reverses this effect):
@ -31,12 +33,12 @@
# GNU readline. Unlike previous Python incarnations, GNU readline is
# now incorporated in an optional module, configured in the Setup file
@@ -159,69 +159,69 @@ GLHACK=-Dclear=__GLclear
@@ -162,69 +162,69 @@ GLHACK=-Dclear=__GLclear
# it, depending on your system -- see the GNU readline instructions.
# It's okay for this to be a shared library, too.
-#readline readline.c -lreadline -ltermcap
+readline readline.c -lreadline -lncursesw
+readline readline.c -lreadline -ltermcap
# Modules that should always be present (non UNIX dependent):
@ -50,7 +52,7 @@
-#_weakref _weakref.c # basic weak reference support
-#_testcapi _testcapimodule.c # Python C API test module
-#_random _randommodule.c # Random number generator
-#collections collectionsmodule.c # Container types
-#_collections _collectionsmodule.c # Container types
-#itertools itertoolsmodule.c # Functions creating iterators for efficient looping
-#strop stropmodule.c # String manipulations
+array arraymodule.c # array objects
@ -62,7 +64,7 @@
+_weakref _weakref.c # basic weak reference support
+_testcapi _testcapimodule.c # Python C API test module
+_random _randommodule.c # Random number generator
+collections collectionsmodule.c # Container types
+_collections _collectionsmodule.c # Container types
+itertools itertoolsmodule.c # Functions creating iterators for efficient looping
+strop stropmodule.c # String manipulations
@ -115,7 +117,7 @@
# First, look at Setup.config; configure may have set this for you.
-#crypt cryptmodule.c # -lcrypt # crypt(3); needs -lcrypt on some systems
+crypt cryptmodule.c -lcrypt # crypt(3); needs -lcrypt on some systems
+crypt cryptmodule.c # -lcrypt # crypt(3); needs -lcrypt on some systems
# Some more UNIX dependent modules -- off by default, since these
@ -130,20 +132,18 @@
# Multimedia modules -- off by default.
@@ -229,9 +229,9 @@ GLHACK=-Dclear=__GLclear
@@ -232,8 +232,8 @@ GLHACK=-Dclear=__GLclear
# #993173 says audioop works on 64-bit platforms, though.
# These represent audio samples or images as strings:
-#audioop audioop.c # Operations on audio samples
-#imageop imageop.c # Operations on images
-#rgbimg rgbimgmodule.c # Read SGI RGB image files (but coded portably)
+audioop audioop.c # Operations on audio samples
+imageop imageop.c # Operations on images
+rgbimg rgbimgmodule.c # Read SGI RGB image files (but coded portably)
# Note that the _md5 and _sha modules are normally only built if the
@@ -241,12 +241,12 @@ GLHACK=-Dclear=__GLclear
@@ -243,14 +243,14 @@ GLHACK=-Dclear=__GLclear
# Message-Digest Algorithm, described in RFC 1321. The necessary files
# md5.c and md5.h are included here.
@ -151,14 +151,18 @@
+_md5 md5module.c md5.c
# The _sha module implements the SHA checksum algorithm.
# (NIST's Secure Hash Algorithm.)
# The _sha module implements the SHA checksum algorithms.
# (NIST's Secure Hash Algorithms.)
-#_sha shamodule.c
-#_sha256 sha256module.c
-#_sha512 sha512module.c
+_sha shamodule.c
+_sha256 sha256module.c
+_sha512 sha512module.c
# SGI IRIX specific modules -- off by default.
@@ -293,12 +293,12 @@ GLHACK=-Dclear=__GLclear
@@ -297,12 +297,12 @@ GLHACK=-Dclear=__GLclear
# A Linux specific module -- off by default; this may also work on
# some *BSDs.
@ -173,7 +177,7 @@
# The _tkinter module.
@@ -313,7 +313,7 @@ GLHACK=-Dclear=__GLclear
@@ -317,7 +317,7 @@ GLHACK=-Dclear=__GLclear
# every system.
# *** Always uncomment this (leave the leading underscore in!):
@ -182,7 +186,7 @@
# *** Uncomment and edit to reflect where your Tcl/Tk libraries are:
# -L/usr/local/lib \
# *** Uncomment and edit to reflect where your Tcl/Tk headers are:
@@ -323,7 +323,7 @@ GLHACK=-Dclear=__GLclear
@@ -327,7 +327,7 @@ GLHACK=-Dclear=__GLclear
# *** Or uncomment this for Solaris:
# -I/usr/openwin/include \
# *** Uncomment and edit for Tix extension only:
@ -191,7 +195,7 @@
# *** Uncomment and edit for BLT extension only:
# -DWITH_BLT -I/usr/local/blt/blt8.0-unoff/include -lBLT8.0 \
# *** Uncomment and edit for PIL (TkImaging) extension only:
@@ -332,7 +332,7 @@ GLHACK=-Dclear=__GLclear
@@ -336,7 +336,7 @@ GLHACK=-Dclear=__GLclear
# *** Uncomment and edit for TOGL extension only:
# -DWITH_TOGL togl.c \
# *** Uncomment and edit to reflect your Tcl/Tk versions:
@ -200,7 +204,7 @@
# *** Uncomment and edit to reflect where your X11 libraries are:
# -L/usr/X11R6/lib \
# *** Or uncomment this for Solaris:
@@ -342,7 +342,7 @@ GLHACK=-Dclear=__GLclear
@@ -346,7 +346,7 @@ GLHACK=-Dclear=__GLclear
# *** Uncomment for AIX:
# -lld \
# *** Always uncomment this; X11 libraries to link with:
@ -209,7 +213,7 @@
# Lance Ellinghaus's syslog module
#syslog syslogmodule.c # syslog daemon interface
@@ -354,9 +354,9 @@ GLHACK=-Dclear=__GLclear
@@ -358,9 +358,9 @@ GLHACK=-Dclear=__GLclear
#
# First, look at Setup.config; configure may have set this for you.
@ -221,7 +225,7 @@
# Generic (SunOS / SVR4) dynamic loading module.
@@ -364,7 +364,7 @@ GLHACK=-Dclear=__GLclear
@@ -368,7 +368,7 @@ GLHACK=-Dclear=__GLclear
# it is a highly experimental and dangerous device for calling
# *arbitrary* C functions in *arbitrary* shared libraries:
@ -230,7 +234,7 @@
# Modules that provide persistent dictionary-like semantics. You will
@@ -387,7 +387,7 @@ GLHACK=-Dclear=__GLclear
@@ -391,7 +391,7 @@ GLHACK=-Dclear=__GLclear
#
# First, look at Setup.config; configure may have set this for you.
@ -239,7 +243,7 @@
# Sleepycat Berkeley DB interface.
@@ -402,11 +402,10 @@ GLHACK=-Dclear=__GLclear
@@ -406,11 +406,10 @@ GLHACK=-Dclear=__GLclear
#
# Edit the variables DB and DBLIBVERto point to the db top directory
# and the subdirectory of PORT where you built it.
@ -255,7 +259,7 @@
# Historical Berkeley DB 1.85
#
@@ -421,14 +420,14 @@ GLHACK=-Dclear=__GLclear
@@ -425,14 +424,14 @@ GLHACK=-Dclear=__GLclear
# Helper module for various ascii-encoders
@ -274,7 +278,7 @@
# Lee Busby's SIGFPE modules.
@@ -451,7 +450,7 @@ GLHACK=-Dclear=__GLclear
@@ -455,7 +454,7 @@ GLHACK=-Dclear=__GLclear
# Andrew Kuchling's zlib module.
# This require zlib 1.1.3 (or later).
# See http://www.gzip.org/zlib/
@ -283,7 +287,7 @@
# Interface to the Expat XML parser
#
@@ -465,20 +464,20 @@ GLHACK=-Dclear=__GLclear
@@ -469,20 +468,20 @@ GLHACK=-Dclear=__GLclear
# More information on Expat can be found at www.libexpat.org.
#
#EXPAT_DIR=/usr/local/src/expat-1.95.2
@ -312,9 +316,10 @@
# Example -- included for reference only:
# xx xxmodule.c
--- Python-2.5.1/setup.py.rhconfig 2007-06-27 10:26:41.000000000 -0400
+++ Python-2.5.1/setup.py 2007-06-27 10:26:51.000000000 -0400
@@ -998,7 +998,6 @@ class PyBuildExt(build_ext):
diff -up Python-2.6/setup.py.rhconfig Python-2.6/setup.py
--- Python-2.6/setup.py.rhconfig 2008-09-29 20:15:45.000000000 -0400
+++ Python-2.6/setup.py 2008-11-24 02:00:47.000000000 -0500
@@ -1189,7 +1189,6 @@ class PyBuildExt(build_ext):
exts.append(Extension('pyexpat',
define_macros = define_macros,
@ -322,11 +327,11 @@
sources = ['pyexpat.c',
'expat/xmlparse.c',
'expat/xmlrole.c',
@@ -1013,7 +1012,6 @@ class PyBuildExt(build_ext):
@@ -1204,7 +1203,6 @@ class PyBuildExt(build_ext):
define_macros.append(('USE_PYEXPAT_CAPI', None))
exts.append(Extension('_elementtree',
define_macros = define_macros,
- include_dirs = [expatinc],
sources = ['_elementtree.c'],
))
else:

View File

@ -1,6 +1,7 @@
--- Python-2.5b1/Lib/distutils/command/install.py.lib64 2006-03-27 16:55:21.000000000 -0500
+++ Python-2.5b1/Lib/distutils/command/install.py 2006-06-22 12:20:35.000000000 -0400
@@ -39,14 +39,14 @@
diff -up Python-2.6/Lib/distutils/command/install.py.lib64 Python-2.6/Lib/distutils/command/install.py
--- Python-2.6/Lib/distutils/command/install.py.lib64 2008-05-06 18:41:46.000000000 -0400
+++ Python-2.6/Lib/distutils/command/install.py 2008-11-24 02:34:04.000000000 -0500
@@ -42,14 +42,14 @@ else:
INSTALL_SCHEMES = {
'unix_prefix': {
'purelib': '$base/lib/python$py_version_short/site-packages',
@ -17,9 +18,10 @@
'headers': '$base/include/python/$dist_name',
'scripts': '$base/bin',
'data' : '$base',
--- Python-2.5b1/Lib/distutils/sysconfig.py.lib64 2006-05-23 08:01:11.000000000 -0400
+++ Python-2.5b1/Lib/distutils/sysconfig.py 2006-06-22 12:20:35.000000000 -0400
@@ -99,8 +99,12 @@
diff -up Python-2.6/Lib/distutils/sysconfig.py.lib64 Python-2.6/Lib/distutils/sysconfig.py
--- Python-2.6/Lib/distutils/sysconfig.py.lib64 2008-06-05 08:58:24.000000000 -0400
+++ Python-2.6/Lib/distutils/sysconfig.py 2008-11-24 02:34:04.000000000 -0500
@@ -115,8 +115,12 @@ def get_python_lib(plat_specific=0, stan
prefix = plat_specific and EXEC_PREFIX or PREFIX
if os.name == "posix":
@ -33,63 +35,30 @@
if standard_lib:
return libpython
else:
--- Python-2.5b1/Lib/site.py.lib64 2006-06-12 04:23:02.000000000 -0400
+++ Python-2.5b1/Lib/site.py 2006-06-22 12:20:35.000000000 -0400
@@ -182,9 +182,14 @@
sitedirs = [os.path.join(prefix, "Lib", "site-packages")]
elif os.sep == '/':
sitedirs = [os.path.join(prefix,
- "lib",
+ "lib64",
"python" + sys.version[:3],
"site-packages"),
+ os.path.join(prefix,
+ "lib",
+ "python" + sys.version[:3],
+ "site-packages"),
+ os.path.join(prefix, "lib64", "site-python"),
os.path.join(prefix, "lib", "site-python")]
else:
sitedirs = [prefix, os.path.join(prefix, "lib", "site-packages")]
--- Python-2.5b1/setup.py.lib64 2006-06-05 19:38:06.000000000 -0400
+++ Python-2.5b1/setup.py 2006-06-22 12:22:14.000000000 -0400
@@ -244,7 +244,7 @@
diff -up Python-2.6/Lib/site.py.lib64 Python-2.6/Lib/site.py
--- Python-2.6/Lib/site.py.lib64 2008-05-10 13:36:24.000000000 -0400
+++ Python-2.6/Lib/site.py 2008-11-24 02:35:51.000000000 -0500
@@ -265,12 +265,16 @@ def addsitepackages(known_paths):
if sys.platform in ('os2emx', 'riscos'):
sitedirs.append(os.path.join(prefix, "Lib", "site-packages"))
elif os.sep == '/':
+ sitedirs.append(os.path.join(prefix, "lib64",
+ "python" + sys.version[:3],
+ "site-packages"))
sitedirs.append(os.path.join(prefix, "lib",
"python" + sys.version[:3],
"site-packages"))
sitedirs.append(os.path.join(prefix, "lib", "site-python"))
else:
sitedirs.append(prefix)
+ sitedirs.append(os.path.join(prefix, "lib64", "site-packages"))
sitedirs.append(os.path.join(prefix, "lib", "site-packages"))
def detect_modules(self):
# Ensure that /usr/local is always used
- add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
+ add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib64')
add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
# Add paths specified in the environment variables LDFLAGS and
@@ -496,11 +496,11 @@
elif self.compiler.find_library_file(lib_dirs, 'curses'):
readline_libs.append('curses')
elif self.compiler.find_library_file(lib_dirs +
- ['/usr/lib/termcap'],
+ ['/usr/lib64/termcap'],
'termcap'):
readline_libs.append('termcap')
exts.append( Extension('readline', ['readline.c'],
- library_dirs=['/usr/lib/termcap'],
+ library_dirs=['/usr/lib64/termcap'],
extra_link_args=readline_extra_link_args,
libraries=readline_libs) )
if platform not in ['mac']:
@@ -532,8 +532,8 @@
if krb5_h:
ssl_incs += krb5_h
ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs,
- ['/usr/local/ssl/lib',
- '/usr/contrib/ssl/lib/'
+ ['/usr/local/ssl/lib64',
+ '/usr/contrib/ssl/lib64/'
] )
if (ssl_incs is not None and
--- Python-2.5b1/Makefile.pre.in.lib64 2006-06-11 15:45:57.000000000 -0400
+++ Python-2.5b1/Makefile.pre.in 2006-06-22 12:20:34.000000000 -0400
@@ -84,11 +84,11 @@
if sys.platform == "darwin":
diff -up Python-2.6/Makefile.pre.in.lib64 Python-2.6/Makefile.pre.in
--- Python-2.6/Makefile.pre.in.lib64 2008-11-24 02:34:04.000000000 -0500
+++ Python-2.6/Makefile.pre.in 2008-11-24 02:34:04.000000000 -0500
@@ -87,11 +87,11 @@ datarootdir= @datarootdir@
# Expanded directories
BINDIR= $(exec_prefix)/bin
@ -103,28 +72,9 @@
# Detailed destination directories
BINLIBDEST= $(LIBDIR)/python$(VERSION)
--- Python-2.5b1/Modules/Setup.dist.lib64 2006-06-22 12:20:34.000000000 -0400
+++ Python-2.5b1/Modules/Setup.dist 2006-06-22 12:20:35.000000000 -0400
@@ -401,7 +401,7 @@
# and the subdirectory of PORT where you built it.
DBLIBVER=4.3
DBINC=/usr/include/db4
-DBLIB=/usr/lib
+DBLIB=/usr/lib64
_bsddb _bsddb.c -I$(DBINC) -L$(DBLIB) -ldb-$(DBLIBVER)
# Historical Berkeley DB 1.85
@@ -447,7 +447,7 @@
# Andrew Kuchling's zlib module.
# This require zlib 1.1.3 (or later).
# See http://www.gzip.org/zlib/
-zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz
+zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib64 -lz
# Interface to the Expat XML parser
#
--- Python-2.5b1/Modules/getpath.c.lib64 2006-04-12 22:06:09.000000000 -0400
+++ Python-2.5b1/Modules/getpath.c 2006-06-22 12:20:35.000000000 -0400
diff -up Python-2.6/Modules/getpath.c.lib64 Python-2.6/Modules/getpath.c
--- Python-2.6/Modules/getpath.c.lib64 2007-03-10 02:38:14.000000000 -0500
+++ Python-2.6/Modules/getpath.c 2008-11-24 02:34:04.000000000 -0500
@@ -117,8 +117,8 @@
#endif
@ -136,7 +86,7 @@
#endif
#ifndef LANDMARK
@@ -129,7 +129,7 @@
@@ -129,7 +129,7 @@ static char prefix[MAXPATHLEN+1];
static char exec_prefix[MAXPATHLEN+1];
static char progpath[MAXPATHLEN+1];
static char *module_search_path = NULL;
@ -145,7 +95,7 @@
static void
reduce(char *dir)
@@ -524,7 +524,7 @@
@@ -524,7 +524,7 @@ calculate_path(void)
}
else
strncpy(zip_path, PREFIX, MAXPATHLEN);
@ -154,7 +104,7 @@
bufsz = strlen(zip_path); /* Replace "00" with version */
zip_path[bufsz - 6] = VERSION[0];
zip_path[bufsz - 5] = VERSION[2];
@@ -534,7 +534,7 @@
@@ -534,7 +534,7 @@ calculate_path(void)
fprintf(stderr,
"Could not find platform dependent libraries <exec_prefix>\n");
strncpy(exec_prefix, EXEC_PREFIX, MAXPATHLEN);
@ -163,3 +113,61 @@
}
/* If we found EXEC_PREFIX do *not* reduce it! (Yet.) */
diff -up Python-2.6/Modules/Setup.dist.lib64 Python-2.6/Modules/Setup.dist
--- Python-2.6/Modules/Setup.dist.lib64 2008-11-24 02:34:04.000000000 -0500
+++ Python-2.6/Modules/Setup.dist 2008-11-24 02:34:04.000000000 -0500
@@ -408,7 +408,7 @@ gdbm gdbmmodule.c -I/usr/local/include -
# and the subdirectory of PORT where you built it.
DBLIBVER=4.7
DBINC=/usr/include/db4
-DBLIB=/usr/lib
+DBLIB=/usr/lib64
_bsddb _bsddb.c -I$(DBINC) -L$(DBLIB) -ldb-$(DBLIBVER)
# Historical Berkeley DB 1.85
@@ -454,7 +454,7 @@ cPickle cPickle.c
# Andrew Kuchling's zlib module.
# This require zlib 1.1.3 (or later).
# See http://www.gzip.org/zlib/
-zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz
+zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib64 -lz
# Interface to the Expat XML parser
#
diff -up Python-2.6/setup.py.lib64 Python-2.6/setup.py
--- Python-2.6/setup.py.lib64 2008-11-24 02:34:04.000000000 -0500
+++ Python-2.6/setup.py 2008-11-24 02:34:04.000000000 -0500
@@ -310,7 +310,7 @@ class PyBuildExt(build_ext):
def detect_modules(self):
# Ensure that /usr/local is always used
- add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
+ add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib64')
add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
# Add paths specified in the environment variables LDFLAGS and
@@ -583,11 +583,11 @@ class PyBuildExt(build_ext):
elif self.compiler.find_library_file(lib_dirs, 'curses'):
readline_libs.append('curses')
elif self.compiler.find_library_file(lib_dirs +
- ['/usr/lib/termcap'],
+ ['/usr/lib64/termcap'],
'termcap'):
readline_libs.append('termcap')
exts.append( Extension('readline', ['readline.c'],
- library_dirs=['/usr/lib/termcap'],
+ library_dirs=['/usr/lib64/termcap'],
extra_link_args=readline_extra_link_args,
libraries=readline_libs) )
else:
@@ -624,8 +624,8 @@ class PyBuildExt(build_ext):
if krb5_h:
ssl_incs += krb5_h
ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs,
- ['/usr/local/ssl/lib',
- '/usr/contrib/ssl/lib/'
+ ['/usr/local/ssl/lib64',
+ '/usr/contrib/ssl/lib64/'
] )
if (ssl_incs is not None and

12
python-2.6-rpath.patch Normal file
View File

@ -0,0 +1,12 @@
diff -up Python-2.6/configure.in.rpath Python-2.6/configure.in
--- Python-2.6/configure.in.rpath 2008-11-24 02:51:06.000000000 -0500
+++ Python-2.6/configure.in 2008-11-24 02:51:21.000000000 -0500
@@ -729,7 +729,7 @@ if test $enable_shared = "yes"; then
;;
OSF*)
LDLIBRARY='libpython$(VERSION).so'
- BLDLIBRARY='-rpath $(LIBDIR) -L. -lpython$(VERSION)'
+ BLDLIBRARY='-L. -lpython$(VERSION)'
RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
;;
atheos*)

View File

@ -1,8 +1,8 @@
%{!?__python_ver:%define __python_ver EMPTY}
#define __python_ver 25
#define __python_ver 26
%define unicode ucs4
%define _default_patch_fuzz 2
%define _default_patch_fuzz 2
%if "%{__python_ver}" != "EMPTY"
%define main_python 0
@ -14,14 +14,14 @@
%define tkinter tkinter
%endif
%define pybasever 2.5
%define pybasever 2.6
%define tools_dir %{_libdir}/python%{pybasever}/Tools
%define demo_dir %{_libdir}/python%{pybasever}/Demo
%define doc_tools_dir %{_libdir}/python%{pybasever}/Doc/tools
Summary: An interpreted, interactive, object-oriented programming language.
Summary: An interpreted, interactive, object-oriented programming language
Name: %{python}
Version: 2.5.2
Version: 2.6
Release: 1%{?dist}
License: Python
Group: Development/Languages
@ -29,39 +29,40 @@ Provides: python-abi = %{pybasever}
Provides: python(abi) = %{pybasever}
Source: http://www.python.org/ftp/python/%{version}/Python-%{version}.tar.bz2
Patch0: python-2.5-config.patch
Patch0: python-2.6-config.patch
Patch1: Python-2.2.1-pydocnogui.patch
Patch2: python-2.3.4-pydocnodoc.patch
Patch3: python-2.4.1-canonicalize.patch
#Patch2: python-2.3.4-pydocnodoc.patch
Patch3: python-2.6-canonicalize.patch
Patch4: python-2.5-cflags.patch
Patch5: python-2.5.1-ctypes-exec-stack.patch
#Patch5: python-2.5.1-ctypes-exec-stack.patch
Patch6: python-2.5.1-plural-fix.patch
Patch7: python-2.5.1-sqlite-encoding.patch
Patch8: python-2.5-xmlrpclib-marshal-objects.patch
Patch9: python-2.5-tkinter.patch
#Patch8: python-2.5-xmlrpclib-marshal-objects.patch
#Patch9: python-2.5-tkinter.patch
Patch10: python-2.5.2-binutils-no-dep.patch
Patch11: python-2.5.1-codec-ascii-tolower.patch
Patch12: python-2.5.1-pysqlite.patch
#Patch12: python-2.5.1-pysqlite.patch
Patch13: python-2.5.1-socketmodule-constants.patch
Patch14: python-2.5.1-socketmodule-constants2.patch
Patch15: python-2.5.1-listdir.patch
#Patch15: python-2.5.1-listdir.patch
Patch16: python-2.6-rpath.patch
# upstreamed
Patch50: python-2.5-disable-egginfo.patch
#Patch50: python-2.5-disable-egginfo.patch
# new db version
Patch60: python-2.5.2-db47.patch
#Patch60: python-2.5.2-db47.patch
# lib64 patches
Patch101: python-2.3.4-lib64-regex.patch
Patch102: python-2.5-lib64.patch
Patch102: python-2.6-lib64.patch
# New API from 2.6
Patch260: python-2.5.2-set_wakeup_fd4.patch
#Patch260: python-2.5.2-set_wakeup_fd4.patch
Patch999: python-2.5.CVE-2007-4965-int-overflow.patch
Patch998: python-2.5-CVE-2008-2316.patch
#Patch999: python-2.5.CVE-2007-4965-int-overflow.patch
#Patch998: python-2.5-CVE-2008-2316.patch
%if %{main_python}
@ -77,13 +78,13 @@ Provides: python-ctypes = 1.0.1
%endif
BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildPrereq: readline-devel, openssl-devel, gmp-devel
BuildPrereq: ncurses-devel, gdbm-devel, zlib-devel, expat-devel
BuildPrereq: libGL-devel tk tix gcc-c++ libX11-devel glibc-devel
BuildPrereq: bzip2 tar /usr/bin/find pkgconfig tcl-devel tk-devel
BuildPrereq: tix-devel bzip2-devel sqlite-devel
BuildPrereq: autoconf
BuildPrereq: db4-devel >= 4.7
BuildRequires: readline-devel, openssl-devel, gmp-devel
BuildRequires: ncurses-devel, gdbm-devel, zlib-devel, expat-devel
BuildRequires: libGL-devel tk tix gcc-c++ libX11-devel glibc-devel
BuildRequires: bzip2 tar /usr/bin/find pkgconfig tcl-devel tk-devel
BuildRequires: tix-devel bzip2-devel sqlite-devel
BuildRequires: autoconf
BuildRequires: db4-devel >= 4.7
URL: http://www.python.org/
@ -156,7 +157,7 @@ to build python programs.
%package -n %{tkinter}
Summary: A graphical user interface for the Python scripting language.
Group: Development/Languages
BuildPrereq: tcl, tk
BuildRequires: tcl, tk
Requires: %{name} = %{version}-%{release}
%if %{main_python}
Obsoletes: tkinter2
@ -190,17 +191,17 @@ code that uses more than just unittest and/or test_support.py.
%patch0 -p1 -b .rhconfig
%patch1 -p1 -b .no_gui
%patch2 -p1 -b .no-doc
#%%patch2 -p1 -b .no-doc
%patch3 -p1 -b .canonicalize
%patch4 -p1 -b .cflags
%patch5 -p1 -b .ctypesexec
#%%patch5 -p1 -b .ctypesexec
%patch6 -p1 -b .plural
%patch7 -p1
%patch8 -p1 -b .xmlrpc
#%%patch8 -p1 -b .xmlrpc
# Try not disabling egg-infos, bz#414711
#patch50 -p1 -b .egginfo
%patch60 -p1 -b .db47
#%%patch60 -p1 -b .db47
%if "%{_lib}" == "lib64"
%patch101 -p1 -b .lib64-regex
@ -209,20 +210,21 @@ code that uses more than just unittest and/or test_support.py.
%patch10 -p1 -b .binutils-no-dep
%patch11 -p1 -b .ascii-tolower
%patch12 -p1 -b .pysqlite-2.3.3-minimal
#%%patch12 -p1 -b .pysqlite-2.3.3-minimal
%patch13 -p1 -b .socketmodule
%patch14 -p1 -b .socketmodule
%patch15 -p1 -b .socketmodule
%patch14 -p1 -b .socketmodule2
#%%patch15 -p1 -b .listdir
%patch16 -p1 -b .rpath
%ifarch alpha ia64
# 64bit, but not lib64 arches need this too...
%patch101 -p1 -b .lib64-regex
%endif
%patch260 -p1 -b .set_wakeup_fd
#%%patch260 -p1 -b .set_wakeup_fd
%patch999 -p1 -b .cve2007-4965
%patch998 -p0 -b .cve2008-2316
#%%patch999 -p1 -b .cve2007-4965
#%%patch998 -p0 -b .cve2008-2316
# This shouldn't be necesarry, but is right now (2.2a3)
find -name "*~" |xargs rm -f
@ -234,8 +236,8 @@ export CXXFLAGS="$RPM_OPT_FLAGS -D_GNU_SOURCE -fPIC"
export OPT="$RPM_OPT_FLAGS -D_GNU_SOURCE -fPIC"
export LINKCC="gcc"
if pkg-config openssl ; then
export CFLAGS="$CFLAGS `pkg-config --cflags openssl`"
export LDFLAGS="$LDFLAGS `pkg-config --libs-only-L openssl`"
export CFLAGS="$CFLAGS `pkg-config --cflags openssl`"
export LDFLAGS="$LDFLAGS `pkg-config --libs-only-L openssl`"
fi
# Force CC
export CC=gcc
@ -330,7 +332,7 @@ install Tools/scripts/*py $RPM_BUILD_ROOT%{tools_dir}/scripts/
# Documentation tools
install -m755 -d $RPM_BUILD_ROOT%{doc_tools_dir}
install -m755 Doc/tools/mkhowto $RPM_BUILD_ROOT%{doc_tools_dir}
#install -m755 Doc/tools/mkhowto $RPM_BUILD_ROOT%{doc_tools_dir}
# Useful demo scripts
install -m755 -d $RPM_BUILD_ROOT%{demo_dir}
@ -451,7 +453,10 @@ rm -fr $RPM_BUILD_ROOT
%{_libdir}/python%{pybasever}/encodings
%{_libdir}/python%{pybasever}/hotshot
%{_libdir}/python%{pybasever}/idlelib
%dir %{_libdir}/python%{pybasever}/json
%{_libdir}/python%{pybasever}/json/*.py*
%{_libdir}/python%{pybasever}/logging
%{_libdir}/python%{pybasever}/multiprocessing
%{_libdir}/python%{pybasever}/plat-linux2
%dir %{_libdir}/python%{pybasever}/sqlite3
%{_libdir}/python%{pybasever}/sqlite3/*.py*
@ -482,9 +487,11 @@ rm -fr $RPM_BUILD_ROOT
%defattr(-,root,root,755)
%doc Tools/modulator/README.modulator
%doc Tools/pynche/README.pynche
%{_libdir}/python%{pybasever}/lib2to3
%{_libdir}/python%{pybasever}/site-packages/modulator
%{_libdir}/python%{pybasever}/site-packages/pynche
%{_bindir}/smtpd*.py*
%{_bindir}/2to3*
%{_bindir}/idle*
%{_bindir}/modulator*
%{_bindir}/pynche*
@ -505,12 +512,16 @@ rm -fr $RPM_BUILD_ROOT
%{_libdir}/python%{pybasever}/ctypes/test
%{_libdir}/python%{pybasever}/distutils/tests
%{_libdir}/python%{pybasever}/email/test
%{_libdir}/python%{pybasever}/json/tests
%{_libdir}/python%{pybasever}/sqlite3/test
%{_libdir}/python%{pybasever}/test
%{_libdir}/python%{pybasever}/lib-dynload/_ctypes_test.so
%{_libdir}/python%{pybasever}/lib-dynload/_testcapimodule.so
%changelog
* Fri Nov 28 2008 Ignacio Vazquez-Abrams <ivazqueznet+rpm@gmail.com> - 2.6-1
- Update to 2.6
* Tue Sep 30 2008 James Antill <katzj@redhat.com> - 2.5.2-1
- Move to 2.5.2
- Fix CVE-2008-2316 hashlib overflow.

View File

@ -1,86 +0,0 @@
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},

View File

@ -1 +1 @@
afb5451049eda91fbde10bd5a4b7fadc Python-2.5.2.tar.bz2
837476958702cb386c657b5dba61cdc5 Python-2.6.tar.bz2