Skip to content

Commit b1441c7

Browse files
committed
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 python#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 python#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 python#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 ........
1 parent 4baac0f commit b1441c7

File tree

13 files changed

+99
-37
lines changed

13 files changed

+99
-37
lines changed

Doc/library/itertools.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ can be combined.
466466

467467
.. doctest::
468468

469-
# Show a dictionary sorted and grouped by value
469+
>>> # Show a dictionary sorted and grouped by value
470470
>>> from operator import itemgetter
471471
>>> d = dict(a=1, b=2, c=1, d=2, e=1, f=2, g=3)
472472
>>> di = sorted(d.items(), key=itemgetter(1))
@@ -477,9 +477,9 @@ can be combined.
477477
2 ['b', 'd', 'f']
478478
3 ['g']
479479

480-
# Find runs of consecutive numbers using groupby. The key to the solution
481-
# is differencing with a range so that consecutive numbers all appear in
482-
# same group.
480+
>>> # Find runs of consecutive numbers using groupby. The key to the solution
481+
>>> # is differencing with a range so that consecutive numbers all appear in
482+
>>> # same group.
483483
>>> data = [ 1, 4,5,6, 10, 15,16,17,18, 22, 25,26,27,28]
484484
>>> for k, g in groupby(enumerate(data), lambda t:t[0]-t[1]):
485485
... print(map(operator.itemgetter(1), g))

Doc/license.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ Terms and conditions for accessing or otherwise using Python
124124
analyze, test, perform and/or display publicly, prepare derivative works,
125125
distribute, and otherwise use Python |release| alone or in any derivative
126126
version, provided, however, that PSF's License Agreement and PSF's notice of
127-
copyright, i.e., "Copyright © 2001-2008 Python Software Foundation; All Rights
127+
copyright, i.e., "Copyright © 2001-2009 Python Software Foundation; All Rights
128128
Reserved" are retained in Python |release| alone or in any derivative version
129129
prepared by Licensee.
130130

LICENSE

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -89,15 +89,14 @@ PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
8989
otherwise using this software ("Python") in source or binary form and
9090
its associated documentation.
9191

92-
2. Subject to the terms and conditions of this License Agreement, PSF
93-
hereby grants Licensee a nonexclusive, royalty-free, world-wide
94-
license to reproduce, analyze, test, perform and/or display publicly,
95-
prepare derivative works, distribute, and otherwise use Python
96-
alone or in any derivative version, provided, however, that PSF's
97-
License Agreement and PSF's notice of copyright, i.e., "Copyright (c)
98-
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Python Software Foundation;
99-
All Rights Reserved" are retained in Python alone or in any derivative
100-
version prepared by Licensee.
92+
2. Subject to the terms and conditions of this License Agreement, PSF hereby
93+
grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce,
94+
analyze, test, perform and/or display publicly, prepare derivative works,
95+
distribute, and otherwise use Python alone or in any derivative version,
96+
provided, however, that PSF's License Agreement and PSF's notice of copyright,
97+
i.e., "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Python
98+
Software Foundation; All Rights Reserved" are retained in Python alone or in any
99+
derivative version prepared by Licensee.
101100

102101
3. In the event Licensee prepares a derivative work that is based on
103102
or incorporates Python or any part thereof, and wants to make

Lib/inspect.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,8 @@ def isgeneratorfunction(object):
158158
Generator function objects provides same attributes as functions.
159159
160160
See isfunction.__doc__ for attributes listing."""
161-
if (isfunction(object) or ismethod(object)) and \
162-
object.__code__.co_flags & CO_GENERATOR:
163-
return True
161+
return bool((isfunction(object) or ismethod(object)) and
162+
object.__code__.co_flags & CO_GENERATOR)
164163

165164
def isgenerator(object):
166165
"""Return true if the object is a generator.

Lib/test/test_struct.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
import unittest
33
import struct
44
import warnings
5+
warnings.filterwarnings("ignore", "struct integer overflow masking is deprecated",
6+
DeprecationWarning)
57

