Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6461e10

Browse files
committed
Merged revisions 62914-62916,62918-62919,62921-62922,62924-62942,62944-62945,62947-62949 via svnmerge from
svn+ssh://[email protected]/python/trunk ........ r62914 | skip.montanaro | 2008-05-08 20:45:00 -0400 (Thu, 08 May 2008) | 4 lines Add an example about using NamedTemporaryFile() to replace mktemp(). I'm unclear whether the verbatim text should have been indented or by how much. ........ r62915 | benjamin.peterson | 2008-05-08 20:50:40 -0400 (Thu, 08 May 2008) | 2 lines reindent example ........ r62927 | georg.brandl | 2008-05-09 02:09:25 -0400 (Fri, 09 May 2008) | 2 lines #2788: add .hgignore file. ........ r62928 | georg.brandl | 2008-05-09 02:10:43 -0400 (Fri, 09 May 2008) | 2 lines #2781: fix function name. ........ r62929 | georg.brandl | 2008-05-09 02:18:27 -0400 (Fri, 09 May 2008) | 2 lines Add a sentence to basicConfig() that is in the docstring. ........ r62930 | georg.brandl | 2008-05-09 02:26:54 -0400 (Fri, 09 May 2008) | 2 lines Add another link to colorsys docs. ........ r62931 | georg.brandl | 2008-05-09 02:36:07 -0400 (Fri, 09 May 2008) | 2 lines Add Kodos as a re reference. ........ r62932 | georg.brandl | 2008-05-09 02:39:58 -0400 (Fri, 09 May 2008) | 2 lines Add a note about using reload(). ........ r62933 | andrew.kuchling | 2008-05-09 07:46:05 -0400 (Fri, 09 May 2008) | 3 lines Update planned release date. Uncomment PEP 370 section. Add some module items ........ r62934 | christian.heimes | 2008-05-09 08:19:09 -0400 (Fri, 09 May 2008) | 1 line Add --user option to build_ext ........ r62948 | mark.dickinson | 2008-05-09 13:54:23 -0400 (Fri, 09 May 2008) | 3 lines Issue #2487. math.ldexp(x, n) raised OverflowError when n was large and negative; fix to return an (appropriately signed) zero instead. ........ r62949 | martin.v.loewis | 2008-05-09 14:21:55 -0400 (Fri, 09 May 2008) | 1 line Use the CHM file name that Sphinx assigns. ........
1 parent b645bc7 commit 6461e10

13 files changed

Lines changed: 260 additions & 45 deletions

File tree

