From 41bade96a4d1dcd35bbba79c2eabe052d02756a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Araujo?= Date: Tue, 26 Jul 2011 15:13:47 +0200 Subject: Remove duplicates of cmp_to_key (#12542, reviewed by Raymond Hettinger) --- Lib/test/list_tests.py | 16 +++++----------- Lib/test/test_sort.py | 23 ++++++++--------------- 2 files changed, 13 insertions(+), 26 deletions(-) diff --git a/Lib/test/list_tests.py b/Lib/test/list_tests.py index e3a7845..be054ea 100644 --- a/Lib/test/list_tests.py +++ b/Lib/test/list_tests.py @@ -4,17 +4,10 @@ Tests common to list and UserList.UserList import sys import os +from functools import cmp_to_key from test import support, seq_tests -def CmpToKey(mycmp): - 'Convert a cmp= function into a key= function' - class K(object): - def __init__(self, obj): - self.obj = obj - def __lt__(self, other): - return mycmp(self.obj, other.obj) == -1 - return K class CommonTest(seq_tests.CommonTest): @@ -443,7 +436,7 @@ class CommonTest(seq_tests.CommonTest): return 1 else: # a > b return -1 - u.sort(key=CmpToKey(revcmp)) + u.sort(key=cmp_to_key(revcmp)) self.assertEqual(u, self.type2test([2,1,0,-1,-2])) # The following dumps core in unpatched Python 1.5: @@ -456,7 +449,7 @@ class CommonTest(seq_tests.CommonTest): else: # xmod > ymod return 1 z = self.type2test(range(12)) - z.sort(key=CmpToKey(myComparison)) + z.sort(key=cmp_to_key(myComparison)) self.assertRaises(TypeError, z.sort, 2) @@ -468,7 +461,8 @@ class CommonTest(seq_tests.CommonTest): return -1 else: # x > y return 1 - self.assertRaises(ValueError, z.sort, key=CmpToKey(selfmodifyingComparison)) + self.assertRaises(ValueError, z.sort, + key=cmp_to_key(selfmodifyingComparison)) self.assertRaises(TypeError, z.sort, 42, 42, 42, 42) diff --git a/Lib/test/test_sort.py b/Lib/test/test_sort.py index 55503b5..8f6af64 100644 --- a/Lib/test/test_sort.py +++ b/Lib/test/test_sort.py @@ -2,18 +2,11 @@ from test import support import random import sys import unittest +from functools import cmp_to_key verbose = support.verbose nerrors = 0 -def CmpToKey(mycmp): - 'Convert a cmp= function into a key= function' - class K(object): - def __init__(self, obj): - self.obj = obj - def __lt__(self, other): - return mycmp(self.obj, other.obj) == -1 - return K def check(tag, expected, raw, compare=None): global nerrors @@ -23,7 +16,7 @@ def check(tag, expected, raw, compare=None): orig = raw[:] # save input in case of error if compare: - raw.sort(key=CmpToKey(compare)) + raw.sort(key=cmp_to_key(compare)) else: raw.sort() @@ -108,7 +101,7 @@ class TestBase(unittest.TestCase): print(" Checking against an insane comparison function.") print(" If the implementation isn't careful, this may segfault.") s = x[:] - s.sort(key=CmpToKey(lambda a, b: int(random.random() * 3) - 1)) + s.sort(key=cmp_to_key(lambda a, b: int(random.random() * 3) - 1)) check("an insane function left some permutation", x, s) if len(x) >= 2: @@ -165,12 +158,12 @@ class TestBugs(unittest.TestCase): L.pop() return (x > y) - (x < y) L = [1,2] - self.assertRaises(ValueError, L.sort, key=CmpToKey(mutating_cmp)) + self.assertRaises(ValueError, L.sort, key=cmp_to_key(mutating_cmp)) def mutating_cmp(x, y): L.append(3) del L[:] return (x > y) - (x < y) - self.assertRaises(ValueError, L.sort, key=CmpToKey(mutating_cmp)) + self.assertRaises(ValueError, L.sort, key=cmp_to_key(mutating_cmp)) memorywaster = [memorywaster] #============================================================================== @@ -185,7 +178,7 @@ class TestDecorateSortUndecorate(unittest.TestCase): def my_cmp(x, y): xlower, ylower = x.lower(), y.lower() return (xlower > ylower) - (xlower < ylower) - copy.sort(key=CmpToKey(my_cmp)) + copy.sort(key=cmp_to_key(my_cmp)) def test_baddecorator(self): data = 'The quick Brown fox Jumped over The lazy Dog'.split() @@ -261,8 +254,8 @@ class TestDecorateSortUndecorate(unittest.TestCase): def my_cmp_reversed(x, y): x0, y0 = x[0], y[0] return (y0 > x0) - (y0 < x0) - data.sort(key=CmpToKey(my_cmp), reverse=True) - copy1.sort(key=CmpToKey(my_cmp_reversed)) + data.sort(key=cmp_to_key(my_cmp), reverse=True) + copy1.sort(key=cmp_to_key(my_cmp_reversed)) self.assertEqual(data, copy1) copy2.sort(key=lambda x: x[0], reverse=True) self.assertEqual(data, copy2) -- cgit v0.12 From 7c12bae717b0e84faee548021feb87ba63410881 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Araujo?= Date: Tue, 26 Jul 2011 15:14:35 +0200 Subject: Fix reST references --- Doc/glossary.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Doc/glossary.rst b/Doc/glossary.rst index fa34f29..2003e0b 100644 --- a/Doc/glossary.rst +++ b/Doc/glossary.rst @@ -431,7 +431,8 @@ Glossary mapping A container object that supports arbitrary key lookups and implements the - methods specified in the :class:`Mapping` or :class:`MutableMapping` + methods specified in the :class:`~collections.Mapping` or + :class:`~collections.MutableMapping` :ref:`abstract base classes `. Examples include :class:`dict`, :class:`collections.defaultdict`, :class:`collections.OrderedDict` and :class:`collections.Counter`. -- cgit v0.12 From 59e387eb4034dcc007b0b30eedea4e5fcbc92594 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Araujo?= Date: Tue, 26 Jul 2011 16:53:17 +0200 Subject: =?UTF-8?q?Fix=20=E2=80=9Canyways=E2=80=9D=20(following=20R.=20Dav?= =?UTF-8?q?id=20Murray=20in=204d5a546b6186)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Doc/install/index.rst | 2 +- Doc/library/ossaudiodev.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/install/index.rst b/Doc/install/index.rst index f8d6305..6f4de7a 100644 --- a/Doc/install/index.rst +++ b/Doc/install/index.rst @@ -72,7 +72,7 @@ In that case, you would download the installer appropriate to your platform and do the obvious thing with it: run it if it's an executable installer, ``rpm --install`` it if it's an RPM, etc. You don't need to run Python or a setup script, you don't need to compile anything---you might not even need to read any -instructions (although it's always a good idea to do so anyways). +instructions (although it's always a good idea to do so anyway). Of course, things will not always be that easy. You might be interested in a module distribution that doesn't have an easy-to-use installer for your diff --git a/Doc/library/ossaudiodev.rst b/Doc/library/ossaudiodev.rst index 3b5a7e4..0a08428 100644 --- a/Doc/library/ossaudiodev.rst +++ b/Doc/library/ossaudiodev.rst @@ -14,7 +14,7 @@ the standard audio interface for Linux and recent versions of FreeBSD. ALSA is in the standard kernel as of 2.5.x. Presumably if you use ALSA, you'll have to make sure its OSS compatibility layer is active to use ossaudiodev, but you're gonna need it for the vast - majority of Linux audio apps anyways. + majority of Linux audio apps anyway. Sounds like things are also complicated for other BSDs. In response to my python-dev query, Thomas Wouters said: -- cgit v0.12 From 72db3459e4d949f5ac8df6778b0a0bef8da2e05f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Araujo?= Date: Tue, 26 Jul 2011 16:54:24 +0200 Subject: Make indentation comply with our style guide and the rest of the file --- Doc/tutorial/classes.rst | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/Doc/tutorial/classes.rst b/Doc/tutorial/classes.rst index bf1e26e..6ee2e94 100644 --- a/Doc/tutorial/classes.rst +++ b/Doc/tutorial/classes.rst @@ -598,24 +598,24 @@ occurs within the definition of a class. Name mangling is helpful for letting subclasses override methods without breaking intraclass method calls. For example:: - class Mapping: - def __init__(self, iterable): - self.items_list = [] - self.__update(iterable) + class Mapping: + def __init__(self, iterable): + self.items_list = [] + self.__update(iterable) - def update(self, iterable): - for item in iterable: - self.items_list.append(item) + def update(self, iterable): + for item in iterable: + self.items_list.append(item) - __update = update # private copy of original update() method + __update = update # private copy of original update() method - class MappingSubclass(Mapping): + class MappingSubclass(Mapping): - def update(self, keys, values): - # provides new signature for update() - # but does not break __init__() - for item in zip(keys, values): - self.items_list.append(item) + def update(self, keys, values): + # provides new signature for update() + # but does not break __init__() + for item in zip(keys, values): + self.items_list.append(item) Note that the mangling rules are designed mostly to avoid accidents; it still is possible to access or modify a variable that is considered private. This can -- cgit v0.12 From 6c0ba447bd171094f27b7ae72df2dbbd8c60a6c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Araujo?= Date: Tue, 26 Jul 2011 17:23:57 +0200 Subject: Fix style in code added by edba722f3b02 --- Python/marshal.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Python/marshal.c b/Python/marshal.c index 76d5690..094f732 100644 --- a/Python/marshal.c +++ b/Python/marshal.c @@ -57,7 +57,7 @@ typedef struct { int error; /* see WFERR_* values */ int depth; /* If fp == NULL, the following are valid: */ - PyObject * readable; /* Stream-like object being read from */ + PyObject *readable; /* Stream-like object being read from */ PyObject *str; char *ptr; char *end; @@ -470,7 +470,7 @@ typedef WFILE RFILE; /* Same struct with different invariants */ static int r_string(char *s, int n, RFILE *p) { - char * ptr; + char *ptr; int read, left; if (!p->readable) { @@ -569,7 +569,7 @@ r_long(RFILE *p) static PyObject * r_long64(RFILE *p) { - PyObject * result = NULL; + PyObject *result = NULL; long lo4 = r_long(p); long hi4 = r_long(p); -- cgit v0.12 From cab106cfca99aab5094e344308c8c5ad3bab2167 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Araujo?= Date: Tue, 26 Jul 2011 17:32:50 +0200 Subject: Fix sorting or wording of some NEWS entries. I would have put io and ctypes fixes into Extension Modules, but I respected the choice of Antoine or Victor and left them in Library. --- Misc/NEWS | 55 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS index 662eedc..150b5f3 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,12 @@ What's New in Python 3.2.2? Core and Builtins ----------------- +- Issue #11603: Fix a crash when __str__ is rebound as __repr__. Patch by + Andreas Stührk. + +- Issue #11321: Fix a crash with multiple imports of the _pickle module when + embedding Python. Patch by Andreas Stührk. + - Verify the types of AST strings and identifiers provided by the user before compiling them. @@ -26,8 +32,6 @@ Core and Builtins deallocator calls one of the methods on the type (e.g. when subclassing IOBase). Diagnosis and patch by Davide Rizzo. -- Issue #9611, #9015: FileIO.read() clamps the length to INT_MAX on Windows. - - When a generator yields, do not retain the caller's exception state on the generator. @@ -37,11 +41,6 @@ Core and Builtins Library ------- -- Issue #12102: Document that buffered files must be flushed before being used - with mmap. Patch by Steffen Daode Nurpmeso. - -- Issue #12560: Build libpython.so on OpenBSD. Patch by Stefan Sperling. - - Issue #1813: Fix codec lookup under Turkish locales. - Issue #12591: Improve support of "universal newlines" in the subprocess @@ -51,11 +50,9 @@ Library a read1() method), and add an undocumented *write_through* parameter to mandate unbuffered writes. -- Issue #10883: Fix socket leaks in urllib.request when using FTP. - -- Issue #12592: Make Python build on OpenBSD 5 (and future major releases). +- Issue #9611, #9015: FileIO.read() clamps the length to INT_MAX on Windows. -- Issue #12372: POSIX semaphores are broken on AIX: don't use them. +- Issue #10883: Fix socket leaks in urllib.request when using FTP. - Issue #12571: Add a plat-linux3 directory mirroring the plat-linux2 directory, so that "import DLFCN" and other similar imports work on @@ -67,16 +64,10 @@ Library - Close the call queue in concurrent.futures.ProcessPoolExecutor when shutdown() is called, without waiting for the garbage collector to kick in. -- Issue #11603: Fix a crash when __str__ is rebound as __repr__. Patch by - Andreas Stührk. - -- Issue #11321: Fix a crash with multiple imports of the _pickle module when - embedding Python. Patch by Andreas Stührk. - - Issue #12502: asyncore: fix polling loop with AF_UNIX sockets. -- Issue #4376: ctypes now supports nested structures in a endian different than - the parent structure. Patch by Vlad Riscutia. +- Issue #4376: ctypes now supports nested structures with an endianness + different than that of the parent structure. Patch by Vlad Riscutia. - Raise ValueError when attempting to set the _CHUNK_SIZE attribute of a TextIOWrapper to a huge value, not TypeError. @@ -85,15 +76,15 @@ Library if the process has only one pipe. - Issue #12451: pydoc: html_getfile() now uses tokenize.open() to support - Python scripts using a encoding different than UTF-8 (read the coding cookie - of the script). + Python modules using a encoding different than UTF-8 (reading the coding + cookie of the module). -- Issue #12451: pydoc: importfile() now opens the Python script in binary mode, +- Issue #12451: pydoc: importfile() now opens the Python module in binary mode, instead of text mode using the locale encoding, to avoid encoding issues. -- Issue #12451: runpy: run_path() now opens the Python script in binary mode, +- Issue #12451: runpy: run_path() now opens the Python module in binary mode, instead of text mode using the locale encoding, to support other encodings - than UTF-8 (scripts using the coding cookie). + than UTF-8 (modules using the coding cookie). - Issue #12451: xml.dom.pulldom: parse() now opens files in binary mode instead of the text mode (using the locale encoding) to avoid encoding issues. @@ -108,6 +99,16 @@ Extension Modules C-API ----- +Build +----- + +- Issue #12560: Build libpython.so on OpenBSD. Patch by Stefan Sperling. + +- Issue #12592: Make Python build on OpenBSD 5 (and future major releases). + +- Issue #12372: POSIX semaphores are broken on AIX: don't use them. + + Tests ----- @@ -227,9 +228,6 @@ Library greater or equal to the default value, the value with which the interpreter was built. -- Issue #12404: Remove C89 incompatible code from mmap module. Patch by Akira - Kitada. - - Issue #12383: Fix subprocess module with env={}: don't copy the environment variables, start with an empty environment. @@ -296,6 +294,9 @@ Library Extension Modules ----------------- +- Issue #12404: Remove C89 incompatible code from mmap module. Patch by Akira + Kitada. + - Issue #12221: Replace pyexpat.__version__ with the Python version. Build -- cgit v0.12 From 1ce7b17165c405a0772fb49c3b7143aa6b9ce4cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Araujo?= Date: Tue, 26 Jul 2011 17:36:19 +0200 Subject: Fix string exception and a few style issues in mailerdaemon script --- Tools/scripts/mailerdaemon.py | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/Tools/scripts/mailerdaemon.py b/Tools/scripts/mailerdaemon.py index 4934b92..62189f1 100644 --- a/Tools/scripts/mailerdaemon.py +++ b/Tools/scripts/mailerdaemon.py @@ -1,4 +1,4 @@ -"""mailerdaemon - classes to parse mailer-daemon messages""" +"""Classes to parse mailer-daemon messages.""" import calendar import email.message @@ -6,7 +6,10 @@ import re import os import sys -Unparseable = 'mailerdaemon.Unparseable' + +class Unparseable(Exception): + pass + class ErrorMessage(email.message.Message): def __init__(self): @@ -18,8 +21,10 @@ class ErrorMessage(email.message.Message): if not sub: return 0 sub = sub.lower() - if sub.startswith('waiting mail'): return 1 - if 'warning' in sub: return 1 + if sub.startswith('waiting mail'): + return 1 + if 'warning' in sub: + return 1 self.sub = sub return 0 @@ -145,14 +150,17 @@ def emparse_list(fp, sub): errors.append(' '.join((email.strip()+': '+reason).split())) return errors -EMPARSERS = [emparse_list, ] +EMPARSERS = [emparse_list] def sort_numeric(a, b): a = int(a) b = int(b) - if a < b: return -1 - elif a > b: return 1 - else: return 0 + if a < b: + return -1 + elif a > b: + return 1 + else: + return 0 def parsedir(dir, modify): os.chdir(dir) -- cgit v0.12 From a0e92a802815d55dafd303b39843ddd2b9784bdb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Araujo?= Date: Tue, 26 Jul 2011 18:01:08 +0200 Subject: Fix missing or wrong shebangs and missing executable bits for scripts (#10318) --- Tools/scripts/abitype.py | 1 + Tools/scripts/cleanfuture.py | 0 Tools/scripts/combinerefs.py | 0 Tools/scripts/db2pickle.py | 0 Tools/scripts/diff.py | 1 + Tools/scripts/find_recursionlimit.py | 0 Tools/scripts/get-remote-certificate.py | 0 Tools/scripts/mailerdaemon.py | 1 + Tools/scripts/make_ctype.py | 1 + Tools/scripts/md5sum.py | 0 Tools/scripts/patchcheck.py | 1 + Tools/scripts/pickle2db.py | 0 Tools/scripts/pysource.py | 0 Tools/scripts/reindent-rst.py | 2 +- Tools/scripts/svneol.py | 0 15 files changed, 6 insertions(+), 1 deletion(-) mode change 100644 => 100755 Tools/scripts/abitype.py mode change 100644 => 100755 Tools/scripts/cleanfuture.py mode change 100644 => 100755 Tools/scripts/combinerefs.py mode change 100644 => 100755 Tools/scripts/db2pickle.py mode change 100644 => 100755 Tools/scripts/diff.py mode change 100644 => 100755 Tools/scripts/find_recursionlimit.py mode change 100644 => 100755 Tools/scripts/get-remote-certificate.py mode change 100644 => 100755 Tools/scripts/mailerdaemon.py mode change 100644 => 100755 Tools/scripts/make_ctype.py mode change 100644 => 100755 Tools/scripts/md5sum.py mode change 100644 => 100755 Tools/scripts/patchcheck.py mode change 100644 => 100755 Tools/scripts/pickle2db.py mode change 100644 => 100755 Tools/scripts/pysource.py mode change 100644 => 100755 Tools/scripts/svneol.py diff --git a/Tools/scripts/abitype.py b/Tools/scripts/abitype.py old mode 100644 new mode 100755 index e35ef6a..4d96c8b --- a/Tools/scripts/abitype.py +++ b/Tools/scripts/abitype.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 # This script converts a C file to use the PEP 384 type definition API # Usage: abitype.py < old_code > new_code import re, sys diff --git a/Tools/scripts/cleanfuture.py b/Tools/scripts/cleanfuture.py old mode 100644 new mode 100755 diff --git a/Tools/scripts/combinerefs.py b/Tools/scripts/combinerefs.py old mode 100644 new mode 100755 diff --git a/Tools/scripts/db2pickle.py b/Tools/scripts/db2pickle.py old mode 100644 new mode 100755 diff --git a/Tools/scripts/diff.py b/Tools/scripts/diff.py old mode 100644 new mode 100755 index 52dcab1..9efb078 --- a/Tools/scripts/diff.py +++ b/Tools/scripts/diff.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 """ Command line interface to difflib.py providing diffs in four formats: * ndiff: lists every line and highlights interline changes. diff --git a/Tools/scripts/find_recursionlimit.py b/Tools/scripts/find_recursionlimit.py old mode 100644 new mode 100755 diff --git a/Tools/scripts/get-remote-certificate.py b/Tools/scripts/get-remote-certificate.py old mode 100644 new mode 100755 diff --git a/Tools/scripts/mailerdaemon.py b/Tools/scripts/mailerdaemon.py old mode 100644 new mode 100755 index 62189f1..aeb451e --- a/Tools/scripts/mailerdaemon.py +++ b/Tools/scripts/mailerdaemon.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 """Classes to parse mailer-daemon messages.""" import calendar diff --git a/Tools/scripts/make_ctype.py b/Tools/scripts/make_ctype.py old mode 100644 new mode 100755 index 359d6b3..afee1c5 --- a/Tools/scripts/make_ctype.py +++ b/Tools/scripts/make_ctype.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 """Script that generates the ctype.h-replacement in stringobject.c.""" NAMES = ("LOWER", "UPPER", "ALPHA", "DIGIT", "XDIGIT", "ALNUM", "SPACE") diff --git a/Tools/scripts/md5sum.py b/Tools/scripts/md5sum.py old mode 100644 new mode 100755 diff --git a/Tools/scripts/patchcheck.py b/Tools/scripts/patchcheck.py old mode 100644 new mode 100755 index e767eda..13b8ba4 --- a/Tools/scripts/patchcheck.py +++ b/Tools/scripts/patchcheck.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 import re import sys import shutil diff --git a/Tools/scripts/pickle2db.py b/Tools/scripts/pickle2db.py old mode 100644 new mode 100755 diff --git a/Tools/scripts/pysource.py b/Tools/scripts/pysource.py old mode 100644 new mode 100755 diff --git a/Tools/scripts/reindent-rst.py b/Tools/scripts/reindent-rst.py index ceb84bf..25608af 100755 --- a/Tools/scripts/reindent-rst.py +++ b/Tools/scripts/reindent-rst.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Make a reST file compliant to our pre-commit hook. # Currently just remove trailing whitespace. diff --git a/Tools/scripts/svneol.py b/Tools/scripts/svneol.py old mode 100644 new mode 100755 -- cgit v0.12 From 5c8545bb2cc081dda2b26df48350f22891401d49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Araujo?= Date: Thu, 28 Jul 2011 22:38:44 +0200 Subject: Make VCSes ignore the compiled shared library file (#12255) --- .bzrignore | 1 + .gitignore | 1 + .hgignore | 1 + 3 files changed, 3 insertions(+) diff --git a/.bzrignore b/.bzrignore index e893a7d..959a7df 100644 --- a/.bzrignore +++ b/.bzrignore @@ -14,6 +14,7 @@ platform pybuilddir.txt pyconfig.h libpython*.a +libpython*.so* python.exe python-gdb.py reflog.txt diff --git a/.gitignore b/.gitignore index 63f4314..da0ca02 100644 --- a/.gitignore +++ b/.gitignore @@ -37,6 +37,7 @@ build/ config.log config.status libpython*.a +libpython*.so* pybuilddir.txt pyconfig.h python diff --git a/.hgignore b/.hgignore index 7136ed1..f109296 100644 --- a/.hgignore +++ b/.hgignore @@ -39,6 +39,7 @@ Parser/pgen.stamp$ syntax: glob libpython*.a +libpython*.so* *.swp *.o *.pyc -- cgit v0.12 From 2f834f20615d5b69b8476aea533de549808d993f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Araujo?= Date: Thu, 28 Jul 2011 22:45:46 +0200 Subject: Stop ignoring Mercurial merge conflits files (#12255). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit R. David Murray and I think that it’s more useful to have these files show up in the output of “hg status”, to let the user know that some merged file have to be checked before commit. If you want to ignore these files in your clones, it’s possible to do so from another ignore file; see the bug report for directions. I’m leaving the .gitignore file alone, as I don’t know how git users work with merges and conflicts. --- .hgignore | 2 -- 1 file changed, 2 deletions(-) diff --git a/.hgignore b/.hgignore index f109296..b11e43c 100644 --- a/.hgignore +++ b/.hgignore @@ -46,8 +46,6 @@ libpython*.so* *.pyo *.pyd *.cover -*.orig -*.rej *~ Lib/lib2to3/*.pickle Lib/test/data/* -- cgit v0.12 From 14382dc887ce25d6f2eb58945c2c7cf57b668d13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Araujo?= Date: Thu, 28 Jul 2011 22:49:11 +0200 Subject: Update documentation for shutil.move (#12043) and fix a few typos. Adding Sandro Tosi to Doc/ACKS for this patch and all his work on the docs mailing list and on the bug tracker. --- Doc/ACKS.txt | 1 + Doc/library/shutil.rst | 26 ++++++++++++++++---------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/Doc/ACKS.txt b/Doc/ACKS.txt index c528247..271ece9 100644 --- a/Doc/ACKS.txt +++ b/Doc/ACKS.txt @@ -203,6 +203,7 @@ docs@python.org), and we'll be glad to correct the problem. * Kalle Svensson * Jim Tittsler * David Turner + * Sandro Tosi * Ville Vainio * Martijn Vries * Charles G. Waldman diff --git a/Doc/library/shutil.rst b/Doc/library/shutil.rst index 1f194a0..5e5f8c9 100644 --- a/Doc/library/shutil.rst +++ b/Doc/library/shutil.rst @@ -159,19 +159,25 @@ Directory and files operations .. function:: move(src, dst) - Recursively move a file or directory to another location. + Recursively move a file or directory (*src*) to another location (*dst*). - Uses :func:`os.rename` to perform the move. If it fails, for reasons such as - when *src* and *dst* are on different filesystems or in case of windows where - rename is not supported when *dst* exists, fallback to copying *src* (with - :func:`copy2`) to the *dst* and then remove *src*. + If the destination is a directory or a symlink to a directory, then *src* is + moved inside that directory. + + The destination directory must not already exist. If the destination already + exists but is not a directory, it may be overwritten depending on + :func:`os.rename` semantics. + + If the destination is on the current filesystem, then :func:`os.rename` is + used. Otherwise, *src* is copied (using :func:`copy2`) to *dst* and then + removed. .. exception:: Error - This exception collects exceptions that raised during a multi-file operation. For - :func:`copytree`, the exception argument is a list of 3-tuples (*srcname*, - *dstname*, *exception*). + This exception collects exceptions that are raised during a multi-file + operation. For :func:`copytree`, the exception argument is a list of 3-tuples + (*srcname*, *dstname*, *exception*). .. _shutil-example: @@ -269,7 +275,7 @@ Archiving operations .. function:: get_archive_formats() - Returns a list of supported formats for archiving. + Return a list of supported formats for archiving. Each element of the returned sequence is a tuple ``(name, description)`` By default :mod:`shutil` provides these formats: @@ -287,7 +293,7 @@ Archiving operations .. function:: register_archive_format(name, function, [extra_args, [description]]) - Registers an archiver for the format *name*. *function* is a callable that + Register an archiver for the format *name*. *function* is a callable that will be used to invoke the archiver. If given, *extra_args* is a sequence of ``(name, value)`` pairs that will be -- cgit v0.12 From f5e10d1f70f4ff923c9b5f868ba508b545b4851e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Araujo?= Date: Thu, 28 Jul 2011 22:50:18 +0200 Subject: Turn raw URI into real link --- Doc/distutils/apiref.rst | 4 ++-- Doc/tools/sphinxext/susp-ignored.csv | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Doc/distutils/apiref.rst b/Doc/distutils/apiref.rst index 1fb6f9e..124d891 100644 --- a/Doc/distutils/apiref.rst +++ b/Doc/distutils/apiref.rst @@ -72,8 +72,8 @@ setup script). Indirectly provides the :class:`distutils.dist.Distribution` and | | be built | :class:`distutils.core.Extension` | +--------------------+--------------------------------+-------------------------------------------------------------+ | *classifiers* | A list of categories for the | The list of available | - | | package | categorizations is at | - | | | http://pypi.python.org/pypi?:action=list_classifiers. | + | | package | categorizations is available on `PyPI | + | | | `_. | +--------------------+--------------------------------+-------------------------------------------------------------+ | *distclass* | the :class:`Distribution` | A subclass of | | | class to use | :class:`distutils.core.Distribution` | diff --git a/Doc/tools/sphinxext/susp-ignored.csv b/Doc/tools/sphinxext/susp-ignored.csv index 65aac4d..c2e4c43 100644 --- a/Doc/tools/sphinxext/susp-ignored.csv +++ b/Doc/tools/sphinxext/susp-ignored.csv @@ -5,7 +5,6 @@ c-api/sequence,,:i2,o[i1:i2] c-api/sequence,,:i2,o[i1:i2] = v c-api/sequence,,:i2,del o[i1:i2] c-api/unicode,,:end,str[start:end] -distutils/apiref,,:action,http://pypi.python.org/pypi?:action=list_classifiers distutils/setupscript,,::, extending/embedding,,:numargs,"if(!PyArg_ParseTuple(args, "":numargs""))" extending/extending,,:set,"if (PyArg_ParseTuple(args, ""O:set_callback"", &temp)) {" -- cgit v0.12 From ee19c772cb5795cb3e435a6f85634f05bf3248a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Araujo?= Date: Thu, 28 Jul 2011 22:56:24 +0200 Subject: Remove mentions of previous license in profile module docs (#12417 followup). Also remove an extra docstring. --- Doc/library/profile.rst | 26 +------------------------- Doc/license.rst | 30 ------------------------------ Lib/pstats.py | 4 ---- 3 files changed, 1 insertion(+), 59 deletions(-) diff --git a/Doc/library/profile.rst b/Doc/library/profile.rst index 82cc2eb..bda977f 100644 --- a/Doc/library/profile.rst +++ b/Doc/library/profile.rst @@ -37,7 +37,7 @@ The Python standard library provides two different profilers: 2. :mod:`profile`, a pure Python module whose interface is imitated by :mod:`cProfile`. Adds significant overhead to profiled programs. If you're trying to extend the profiler in some way, the task might be easier with this - module. Copyright © 1994, by InfoSeek Corporation. + module. The :mod:`profile` and :mod:`cProfile` modules export the same interface, so they are mostly interchangeable; :mod:`cProfile` has a much lower overhead but @@ -589,27 +589,3 @@ The resulting profiler will then call :func:`your_time_func`. functions should be used with care and should be as fast as possible. For the best results with a custom timer, it might be necessary to hard-code it in the C source of the internal :mod:`_lsprof` module. - - -Copyright and License Notices -============================= - -Copyright © 1994, by InfoSeek Corporation, all rights reserved. - -Permission to use, copy, modify, and distribute this Python software and its -associated documentation for any purpose (subject to the restriction in the -following sentence) without fee is hereby granted, provided that the above -copyright notice appears in all copies, and that both that copyright notice and -this permission notice appear in supporting documentation, and that the name of -InfoSeek not be used in advertising or publicity pertaining to distribution of -the software without specific, written prior permission. This permission is -explicitly restricted to the copying and modification of the software to remain -in Python, compiled Python, or other languages (such as C) wherein the modified -or derived code is exclusively imported into a Python module. - -INFOSEEK CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT -SHALL INFOSEEK CORPORATION BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL -DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING -OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/Doc/license.rst b/Doc/license.rst index a4f0994..f45f0ae 100644 --- a/Doc/license.rst +++ b/Doc/license.rst @@ -489,36 +489,6 @@ The :mod:`http.cookies` module contains the following notice:: PERFORMANCE OF THIS SOFTWARE. -Profiling ---------- - -The :mod:`profile` and :mod:`pstats` modules contain the following notice:: - - Copyright 1994, by InfoSeek Corporation, all rights reserved. - Written by James Roskind - - Permission to use, copy, modify, and distribute this Python software - and its associated documentation for any purpose (subject to the - restriction in the following sentence) without fee is hereby granted, - provided that the above copyright notice appears in all copies, and - that both that copyright notice and this permission notice appear in - supporting documentation, and that the name of InfoSeek not be used in - advertising or publicity pertaining to distribution of the software - without specific, written prior permission. This permission is - explicitly restricted to the copying and modification of the software - to remain in Python, compiled Python, or other languages (such as C) - wherein the modified or derived code is exclusively imported into a - Python module. - - INFOSEEK CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS - SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - FITNESS. IN NO EVENT SHALL INFOSEEK CORPORATION BE LIABLE FOR ANY - SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - - Execution tracing ----------------- diff --git a/Lib/pstats.py b/Lib/pstats.py index 3d802af..74360e3 100644 --- a/Lib/pstats.py +++ b/Lib/pstats.py @@ -1,13 +1,9 @@ """Class for printing reports on profiled python code.""" -# Class for printing reports on profiled python code. rev 1.0 4/1/94 -# # Written by James Roskind # Based on prior profile module by Sjoerd Mullender... # which was hacked somewhat by: Guido van Rossum -"""Class for profiling Python code.""" - # Copyright Disney Enterprises, Inc. All Rights Reserved. # Licensed to PSF under a Contributor Agreement # -- cgit v0.12