diff --git a/Doc/library/itertools.rst b/Doc/library/itertools.rst
index bf31ea8cbfe79bd175874dc44d1f69325853e4eb_RG9jL2xpYnJhcnkvaXRlcnRvb2xzLnJzdA==..7836b461843f4c7f4ad14e051b3c4c4219310978_RG9jL2xpYnJhcnkvaXRlcnRvb2xzLnJzdA== 100644
--- a/Doc/library/itertools.rst
+++ b/Doc/library/itertools.rst
@@ -466,7 +466,7 @@
 
 .. 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 @@
    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 bf31ea8cbfe79bd175874dc44d1f69325853e4eb_RG9jL2xpY2Vuc2UucnN0..7836b461843f4c7f4ad14e051b3c4c4219310978_RG9jL2xpY2Vuc2UucnN0 100644
--- a/Doc/license.rst
+++ b/Doc/license.rst
@@ -124,7 +124,7 @@
    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 bf31ea8cbfe79bd175874dc44d1f69325853e4eb_TElDRU5TRQ==..7836b461843f4c7f4ad14e051b3c4c4219310978_TElDRU5TRQ== 100644
--- a/LICENSE
+++ b/LICENSE
@@ -89,15 +89,14 @@
 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 bf31ea8cbfe79bd175874dc44d1f69325853e4eb_TGliL2luc3BlY3QucHk=..7836b461843f4c7f4ad14e051b3c4c4219310978_TGliL2luc3BlY3QucHk= 100644
--- a/Lib/inspect.py
+++ b/Lib/inspect.py
@@ -158,9 +158,8 @@
     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 bf31ea8cbfe79bd175874dc44d1f69325853e4eb_TGliL3Rlc3QvdGVzdF9zdHJ1Y3QucHk=..7836b461843f4c7f4ad14e051b3c4c4219310978_TGliL3Rlc3QvdGVzdF9zdHJ1Y3QucHk= 100644
--- a/Lib/test/test_struct.py
+++ b/Lib/test/test_struct.py
@@ -2,6 +2,8 @@
 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 @@
                 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 bf31ea8cbfe79bd175874dc44d1f69325853e4eb_TWFrZWZpbGUucHJlLmlu..7836b461843f4c7f4ad14e051b3c4c4219310978_TWFrZWZpbGUucHJlLmlu 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -411,7 +411,7 @@
 	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
 
@@ -415,6 +415,10 @@
 		$(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,5 +776,5 @@
 		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 \
@@ -776,3 +780,3 @@
 		if test "$(SO)" = .dll; then \
-			$(INSTALL_SHARED) libpython$(VERSION)$(SO) $(DESTDIR)$(BINDIR); \
+			$(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(BINDIR); \
 		else \
@@ -778,7 +782,7 @@
 		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; \
diff --git a/Misc/NEWS b/Misc/NEWS
index bf31ea8cbfe79bd175874dc44d1f69325853e4eb_TWlzYy9ORVdT..7836b461843f4c7f4ad14e051b3c4c4219310978_TWlzYy9ORVdT 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -101,6 +101,9 @@
 - 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 @@
 
 - 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 @@
   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 @@
   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 bf31ea8cbfe79bd175874dc44d1f69325853e4eb_TW9kdWxlcy9fY29sbGVjdGlvbnNtb2R1bGUuYw==..7836b461843f4c7f4ad14e051b3c4c4219310978_TW9kdWxlcy9fY29sbGVjdGlvbnNtb2R1bGUuYw== 100644
--- a/Modules/_collectionsmodule.c
+++ b/Modules/_collectionsmodule.c
@@ -909,7 +909,7 @@
 	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 @@
 	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 bf31ea8cbfe79bd175874dc44d1f69325853e4eb_TW9kdWxlcy9fc3RydWN0LmM=..7836b461843f4c7f4ad14e051b3c4c4219310978_TW9kdWxlcy9fc3RydWN0LmM= 100644
--- a/Modules/_struct.c
+++ b/Modules/_struct.c
@@ -661,7 +661,7 @@
 		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,8 +673,8 @@
 {
 	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))
@@ -678,7 +678,7 @@
 	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 @@
 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 bf31ea8cbfe79bd175874dc44d1f69325853e4eb_UHl0aG9uL2dldGNvcHlyaWdodC5j..7836b461843f4c7f4ad14e051b3c4c4219310978_UHl0aG9uL2dldGNvcHlyaWdodC5j 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\
diff --git a/README b/README
index bf31ea8cbfe79bd175874dc44d1f69325853e4eb_UkVBRE1F..7836b461843f4c7f4ad14e051b3c4c4219310978_UkVBRE1F 100644
--- a/README
+++ b/README
@@ -2,7 +2,7 @@
 ==================================
 
 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.
 
diff --git a/configure b/configure
index bf31ea8cbfe79bd175874dc44d1f69325853e4eb_Y29uZmlndXJl..7836b461843f4c7f4ad14e051b3c4c4219310978_Y29uZmlndXJl 100755
--- a/configure
+++ b/configure
@@ -4085,6 +4085,12 @@
 	  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 @@
 { 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 @@
 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 bf31ea8cbfe79bd175874dc44d1f69325853e4eb_Y29uZmlndXJlLmlu..7836b461843f4c7f4ad14e051b3c4c4219310978_Y29uZmlndXJlLmlu 100644
--- a/configure.in
+++ b/configure.in
@@ -693,6 +693,12 @@
 	  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 @@
 	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