]> granicus.if.org Git - python/commitdiff
Merged revisions 68112,68115,68120,68133,68141-68142,68145-68146,68148-68149 via...
authorGeorg Brandl <georg@python.org>
Sat, 3 Jan 2009 22:33:39 +0000 (22:33 +0000)
committerGeorg Brandl <georg@python.org>
Sat, 3 Jan 2009 22:33:39 +0000 (22:33 +0000)
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r68112 | benjamin.peterson | 2009-01-01 00:48:39 +0100 (Thu, 01 Jan 2009) | 1 line

  #4795 inspect.isgeneratorfunction() should return False instead of None
........
  r68115 | benjamin.peterson | 2009-01-01 05:04:41 +0100 (Thu, 01 Jan 2009) | 1 line

  simplfy code
........
  r68120 | georg.brandl | 2009-01-01 13:15:31 +0100 (Thu, 01 Jan 2009) | 4 lines

  #4228: Pack negative values the same way as 2.4
  in struct's L format.
........
  r68133 | antoine.pitrou | 2009-01-01 16:38:03 +0100 (Thu, 01 Jan 2009) | 1 line

  fill in actual issue number in tests
........
  r68141 | benjamin.peterson | 2009-01-01 17:43:12 +0100 (Thu, 01 Jan 2009) | 1 line

  fix highlighting
........
  r68142 | benjamin.peterson | 2009-01-01 18:29:49 +0100 (Thu, 01 Jan 2009) | 2 lines

  welcome to 2009, Python!
........
  r68145 | amaury.forgeotdarc | 2009-01-02 01:03:54 +0100 (Fri, 02 Jan 2009) | 5 lines

  #4801 _collections module fails to build on cygwin.

  _PyObject_GC_TRACK is the macro version of PyObject_GC_Track,
  and according to documentation it should not be used for extension modules.
........
  r68146 | ronald.oussoren | 2009-01-02 11:44:46 +0100 (Fri, 02 Jan 2009) | 2 lines

  Fix for issue4472: "configure --enable-shared doesn't work on OSX"
........
  r68148 | ronald.oussoren | 2009-01-02 11:48:31 +0100 (Fri, 02 Jan 2009) | 2 lines

  Forgot to add a NEWS item in my previous checkin
........
  r68149 | ronald.oussoren | 2009-01-02 11:50:48 +0100 (Fri, 02 Jan 2009) | 2 lines

  Fix for issue4780
........

13 files changed:
Doc/library/itertools.rst
Doc/license.rst
LICENSE
Lib/inspect.py
Lib/test/test_struct.py
Makefile.pre.in
Misc/NEWS
Modules/_collectionsmodule.c
Modules/_struct.c
Python/getcopyright.c
README
configure
configure.in

index 96515111529a07c92eba047ee0dc2157ad162daf..b384cc8735ba41b95ba87cb79a675b703306a59c 100644 (file)
@@ -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))
index ac29d16fe6d14ace5e1f339b76d7b80ac8d08b8f..faceab68037984fb52ae641c82e649a83e2f3f4a 100644 (file)
@@ -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.
 
diff --git a/LICENSE b/LICENSE
index 86598f5cfee0742d36585e1f8d6379233ca455d9..d5974784135748aa5a8e6d00fd4f909d57da3e98 100644 (file)
--- a/LICENSE
+++ b/LICENSE
@@ -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
index 3b58bd8a4b22eba068259cd4fb94825b7f589988..da55ac6baebed53cf10036d0595f0caf0922fadb 100644 (file)
@@ -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.
index 00219b8ca0eaee5cf2c77a083dcdfe8cb705b3d9..bdbc397415cbc23b7092b56fb4e0fbf9fbef9d74 100644 (file)
@@ -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'
index 42a061def31faa50751475556db793ba6a6baeda..6f89a2124f761131fdf77a95638a11620c9c8515 100644 (file)
@@ -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; \
index 2c59b005f4bab38d3765cc76747227776abc8e23..c629722fd0555019189e275f80aca657d551a369 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -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
 ----
index 910c25f2d3bd0f71eaeb007e2dcd6a5f2916827d..1b855e11816d67478751adfce3e0be881c7bfd1b 100644 (file)
@@ -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;
 }
 
index ac70f43e640ce656d7d46ceb4313b0e7b78959e9..a9b1ffac5314bc7593c2086d1e3191df3a803233 100644 (file)
@@ -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;
 }
index df70e8bdf5e41dfa191e7490ccbe885d91871cf1..8864cdbbc0a9ce0b5014b8da49e6087dbce6944a 100644 (file)
@@ -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\
diff --git a/README b/README
index 6acf1454fe5b4dc905638e9e4aff1fe7522a86ab..2d50391ac2cb59e11f13631047af4416f1430a64 100644 (file)
--- a/README
+++ b/README
@@ -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.
 
index 8eb9d9957567df1f5e8bd23a580e455028ac3400..5937219898cc96d119a3a5c4c3415bec10b21048 100755 (executable)
--- a/configure
+++ b/configure
@@ -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; }
index 5acc141857e79b1bc0f0a84d07c99887b8e3bd5a..394c8047b6b02bb0fabf3598a64f7686399802ef 100644 (file)
@@ -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