diff options
-rw-r--r-- | Doc/library/itertools.rst | 8 | ||||
-rw-r--r-- | Doc/license.rst | 2 | ||||
-rw-r--r-- | LICENSE | 17 | ||||
-rw-r--r-- | Lib/inspect.py | 5 | ||||
-rw-r--r-- | Lib/test/test_struct.py | 7 | ||||
-rw-r--r-- | Makefile.pre.in | 16 | ||||
-rw-r--r-- | Misc/NEWS | 45 | ||||
-rw-r--r-- | Modules/_collectionsmodule.c | 4 | ||||
-rw-r--r-- | Modules/_struct.c | 12 | ||||
-rw-r--r-- | Python/getcopyright.c | 2 | ||||
-rw-r--r-- | README | 2 | ||||
-rwxr-xr-x | configure | 9 | ||||
-rw-r--r-- | configure.in | 7 |
13 files changed, 99 insertions, 37 deletions
diff --git a/Doc/library/itertools.rst b/Doc/library/itertools.rst index 96515111..b384cc8 100644 --- a/Doc/library/itertools.rst +++ b/Doc/library/itertools.rst @@ -466,7 +466,7 @@ can be combined. .. doctest:: - # Show a dictionary sorted and grouped by value + >>> # Show a dictionary sorted and grouped by value >>> from operator import itemgetter >>> d = dict(a=1, b=2, c=1, d=2, e=1, f=2, g=3) >>> di = sorted(d.items(), key=itemgetter(1)) @@ -477,9 +477,9 @@ can be combined. 2 ['b', 'd', 'f'] 3 ['g'] - # Find runs of consecutive numbers using groupby. The key to the solution - # is differencing with a range so that consecutive numbers all appear in - # same group. + >>> # Find runs of consecutive numbers using groupby. The key to the solution + >>> # is differencing with a range so that consecutive numbers all appear in + >>> # same group. >>> data = [ 1, 4,5,6, 10, 15,16,17,18, 22, 25,26,27,28] >>> for k, g in groupby(enumerate(data), lambda t:t[0]-t[1]): ... print(map(operator.itemgetter(1), g)) diff --git a/Doc/license.rst b/Doc/license.rst index ac29d16..faceab6 100644 --- a/Doc/license.rst +++ b/Doc/license.rst @@ -124,7 +124,7 @@ Terms and conditions for accessing or otherwise using Python analyze, test, perform and/or display publicly, prepare derivative works, distribute, and otherwise use Python |release| alone or in any derivative version, provided, however, that PSF's License Agreement and PSF's notice of - copyright, i.e., "Copyright © 2001-2008 Python Software Foundation; All Rights + copyright, i.e., "Copyright © 2001-2009 Python Software Foundation; All Rights Reserved" are retained in Python |release| alone or in any derivative version prepared by Licensee. @@ -89,15 +89,14 @@ PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2 otherwise using this software ("Python") in source or binary form and its associated documentation. -2. Subject to the terms and conditions of this License Agreement, PSF -hereby grants Licensee a nonexclusive, royalty-free, world-wide -license to reproduce, analyze, test, perform and/or display publicly, -prepare derivative works, distribute, and otherwise use Python -alone or in any derivative version, provided, however, that PSF's -License Agreement and PSF's notice of copyright, i.e., "Copyright (c) -2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Python Software Foundation; -All Rights Reserved" are retained in Python alone or in any derivative -version prepared by Licensee. +2. Subject to the terms and conditions of this License Agreement, PSF hereby +grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce, +analyze, test, perform and/or display publicly, prepare derivative works, +distribute, and otherwise use Python alone or in any derivative version, +provided, however, that PSF's License Agreement and PSF's notice of copyright, +i.e., "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Python +Software Foundation; All Rights Reserved" are retained in Python alone or in any +derivative version prepared by Licensee. 3. In the event Licensee prepares a derivative work that is based on or incorporates Python or any part thereof, and wants to make diff --git a/Lib/inspect.py b/Lib/inspect.py index 3b58bd8..da55ac6 100644 --- a/Lib/inspect.py +++ b/Lib/inspect.py @@ -158,9 +158,8 @@ def isgeneratorfunction(object): Generator function objects provides same attributes as functions. See isfunction.__doc__ for attributes listing.""" - if (isfunction(object) or ismethod(object)) and \ - object.__code__.co_flags & CO_GENERATOR: - return True + return bool((isfunction(object) or ismethod(object)) and + object.__code__.co_flags & CO_GENERATOR) def isgenerator(object): """Return true if the object is a generator. diff --git a/Lib/test/test_struct.py b/Lib/test/test_struct.py index 00219b8..bdbc397 100644 --- a/Lib/test/test_struct.py +++ b/Lib/test/test_struct.py @@ -2,6 +2,8 @@ import array import unittest import struct import warnings +warnings.filterwarnings("ignore", "struct integer overflow masking is deprecated", + DeprecationWarning) from functools import wraps from test.support import TestFailed, verbose, run_unittest @@ -469,6 +471,11 @@ class StructTest(unittest.TestCase): self.check_float_coerce(endian + fmt, 1.0) self.check_float_coerce(endian + fmt, 1.5) + def test_issue4228(self): + # Packing a long may yield either 32 or 64 bits + x = struct.pack('L', -1)[:4] + self.assertEqual(x, b'\xff'*4) + def test_unpack_from(self): test_string = b'abcd01234' fmt = '4s' diff --git a/Makefile.pre.in b/Makefile.pre.in index 42a061d..6f89a21 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -411,10 +411,14 @@ libpython$(VERSION).so: $(LIBRARY_OBJS) if test $(INSTSONAME) != $(LDLIBRARY); then \ $(LDSHARED) $(LDFLAGS) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \ $(LN) -f $(INSTSONAME) $@; \ - else\ + else \ $(LDSHARED) $(LDFLAGS) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \ fi +libpython$(VERSION).dylib: $(LIBRARY_OBJS) + $(CC) -dynamiclib -Wl,-single_module $(LDFLAGS) -undefined dynamic_lookup -Wl,-install_name,$(prefix)/lib/libpython$(VERSION).dylib -Wl,-compatibility_version,$(VERSION) -Wl,-current_version,$(VERSION) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \ + + libpython$(VERSION).sl: $(LIBRARY_OBJS) $(LDSHARED) $(LDFLAGS) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST) @@ -772,13 +776,13 @@ altbininstall: $(BUILDPYTHON) fi; \ done $(INSTALL_PROGRAM) $(BUILDPYTHON) $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE) - if test -f libpython$(VERSION)$(SO); then \ + if test -f $(LDLIBRARY); then \ if test "$(SO)" = .dll; then \ - $(INSTALL_SHARED) libpython$(VERSION)$(SO) $(DESTDIR)$(BINDIR); \ + $(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(BINDIR); \ else \ - $(INSTALL_SHARED) libpython$(VERSION)$(SO) $(DESTDIR)$(LIBDIR)/$(INSTSONAME); \ - if test libpython$(VERSION)$(SO) != $(INSTSONAME); then \ - (cd $(DESTDIR)$(LIBDIR); $(LN) -sf $(INSTSONAME) libpython$(VERSION)$(SO)); \ + $(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(LIBDIR)/$(INSTSONAME); \ + if test $(LDLIBRARY) != $(INSTSONAME); then \ + (cd $(DESTDIR)$(LIBDIR); $(LN) -sf $(INSTSONAME) $(LDLIBRARY)) \ fi \ fi; \ else true; \ @@ -101,6 +101,9 @@ Library - Issue 4790: The nsmallest() and nlargest() functions in the heapq module did unnecessary work in the common case where no key function was specified. +- Issue #4795: inspect.isgeneratorfunction() returns False instead of None when + the function is not a generator. + - Issue #4702: Throwing a DistutilsPlatformError instead of IOError in case no MSVC compiler is found under Windows. Original patch by Philip Jenvey. @@ -197,6 +200,43 @@ Tools/Demos - Issue #4677: add two list comprehension tests to pybench. + +Build +----- + +- Issue #4472: "configure --enable-shared" now works on OSX + +- Issues #4728 and #4060: WORDS_BIGEDIAN is now correct in Universal builds. + +- Issue #4389: Add icon to the uninstall entry in "add-and-remove-programs". + +- Issue #4289: Remove Cancel button from AdvancedDlg. + +- Issue #1656675: Register a drop handler for .py* files on Windows. + +- Issue #4120: Exclude manifest from extension modules in VS2008. + +- Issue #4091: Install pythonxy.dll in system32 again. + +- Issue #4018: Disable "for me" installations on Vista. + +- Issue #3758: Add ``patchcheck`` build target to .PHONY. + +- Issue #4204: Fixed module build errors on FreeBSD 4. + + +C-API +----- + +- Issue #4720: The format for PyArg_ParseTupleAndKeywords can begin with '|'. + +- Issue #3632: from the gdb debugger, the 'pyo' macro can now be called when + the GIL is released, or owned by another thread. + +- Issue #4122: On Windows, fix a compilation error when using the + Py_UNICODE_ISSPACE macro in an extension module. + + Extension Modules ----------------- @@ -206,6 +246,8 @@ Extension Modules or decompress several streams at once on multi-CPU systems. Also, the GIL is now released when computing the CRC of a large buffer. Patch by ebfe. +- Issue #4228: Pack negative values the same way as 2.4 in struct's L format. + - Issue #1040026: Fix os.times result on systems where HZ is incorrect. - Issues #3167, #3682: Fix test_math failures for log, log10 on Solaris, @@ -215,9 +257,6 @@ Extension Modules has been exported, resulting in an interpreter crash when accessing the buffer. -Build ------ - Docs ---- diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c index 910c25f..1b855e1 100644 --- a/Modules/_collectionsmodule.c +++ b/Modules/_collectionsmodule.c @@ -909,7 +909,7 @@ deque_iter(dequeobject *deque) it->deque = deque; it->state = deque->state; it->counter = deque->len; - _PyObject_GC_TRACK(it); + PyObject_GC_Track(it); return (PyObject *)it; } @@ -1019,7 +1019,7 @@ deque_reviter(dequeobject *deque) it->deque = deque; it->state = deque->state; it->counter = deque->len; - _PyObject_GC_TRACK(it); + PyObject_GC_Track(it); return (PyObject *)it; } diff --git a/Modules/_struct.c b/Modules/_struct.c index ac70f43..a9b1ffa 100644 --- a/Modules/_struct.c +++ b/Modules/_struct.c @@ -661,7 +661,7 @@ np_int(char *p, PyObject *v, const formatdef *f) return -1; #if (SIZEOF_LONG > SIZEOF_INT) if ((x < ((long)INT_MIN)) || (x > ((long)INT_MAX))) - return _range_error(f, 0); + RANGE_ERROR(x, f, 0, -1); #endif y = (int)x; memcpy(p, (char *)&y, sizeof y); @@ -673,12 +673,12 @@ np_uint(char *p, PyObject *v, const formatdef *f) { unsigned long x; unsigned int y; - if (get_ulong(v, &x) < 0) - return _range_error(f, 1); + if (get_wrapped_ulong(v, &x) < 0) + return -1; y = (unsigned int)x; #if (SIZEOF_LONG > SIZEOF_INT) if (x > ((unsigned long)UINT_MAX)) - return _range_error(f, 1); + RANGE_ERROR(y, f, 1, -1); #endif memcpy(p, (char *)&y, sizeof y); return 0; @@ -698,8 +698,8 @@ static int np_ulong(char *p, PyObject *v, const formatdef *f) { unsigned long x; - if (get_ulong(v, &x) < 0) - return _range_error(f, 1); + if (get_wrapped_ulong(v, &x) < 0) + return -1; memcpy(p, (char *)&x, sizeof x); return 0; } diff --git a/Python/getcopyright.c b/Python/getcopyright.c index df70e8b..8864cdb 100644 --- a/Python/getcopyright.c +++ b/Python/getcopyright.c @@ -4,7 +4,7 @@ static char cprt[] = "\ -Copyright (c) 2001-2008 Python Software Foundation.\n\ +Copyright (c) 2001-2009 Python Software Foundation.\n\ All Rights Reserved.\n\ \n\ Copyright (c) 2000 BeOpen.com.\n\ @@ -2,7 +2,7 @@ This is Python version 3.1 alpha 0 ================================== For notes specific to this release, see RELNOTES in this directory. -Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 +Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Python Software Foundation. All rights reserved. @@ -4085,6 +4085,12 @@ _ACEOF BLDLIBRARY='-L. -lpython$(VERSION)' RUNSHARED=DLL_PATH=`pwd`:${DLL_PATH:-/atheos/sys/libs:/atheos/autolnk/lib} ;; + Darwin*) + LDLIBRARY='libpython$(VERSION).dylib' + BLDLIBRARY='-L. -lpython$(VERSION)' + RUNSHARED='DYLD_LIBRARY_PATH=`pwd`:${DYLD_LIBRARY_PATH}' + ;; + esac else # shared is disabled case $ac_sys_system in @@ -12915,6 +12921,7 @@ fi { echo "$as_me:$LINENO: result: $SO" >&5 echo "${ECHO_T}$SO" >&6; } + cat >>confdefs.h <<_ACEOF #define SHLIB_EXT "$SO" _ACEOF @@ -13311,7 +13318,7 @@ _ACEOF fi # Dynamic linking for HP-UX -# only check for sem_ini if thread support is requested +# only check for sem_init if thread support is requested if test "$with_threads" = "yes" -o -z "$with_threads"; then { echo "$as_me:$LINENO: checking for library containing sem_init" >&5 echo $ECHO_N "checking for library containing sem_init... $ECHO_C" >&6; } diff --git a/configure.in b/configure.in index 5acc141..394c804 100644 --- a/configure.in +++ b/configure.in @@ -693,6 +693,12 @@ if test $enable_shared = "yes"; then BLDLIBRARY='-L. -lpython$(VERSION)' RUNSHARED=DLL_PATH=`pwd`:${DLL_PATH:-/atheos/sys/libs:/atheos/autolnk/lib} ;; + Darwin*) + LDLIBRARY='libpython$(VERSION).dylib' + BLDLIBRARY='-L. -lpython$(VERSION)' + RUNSHARED='DYLD_LIBRARY_PATH=`pwd`:${DYLD_LIBRARY_PATH}' + ;; + esac else # shared is disabled case $ac_sys_system in @@ -1527,6 +1533,7 @@ else sleep 10 fi AC_MSG_RESULT($SO) + AC_DEFINE_UNQUOTED(SHLIB_EXT, "$SO", [Define this to be extension of shared libraries (including the dot!).]) # LDSHARED is the ld *command* used to create shared library # -- "cc -G" on SunOS 5.x, "ld -shared" on IRIX 5 |