68
from functools import wraps
79
from test.support import TestFailed, verbose, run_unittest
@@ -469,6 +471,11 @@ def XXXtest_1530559(self):
469471
self.check_float_coerce(endian + fmt, 1.0)
470472
self.check_float_coerce(endian + fmt, 1.5)
471473

474+
def test_issue4228(self):
475+
# Packing a long may yield either 32 or 64 bits
476+
x = struct.pack('L', -1)[:4]
477+
self.assertEqual(x, b'\xff'*4)
478+
472479
def test_unpack_from(self):
473480
test_string = b'abcd01234'
474481
fmt = '4s'

Makefile.pre.in

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -411,10 +411,14 @@ libpython$(VERSION).so: $(LIBRARY_OBJS)
411411
if test $(INSTSONAME) != $(LDLIBRARY); then \
412412
$(LDSHARED) $(LDFLAGS) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
413413
$(LN) -f $(INSTSONAME) $@; \
414-
else\
414+
else \
415415
$(LDSHARED) $(LDFLAGS) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
416416
fi
417417

418+
libpython$(VERSION).dylib: $(LIBRARY_OBJS)
419+
$(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); \
420+
421+
418422
libpython$(VERSION).sl: $(LIBRARY_OBJS)
419423
$(LDSHARED) $(LDFLAGS) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST)
420424

@@ -772,13 +776,13 @@ altbininstall: $(BUILDPYTHON)
772776
fi; \
773777
done
774778
$(INSTALL_PROGRAM) $(BUILDPYTHON) $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE)
775-
if test -f libpython$(VERSION)$(SO); then \
779+
if test -f $(LDLIBRARY); then \
776780
if test "$(SO)" = .dll; then \
777-
$(INSTALL_SHARED) libpython$(VERSION)$(SO) $(DESTDIR)$(BINDIR); \
781+
$(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(BINDIR); \
778782
else \
779-
$(INSTALL_SHARED) libpython$(VERSION)$(SO) $(DESTDIR)$(LIBDIR)/$(INSTSONAME); \
780-
if test libpython$(VERSION)$(SO) != $(INSTSONAME); then \
781-
(cd $(DESTDIR)$(LIBDIR); $(LN) -sf $(INSTSONAME) libpython$(VERSION)$(SO)); \
783+
$(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(LIBDIR)/$(INSTSONAME); \
784+
if test $(LDLIBRARY) != $(INSTSONAME); then \
785+
(cd $(DESTDIR)$(LIBDIR); $(LN) -sf $(INSTSONAME) $(LDLIBRARY)) \
782786
fi \
783787
fi; \
784788
else true; \

Misc/NEWS

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@ Library
101101
- Issue 4790: The nsmallest() and nlargest() functions in the heapq module
102102
did unnecessary work in the common case where no key function was specified.
103103

104+
- Issue #4795: inspect.isgeneratorfunction() returns False instead of None when
105+
the function is not a generator.
106+
104107
- Issue #4702: Throwing a DistutilsPlatformError instead of IOError in case
105108
no MSVC compiler is found under Windows. Original patch by Philip Jenvey.
106109

@@ -197,6 +200,43 @@ Tools/Demos
197200

198201
- Issue #4677: add two list comprehension tests to pybench.
199202

203+
204+
Build
205+
-----
206+
207+
- Issue #4472: "configure --enable-shared" now works on OSX
208+
209+
- Issues #4728 and #4060: WORDS_BIGEDIAN is now correct in Universal builds.
210+
211+
- Issue #4389: Add icon to the uninstall entry in "add-and-remove-programs".
212+
213+
- Issue #4289: Remove Cancel button from AdvancedDlg.
214+
215+
- Issue #1656675: Register a drop handler for .py* files on Windows.
216+
217+
- Issue #4120: Exclude manifest from extension modules in VS2008.
218+
219+
- Issue #4091: Install pythonxy.dll in system32 again.
220+
221+
- Issue #4018: Disable "for me" installations on Vista.
222+
223+
- Issue #3758: Add ``patchcheck`` build target to .PHONY.
224+
225+
- Issue #4204: Fixed module build errors on FreeBSD 4.
226+
227+
228+
C-API
229+
-----
230+
231+
- Issue #4720: The format for PyArg_ParseTupleAndKeywords can begin with '|'.
232+
233+
- Issue #3632: from the gdb debugger, the 'pyo' macro can now be called when
234+
the GIL is released, or owned by another thread.
235+
236+
- Issue #4122: On Windows, fix a compilation error when using the
237+
Py_UNICODE_ISSPACE macro in an extension module.
238+
239+
200240
Extension Modules
201241
-----------------
202242

@@ -206,6 +246,8 @@ Extension Modules
206246
or decompress several streams at once on multi-CPU systems. Also, the GIL
207247
is now released when computing the CRC of a large buffer. Patch by ebfe.
208248

249+
- Issue #4228: Pack negative values the same way as 2.4 in struct's L format.
250+
209251
- Issue #1040026: Fix os.times result on systems where HZ is incorrect.
210252

211253
- Issues #3167, #3682: Fix test_math failures for log, log10 on Solaris,
@@ -215,9 +257,6 @@ Extension Modules
215257
has been exported, resulting in an interpreter crash when accessing the
216258
buffer.
217259

218-
Build
219-
-----
220-
221260

222261
Docs
223262
----

Modules/_collectionsmodule.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -909,7 +909,7 @@ deque_iter(dequeobject *deque)
909909
it->deque = deque;
910910
it->state = deque->state;
911911
it->counter = deque->len;
912-
_PyObject_GC_TRACK(it);
912+
PyObject_GC_Track(it);
913913
return (PyObject *)it;
914914
}
915915

@@ -1019,7 +1019,7 @@ deque_reviter(dequeobject *deque)
10191019
it->deque = deque;
10201020
it->state = deque->state;
10211021
it->counter = deque->len;
1022-
_PyObject_GC_TRACK(it);
1022+
PyObject_GC_Track(it);
10231023
return (PyObject *)it;
10241024
}
10251025