.hgignore

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
.gdb_history
2+
.purify
3+
.svn
4+
BIG5.TXT
5+
BIG5HKSCS-2004.TXT
6+
BIG5HKSCS.TXT
7+
CP932.TXT
8+
CP936.TXT
9+
CP949.TXT
10+
CP950.TXT
11+
EUC-CN.TXT
12+
EUC-JISX0213.TXT
13+
EUC-JP.TXT
14+
EUC-KR.TXT
15+
JOHAB.TXT
16+
Makefile
17+
Makefile.pre
18+
NormalizationTest-3.2.0.txt
19+
NormalizationTest.txt
20+
SHIFTJIS.TXT
21+
SHIFT_JISX0213.TXT
22+
TAGS
23+
autom4te.cache
24+
build
25+
buildno
26+
config.cache
27+
config.log
28+
config.status
29+
config.status.lineno
30+
db_home
31+
gb-18030-2000.xml
32+
platform
33+
pyconfig.h
34+
python
35+
python.exe
36+
reflog.txt
37+
tags
38+
Lib/plat-mac/errors.rsrc.df.rsrc
39+
Doc/tools/sphinx/
40+
Doc/tools/docutils/
41+
Doc/tools/jinja/
42+
Doc/tools/pygments/
43+
Modules/Setup
44+
Modules/Setup.config
45+
Modules/Setup.local
46+
Modules/config.c
47+
Parser/pgen
48+
core
49+
50+
syntax: glob
51+
libpython*.a
52+
*.o
53+
*.pyc
54+
*.pyo
55+
*.pyd
56+
*.cover
57+
*.orig
58+
*.rej
59+
*~
60+
Lib/lib2to3/*.pickle
61+
PCbuild/*.exe
62+
PCbuild/*.dll
63+
PCbuild/*.pdb
64+
PCbuild/*.lib
65+
PCbuild/*.exp
66+
PCbuild/*.o
67+
PCbuild/*.ncb
68+
PCbuild/*.bsc
69+
PCbuild/Win32-temp-*

Doc/library/_winreg.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ This module offers the following functions:
146146
*key* is an already open key, or one of the predefined :const:`HKEY_\*`
147147
constants.
148148

149-
It is not necessary to call RegFlushKey to change a key. Registry changes are
149+
It is not necessary to call :func:`FlushKey` to change a key. Registry changes are
150150
flushed to disk by the registry using its lazy flusher. Registry changes are
151151
also flushed to disk at system shutdown. Unlike :func:`CloseKey`, the
152152
:func:`FlushKey` method returns only when all the data has been written to the
@@ -159,7 +159,7 @@ This module offers the following functions:
159159
isn't.
160160

161161

162-
.. function:: RegLoadKey(key, sub_key, file_name)
162+
.. function:: LoadKey(key, sub_key, file_name)
163163

164164
Creates a subkey under the specified key and stores registration information
165165
from a specified file into that subkey.

Doc/library/colorsys.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
:mod:`colorsys` --- Conversions between color systems
32
=====================================================
43

@@ -15,8 +14,11 @@ spaces are floating point values. In the YIQ space, the Y coordinate is between
1514
0 and 1, but the I and Q coordinates can be positive or negative. In all other
1615
spaces, the coordinates are all between 0 and 1.
1716

18-
More information about color spaces can be found at
19-
http://www.poynton.com/ColorFAQ.html.
17+
.. seealso::
18+
19+
More information about color spaces can be found at
20+
http://www.poynton.com/ColorFAQ.html and
21+
http://www.cambridgeincolour.com/tutorials/color-spaces.htm.
2022

2123
The :mod:`colorsys` module defines the following functions:
2224

@@ -57,4 +59,3 @@ Example::
5759
(0.25, 0.5, 0.4)
5860
>>> colorsys.hsv_to_rgb(0.25, 0.5, 0.4)
5961
(0.3, 0.4, 0.2)
60-

Doc/library/re.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ fine-tuning parameters.
4343
second edition of the book no longer covers Python at all, but the first
4444
edition covered writing good regular expression patterns in great detail.
4545

46+
`Kodos <http://kodos.sf.net/>`_
47+
is a graphical regular expression debugger written in Python.
48+
4649

4750
.. _re-syntax:
4851

Doc/library/tempfile.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,24 @@ The module defines the following user-callable functions:
152152
Use of this function may introduce a security hole in your program.
153153
By the time you get around to doing anything with the file name it
154154
returns, someone else may have beaten you to the punch.
155+
:func:`mktemp` usage can be replaced easily with
156+
:func:`NamedTemporaryFile`, passing it the `delete=False` parameter::
157+
158+
>>> f = NamedTemporaryFile(delete=False)
159+
>>> print f.name
160+
>>> f.write("Hello World!\n")
161+
>>> f.close()
162+
>>> os.unlink(f.name)
163+
>>> f = NamedTemporaryFile(delete=False)
164+
>>> f
165+
<open file '<fdopen>', mode 'w+b' at 0x384698>
166+
>>> f.name
167+
'/var/folders/5q/5qTPn6xq2RaWqk+1Ytw3-U+++TI/-Tmp-/tmpG7V1Y0'
168+
>>> f.write("Hello World!\n")
169+
>>> f.close()
170+
>>> os.unlink(f.name)
171+
>>> os.path.exists(f.name)
172+
False
155173

156174
The module uses two global variables that tell it how to construct a
157175
temporary name. They are initialized at the first call to any of the

Doc/tutorial/modules.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,13 @@ In most cases Python programmers do not use this facility since it introduces
106106
an unknown set of names into the interpreter, possibly hiding some things
107107
you have already defined.
108108

109+
.. note::
110+
111+
For efficiency reasons, each module is only imported once per interpreter
112+
session. Therefore, if you change your modules, you must restart the
113+
interpreter -- or, if it's just one module you want to test interactively,
114+
use :func:`reload`, e.g. ``reload('modulename')``.
115+
109116

110117
.. _tut-modulesasscripts:
111118

Doc/whatsnew/2.6.rst

Lines changed: 53 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -40,25 +40,26 @@
4040
* Credit the author of a patch or bugfix. Just the name is
4141
sufficient; the e-mail address isn't necessary.
4242
43-
* It's helpful to add the bug/patch number in an parenthetical
43+
* It's helpful to add the bug/patch number in a parenthetical comment.
4444
4545
XXX Describe the transmogrify() function added to the socket
4646
module.
4747
(Contributed by P.Y. Developer; :issue:`12345`.)
4848
49-
This saves the maintainer the effort of going through the SVN logs
49+
This saves the maintainer some effort going through the SVN logs
5050
when researching a change.
5151
52-
This article explains the new features in Python 2.6. No release date for
53-
Python 2.6 has been set; it will probably be released in mid 2008.
52+
This article explains the new features in Python 2.6. The release
53+
schedule is described in :pep:`361`; currently the final release is
54+
scheduled for September 3 2008.
5455

5556
This article doesn't attempt to provide a complete specification of
5657
the new features, but instead provides a convenient overview. For
5758
full details, you should refer to the documentation for Python 2.6. If
58-
you want to understand the complete implementation and design
59-
rationale, refer to the PEP for a particular new feature. For smaller
60-
changes, this edition of "What's New in Python" links to the bug/patch
61-
item for each change whenever possible.
59+
you want to understand the rationale for the design and
60+
implementation, refer to the PEP for a particular new feature.
61+
Whenever possible, "What's New in Python" links to the bug/patch item
62+
for each change.
6263

6364
.. Compare with previous release in 2 - 3 sentences here.
6465
add hyperlink when the documentation becomes available online.
@@ -481,24 +482,41 @@ can now be used in scripts running from inside a package.
481482

482483
.. ======================================================================
483484
484-
.. ::
485+
.. _pep-0370:
485486

486-
.. _pep-0370:
487+
PEP 370: Per-user ``site-packages`` Directory
488+
=====================================================
489+
490+
When you run Python, the module search path ``sys.modules`` usually
491+
includes a directory whose path ends in ``"site-packages"``. This
492+
directory is intended to hold locally-installed packages available to
493+
all users on a machine or using a particular site installation.
494+
495+
Python 2.6 introduces a convention for user-specific site directories.
496+
The directory varies depending on the platform:
497+
498+
* Unix and MacOS: :file:`~/.local/`
499+
* Windows: :file:`%APPDATA%/Python`
487500

488-
PEP 370: XXX
489-
=====================================================
501+
Within this directory, there will be version-specific subdirectories,
502+
such as :file:`lib/python2.6/site-packages` on Unix/MacOS and
503+
:file:`Python26/site-packages` on Windows.
490504

491-
When you run Python, the module search page ``sys.modules`` usually
492-
includes a directory whose path ends in ``"site-packages"``. This
493-
directory is intended to hold locally-installed packages available to
494-
all users on a machine or using a particular site installation.
505+
If you don't like the default directory, it can be overridden by an
506+
environment variable. :envvar:`PYTHONUSERBASE` sets the root
507+
directory used for all Python versions supporting this feature. On
508+
Windows, the directory for application-specific data can be changed by
509+
setting the :envvar:`APPDATA` environment variable. You can also
510+
modify the :file:`site.py` file for your Python installation.
495511

496-
Python 2.6 introduces a convention for user-specific site directories.
512+
The feature can be disabled entirely by running Python with the
513+
:option:`-s` option or setting the :envvar:`PYTHONNOUSERSITE`
514+
environment variable.
497515

498-
.. seealso::
516+
.. seealso::
499517

500-
:pep:`370` - XXX
501-
PEP written by XXX; implemented by Christian Heimes.
518+
:pep:`370` - Per-user ``site-packages`` Directory
519+
PEP written and implemented by Christian Heimes.
502520

503521

504522
.. ======================================================================
@@ -1450,6 +1468,12 @@ fixes. Here's a partial list of the most notable changes, sorted alphabetically
14501468
by module name. Consult the :file:`Misc/NEWS` file in the source tree for a more
14511469
complete list of changes, or look through the CVS logs for all the details.
14521470

1471+
* (3.0-warning mode) The :mod:`audiodev` module is being deprecated,
1472+
and has been removed from Python 3.0, so importing it now triggers a
1473+
warning. The module hasn't been maintained for several versions,
1474+
and is written against an outdated sound interface for SunOS and
1475+
IRIX.
1476+
14531477
* The :mod:`bsddb.dbshelve` module now uses the highest pickling protocol
14541478
available, instead of restricting itself to protocol 1.
14551479
(Contributed by W. Barnes; :issue:`1551443`.)
@@ -2104,7 +2128,12 @@ complete list of changes, or look through the CVS logs for all the details.
21042128

21052129
(Added by Facundo Batista.)
21062130

2107-
* The XML-RPC classes :class:`SimpleXMLRPCServer` and :class:`DocXMLRPCServer`
2131+
* The :mod:`warnings` module's :func:`formatwarning` and :func:`showwarning`
2132+
gained an optional *line* argument that can be used to supply the
2133+
line of source code. (Added as part of :issue:`1631171`, which re-implemented
2134+
part of the :mod:`warnings` module in C code.)
2135+
2136+
* The XML-RPC :class:`SimpleXMLRPCServer` and :class:`DocXMLRPCServer`
21082137
classes can now be prevented from immediately opening and binding to
21092138
their socket by passing True as the ``bind_and_activate``
21102139
constructor parameter. This can be used to modify the instance's
@@ -2144,6 +2173,9 @@ complete list of changes, or look through the CVS logs for all the details.
21442173

21452174
(Contributed by Alan McIntyre; :issue:`467924`.)
21462175

2176+
Also, :mod:`zipfile` now supports using Unicode filenames
2177+
for archived files. (Contributed by Alexey Borzenkov; :issue:`1734346`.)
2178+
21472179
.. ======================================================================
21482180
.. whole new modules get described in subsections here
21492181

Lib/distutils/command/build_ext.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
__revision__ = "$Id$"
88

99
import sys, os, re
10+
from site import USER_BASE, USER_SITE
1011
from distutils.core import Command
1112
from distutils.errors import *
1213
from distutils.sysconfig import customize_compiler, get_python_version
@@ -90,9 +91,11 @@ class build_ext(Command):
9091
"list of SWIG command line options"),
9192
('swig=', None,
9293
"path to the SWIG executable"),
94+
('user', None,
95+
"add user include, library and rpath"),
9396
]
9497

95-
boolean_options = ['inplace', 'debug', 'force', 'swig-cpp']
98+
boolean_options = ['inplace', 'debug', 'force', 'swig-cpp', 'user']
9699

97100
help_options = [
98101
('help-compiler', None,
@@ -120,6 +123,7 @@ def initialize_options(self):
120123
self.swig = None
121124
self.swig_cpp = None
122125
self.swig_opts = None
126+
self.user = None
123127

124128
def finalize_options(self):
125129
from distutils import sysconfig
@@ -253,6 +257,16 @@ def finalize_options(self):
253257
else:
254258
self.swig_opts = self.swig_opts.split(' ')
255259

260+
# Finally add the user include and library directories if requested
261+
if self.user:
262+
user_include = os.path.join(USER_BASE, "include")
263+
user_lib = os.path.join(USER_BASE, "lib")
264+
if os.path.isdir(user_include):
265+
self.include_dirs.append(user_include)
266+
if os.path.isdir(user_lib):
267+
self.library_dirs.append(user_lib)
268+
self.rpath.append(user_lib)
269+
256270
def run(self):
257271
from distutils.ccompiler import new_compiler
258272

Lib/site.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ def _script():
527527
528528
Exit codes with --user-base or --user-site:
529529
0 - user site directory is enabled
530-
1 - user site diretory is disabled by user
530+
1 - user site directory is disabled by user
531531
2 - uses site directory is disabled by super user
532532
or for security reasons
533533
>2 - unknown error

Lib/test/test_math.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,24 @@ def testLdexp(self):
369369
self.assertEquals(math.ldexp(NINF, -213), NINF)
370370
self.assert_(math.isnan(math.ldexp(NAN, 0)))
371371

372+
# large second argument
373+
for n in [10**5, 10**10, 10**20, 10**40]:
374+
self.assertEquals(math.ldexp(INF, -n), INF)
375+
self.assertEquals(math.ldexp(NINF, -n), NINF)
376+
self.assertEquals(math.ldexp(1., -n), 0.)
377+
self.assertEquals(math.ldexp(-1., -n), -0.)
378+
self.assertEquals(math.ldexp(0., -n), 0.)
379+
self.assertEquals(math.ldexp(-0., -n), -0.)
380+
self.assert_(math.isnan(math.ldexp(NAN, -n)))
381+
382+
self.assertRaises(OverflowError, math.ldexp, 1., n)
383+
self.assertRaises(OverflowError, math.ldexp, -1., n)
384+
self.assertEquals(math.ldexp(0., n), 0.)
385+
self.assertEquals(math.ldexp(-0., n), -0.)
386+
self.assertEquals(math.ldexp(INF, n), INF)
387+
self.assertEquals(math.ldexp(NINF, n), NINF)
388+
self.assert_(math.isnan(math.ldexp(NAN, n)))
389+
372390
def testLog(self):
373391
self.assertRaises(TypeError, math.log)
374392
self.ftest('log(1/e)', math.log(1/math.e), -1)

0 commit comments

Comments
 (0)