Merged revisions 68112,68115,68120,68133,68141-68142,68145-68146,68148-68149 via svnmerge from

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
........
This commit is contained in:
Georg Brandl 2009-01-03 22:33:39 +00:00
parent 4baac0f913
commit b1441c7e47
13 changed files with 99 additions and 37 deletions

View 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))

View 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.

17
LICENSE
View File

@ -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

View 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.

View 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'

View 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; \

View File

@ -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
----

View 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;
}

View 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;
}

View 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\

2
README
View File

@ -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.

9
configure vendored
View File

@ -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; }

View 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