Modules/_struct.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,7 @@ np_int(char *p, PyObject *v, const formatdef *f)
661661
return -1;
662662
#if (SIZEOF_LONG > SIZEOF_INT)
663663
if ((x < ((long)INT_MIN)) || (x > ((long)INT_MAX)))
664-
return _range_error(f, 0);
664+
RANGE_ERROR(x, f, 0, -1);
665665
#endif
666666
y = (int)x;
667667
memcpy(p, (char *)&y, sizeof y);
@@ -673,12 +673,12 @@ np_uint(char *p, PyObject *v, const formatdef *f)
673673
{
674674
unsigned long x;
675675
unsigned int y;
676-
if (get_ulong(v, &x) < 0)
677-
return _range_error(f, 1);
676+
if (get_wrapped_ulong(v, &x) < 0)
677+
return -1;
678678
y = (unsigned int)x;
679679
#if (SIZEOF_LONG > SIZEOF_INT)
680680
if (x > ((unsigned long)UINT_MAX))
681-
return _range_error(f, 1);
681+
RANGE_ERROR(y, f, 1, -1);
682682
#endif
683683
memcpy(p, (char *)&y, sizeof y);
684684
return 0;
@@ -698,8 +698,8 @@ static int
698698
np_ulong(char *p, PyObject *v, const formatdef *f)
699699
{
700700
unsigned long x;
701-
if (get_ulong(v, &x) < 0)
702-
return _range_error(f, 1);
701+
if (get_wrapped_ulong(v, &x) < 0)
702+
return -1;
703703
memcpy(p, (char *)&x, sizeof x);
704704
return 0;
705705
}

Python/getcopyright.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
static char cprt[] =
66
"\
7-
Copyright (c) 2001-2008 Python Software Foundation.\n\
7+
Copyright (c) 2001-2009 Python Software Foundation.\n\
88
All Rights Reserved.\n\
99
\n\
1010
Copyright (c) 2000 BeOpen.com.\n\

0 commit comments

Comments
 (0)