Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
0daf79bd
Commit
0daf79bd
authored
Oct 11, 2008
by
Benjamin Peterson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
merge from trunk
parent
5783bdd1
Changes
40
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
40 changed files
with
622 additions
and
306 deletions
+622
-306
Doc/Makefile
Doc/Makefile
+2
-2
Doc/c-api/init.rst
Doc/c-api/init.rst
+3
-3
Doc/conf.py
Doc/conf.py
+0
-7
Doc/contents.rst
Doc/contents.rst
+1
-1
Doc/library/ftplib.rst
Doc/library/ftplib.rst
+1
-1
Doc/library/functions.rst
Doc/library/functions.rst
+14
-3
Doc/library/sqlite3.rst
Doc/library/sqlite3.rst
+112
-31
Doc/library/subprocess.rst
Doc/library/subprocess.rst
+2
-2
Doc/reference/simple_stmts.rst
Doc/reference/simple_stmts.rst
+3
-3
Doc/tools/sphinxext/download.html
Doc/tools/sphinxext/download.html
+2
-2
Doc/tools/sphinxext/indexcontent.html
Doc/tools/sphinxext/indexcontent.html
+1
-1
Doc/tools/sphinxext/layout.html
Doc/tools/sphinxext/layout.html
+1
-2
Doc/whatsnew/2.2.rst
Doc/whatsnew/2.2.rst
+1
-1
Doc/whatsnew/2.3.rst
Doc/whatsnew/2.3.rst
+3
-3
Doc/whatsnew/2.4.rst
Doc/whatsnew/2.4.rst
+1
-1
Doc/whatsnew/2.5.rst
Doc/whatsnew/2.5.rst
+7
-9
Doc/whatsnew/2.6.rst
Doc/whatsnew/2.6.rst
+195
-182
Doc/whatsnew/2.7.rst
Doc/whatsnew/2.7.rst
+138
-0
Doc/whatsnew/3.0.rst
Doc/whatsnew/3.0.rst
+1
-1
Doc/whatsnew/index.rst
Doc/whatsnew/index.rst
+22
-0
Lib/optparse.py
Lib/optparse.py
+12
-10
Lib/test/test_atexit.py
Lib/test/test_atexit.py
+3
-2
Lib/test/test_bisect.py
Lib/test/test_bisect.py
+11
-0
Lib/test/test_datetime.py
Lib/test/test_datetime.py
+1
-1
Lib/test/test_dbm.py
Lib/test/test_dbm.py
+17
-0
Lib/test/test_docxmlrpc.py
Lib/test/test_docxmlrpc.py
+2
-2
Lib/test/test_set.py
Lib/test/test_set.py
+11
-0
Mac/BuildScript/build-installer.py
Mac/BuildScript/build-installer.py
+11
-9
Makefile.pre.in
Makefile.pre.in
+2
-2
Modules/_bisectmodule.c
Modules/_bisectmodule.c
+2
-2
Modules/_codecsmodule.c
Modules/_codecsmodule.c
+1
-1
Modules/cjkcodecs/multibytecodec.c
Modules/cjkcodecs/multibytecodec.c
+1
-1
Modules/posixmodule.c
Modules/posixmodule.c
+6
-1
Objects/dictobject.c
Objects/dictobject.c
+6
-4
Objects/floatobject.c
Objects/floatobject.c
+2
-2
Objects/listobject.c
Objects/listobject.c
+6
-3
Objects/setobject.c
Objects/setobject.c
+9
-5
Objects/tupleobject.c
Objects/tupleobject.c
+3
-1
Objects/unicodeobject.c
Objects/unicodeobject.c
+4
-4
setup.py
setup.py
+2
-1
No files found.
Doc/Makefile
View file @
0daf79bd
...
...
@@ -111,7 +111,7 @@ dist:
# archive the HTML
make
html
cp
-
a
build/html
dist/python$(DISTVERSION)-docs-html
cp
-
pPR
build/html
dist/python$(DISTVERSION)-docs-html
tar
-C
dist
-cf
dist/python$(DISTVERSION)-docs-html.tar
python$(DISTVERSION)-docs-html
bzip2
-9
-k
dist/python$(DISTVERSION)-docs-html.tar
(cd
dist;
zip
-q
-r
-9
python$(DISTVERSION)-docs-html.zip
python$(DISTVERSION)-docs-html)
...
...
@@ -120,7 +120,7 @@ dist:
# archive the text build
make
text
cp
-
a
build/text
dist/python$(DISTVERSION)-docs-text
cp
-
pPR
build/text
dist/python$(DISTVERSION)-docs-text
tar
-C
dist
-cf
dist/python$(DISTVERSION)-docs-text.tar
python$(DISTVERSION)-docs-text
bzip2
-9
-k
dist/python$(DISTVERSION)-docs-text.tar
(cd
dist;
zip
-q
-r
-9
python$(DISTVERSION)-docs-text.zip
python$(DISTVERSION)-docs-text)
...
...
Doc/c-api/init.rst
View file @
0daf79bd
...
...
@@ -744,11 +744,11 @@ created.
:cmacro:`Py_END_ALLOW_THREADS` macros is acceptable.
The return value is an opaque "handle" to the thread state when
:cfunc:`PyGILState_
Acqui
re` was called, and must be passed to
:cfunc:`PyGILState_
Ensu
re` was called, and must be passed to
:cfunc:`PyGILState_Release` to ensure Python is left in the same state. Even
though recursive calls are allowed, these handles *cannot* be shared - each
unique call to :cfunc:`PyGILState_Ensure` must save the handle for its call
to
:cfunc:`PyGILState_Release`.
unique call to :cfunc:`PyGILState_Ensure` must save the handle for its call
to
:cfunc:`PyGILState_Release`.
When the function returns, the current thread will hold the GIL. Failure is a
fatal error.
...
...
Doc/conf.py
View file @
0daf79bd
...
...
@@ -41,13 +41,6 @@ today_fmt = '%B %d, %Y'
# List of files that shouldn't be included in the build.
unused_docs
=
[
'whatsnew/2.0'
,
'whatsnew/2.1'
,
'whatsnew/2.2'
,
'whatsnew/2.3'
,
'whatsnew/2.4'
,
'whatsnew/2.5'
,
'whatsnew/2.6'
,
'maclib/scrap'
,
'library/xmllib'
,
'library/xml.etree'
,
...
...
Doc/contents.rst
View file @
0daf79bd
...
...
@@ -4,7 +4,7 @@
.. toctree::
whatsnew/
3.0
.rst
whatsnew/
index
.rst
tutorial/index.rst
using/index.rst
reference/index.rst
...
...
Doc/library/ftplib.rst
View file @
0daf79bd
...
...
@@ -299,7 +299,7 @@ followed by ``lines`` for the text version or ``binary`` for the binary version.
.. method:: FTP.quit()
Send a ``QUIT`` command to the server and close the connection. This is the
"polite" way to close a connection, but it may raise an exception
o
f the server
"polite" way to close a connection, but it may raise an exception
i
f the server
responds with an error to the ``QUIT`` command. This implies a call to the
:meth:`close` method which renders the :class:`FTP` instance useless for
subsequent calls (see below).
...
...
Doc/library/functions.rst
View file @
0daf79bd
...
...
@@ -22,9 +22,8 @@ are always available. They are listed here in alphabetical order.
The
function
is
invoked
by
the
:
keyword
:`
import
`
statement
.
It
mainly
exists
so
that
you
can
replace
it
with
another
function
that
has
a
compatible
interface
,
in
order
to
change
the
semantics
of
the
:
keyword
:`
import
`
statement
.
See
also
the
built
-
in
module
:
mod
:`
imp
`,
which
defines
some
useful
operations
out
of
which
you
can
build
your
own
:
func
:`
__import__
`
function
.
statement
.
See
the
built
-
in
module
:
mod
:`
imp
`,
which
defines
some
useful
operations
out
of
which
you
can
build
your
own
:
func
:`
__import__
`
function
.
For
example
,
the
statement
``
import
spam
``
results
in
the
following
call
:
``
__import__
(
'spam'
,
globals
(),
locals
(),
[],
-
1
)``;
the
statement
...
...
@@ -1201,6 +1200,18 @@ are always available. They are listed here in alphabetical order.
care about trailing, unmatched values from the longer iterables. If those
values are important, use :func:`itertools.zip_longest` instead.
:func:`zip` in conjunction with the ``*`` operator can be used to unzip a
list::
>>> x = [1, 2, 3]
>>> y = [4, 5, 6]
>>> zipped = zip(x, y)
>>> zipped
[(1, 4), (2, 5), (3, 6)]
>>> x2, y2 = zip(*zipped)
>>> x == x2, y == y2
True
.. rubric:: Footnotes
...
...
Doc/library/sqlite3.rst
View file @
0daf79bd
This diff is collapsed.
Click to expand it.
Doc/library/subprocess.rst
View file @
0daf79bd
...
...
@@ -334,8 +334,8 @@ Replacing /bin/sh shell backquote
output = Popen(["mycmd", "myarg"], stdout=PIPE).communicate()[0]
Replacing shell pipe
line
^^^^^^^^^^^^^^^^^^^^^^^^
^
Replacing shell pipeline
^^^^^^^^^^^^^^^^^^^^^^^^
::
...
...
Doc/reference/simple_stmts.rst
View file @
0daf79bd
...
...
@@ -775,9 +775,9 @@ can appear before a future statement are:
.. XXX change this if future is cleaned out
The features recognized by Python 3.0 are ``absolute_import``, ``division``,
``generators``, ``
nested_scopes`` and ``with_statement``. They are all
redundant because they are always enabled, and only kept for backwards
compatibility.
``generators``, ``
unicode_literals``, ``print_function``, ``nested_scopes`` and
``with_statement``. They are all redundant because they are always enabled, and
only kept for backwards
compatibility.
A future statement is recognized and treated specially at compile time: Changes
to the semantics of core constructs are often implemented by generating
...
...
Doc/tools/sphinxext/download.html
View file @
0daf79bd
...
...
@@ -31,8 +31,8 @@ in the table are the size of the download files in Kilobytes.</p>
<td><a
href=
"{{ dlbase }}/python-docs-html.tar.bz2"
>
Download
</a>
(ca. 4 MB)
</td>
</tr>
<tr><td>
Plain Text
</td>
<td><a
href=
"{{ dlbase }}/python-docs-
pdf-
text.zip"
>
Download
</a>
(ca. 2 MB)
</td>
<td><a
href=
"{{ dlbase }}/python-docs-
pdf-
text.tar.bz2"
>
Download
</a>
(ca. 1.5 MB)
</td>
<td><a
href=
"{{ dlbase }}/python-docs-text.zip"
>
Download
</a>
(ca. 2 MB)
</td>
<td><a
href=
"{{ dlbase }}/python-docs-text.tar.bz2"
>
Download
</a>
(ca. 1.5 MB)
</td>
</tr>
</table>
...
...
Doc/tools/sphinxext/indexcontent.html
View file @
0daf79bd
...
...
@@ -4,7 +4,7 @@
<table
class=
"contentstable"
align=
"center"
><tr>
<td
width=
"50%"
>
<p
class=
"biglink"
><a
class=
"biglink"
href=
"{{ pathto("
whatsnew
/"
+
version
)
}}"
>
What's new in Python {{ version }}?
</a><br/>
<span
class=
"linkdescr"
>
changes since previous major release
</span></p>
<span
class=
"linkdescr"
>
or
<a
href=
"{{ pathto("
whatsnew
/
index
")
}}"
>
all "What's new" documents
</a>
since 2.0
</span>
</span></p>
<p
class=
"biglink"
><a
class=
"biglink"
href=
"{{ pathto("
tutorial
/
index
")
}}"
>
Tutorial
</a><br/>
<span
class=
"linkdescr"
>
start here
</span></p>
<p
class=
"biglink"
><a
class=
"biglink"
href=
"{{ pathto("
using
/
index
")
}}"
>
Using Python
</a><br/>
...
...
Doc/tools/sphinxext/layout.html
View file @
0daf79bd
{% extends "!layout.html" %}
{% block rootrellink %}
<li><img
src=
"{{ pathto('_static/py.png', 1) }}"
alt=
""
style=
"vertical-align: middle; margin-top: -1px"
/></li>
{{ super() }}
<li><img
src=
"{{ pathto('_static/py.png', 1) }}"
alt=
""
style=
"vertical-align: middle; margin-top: -1px"
/></li><li><a
href=
"{{ pathto('index') }}"
>
{{ shorttitle }}
</a>
{{ reldelim1 }}
</li>
{% endblock %}
Doc/whatsnew/2.2.rst
View file @
0daf79bd
...
...
@@ -714,7 +714,7 @@ Python's division operator, ``/``, behaves like C's division operator when
presented with two integer arguments: it returns an integer result that's
truncated down when there would be a fractional part. For example, ``3/2`` is
1, not 1.5, and ``(-1)/2`` is -1, not -0.5. This means that the results of
divison can vary unexpectedly depending on the type of the two operands and
divis
i
on can vary unexpectedly depending on the type of the two operands and
because Python is dynamically typed, it can be difficult to determine the
possible types of the operands.
...
...
Doc/whatsnew/2.3.rst
View file @
0daf79bd
...
...
@@ -1196,7 +1196,7 @@ Optimizations
* The ``SET_LINENO`` opcode is now gone. This may provide a small speed
increase, depending on your compiler's idiosyncrasies. See section
:ref:`section-other` for a longer explanation. (Removed by Michael Hudson.)
:ref:`
23
section-other` for a longer explanation. (Removed by Michael Hudson.)
* :func:`xrange` objects now have their own iterator, making ``for i in
xrange(n)`` slightly faster than ``for i in range(n)``. (Patch by Raymond
...
...
@@ -1951,7 +1951,7 @@ Other new platforms now supported by Python include AtheOS
.. ======================================================================
.. _section-other:
.. _
23
section-other:
Other Changes and Fixes
=======================
...
...
@@ -2062,7 +2062,7 @@ code:
.. ======================================================================
.. _acks:
.. _
23
acks:
Acknowledgements
================
...
...
Doc/whatsnew/2.4.rst
View file @
0daf79bd
...
...
@@ -1551,7 +1551,7 @@ code:
.. ======================================================================
.. _acks:
.. _
24
acks:
Acknowledgements
================
...
...
Doc/whatsnew/2.5.rst
View file @
0daf79bd
...
...
@@ -16,9 +16,9 @@ release schedule.
The changes in Python 2.5 are an interesting mix of language and library
improvements. The library enhancements will be more important to Python's user
community, I think, because several widely-useful packages were added. New
modules include ElementTree for XML processing (
section :ref:`module-
etree`),
the SQLite database module (
section :ref:`module-
sqlite`), and the :mod:`ctypes`
module for calling C functions
(section :ref:`module-ctypes`)
.
modules include ElementTree for XML processing (
:mod:`xml.
etree`),
the SQLite database module (
:mod:`
sqlite`), and the :mod:`ctypes`
module for calling C functions.
The language changes are of middling significance. Some pleasant new features
were added, but most of them aren't features that you'll use every day.
...
...
@@ -736,7 +736,7 @@ add a :keyword:`return` statement at the marked location. ::
# return False
.. _
module-contextlib
:
.. _
contextlibmod
:
The contextlib module
---------------------
...
...
@@ -1109,7 +1109,7 @@ Here are all of the changes that Python 2.5 makes to the core Python language.
.. ======================================================================
.. _interactive:
.. _
25
interactive:
Interactive Interpreter Changes
-------------------------------
...
...
@@ -1211,7 +1211,7 @@ marked in the following list.
.. ======================================================================
.. _modules:
.. _
25
modules:
New, Improved, and Removed Modules
==================================
...
...
@@ -1273,7 +1273,7 @@ complete list of changes, or look through the SVN logs for all the details.
(Contributed by Raymond Hettinger.)
* New module: The :mod:`contextlib` module contains helper functions for use
with the new ':keyword:`with`' statement. See section :ref:`
module-contextlib
`
with the new ':keyword:`with`' statement. See section :ref:`
contextlibmod
`
for more about this module.
* New module: The :mod:`cProfile` module is a C implementation of the existing
...
...
@@ -2272,8 +2272,6 @@ code:
.. ======================================================================
.. _acks:
Acknowledgements
================
...
...
Doc/whatsnew/2.6.rst
View file @
0daf79bd
This diff is collapsed.
Click to expand it.
Doc/whatsnew/2.7.rst
0 → 100644
View file @
0daf79bd
****************************
What's New in Python 2.7
****************************
:Author: A.M. Kuchling (amk at amk.ca)
:Release: |release|
:Date: |today|
.. $Id$
Rules for maintenance:
* Anyone can add text to this document. Do not spend very much time
on the wording of your changes, because your text will probably
get rewritten to some degree.
* The maintainer will go through Misc/NEWS periodically and add
changes; it's therefore more important to add your changes to
Misc/NEWS than to this file.
* This is not a complete list of every single change; completeness
is the purpose of Misc/NEWS. Some changes I consider too small
or esoteric to include. If such a change is added to the text,
I'll just remove it. (This is another reason you shouldn't spend
too much time on writing your addition.)
* If you want to draw your new text to the attention of the
maintainer, add 'XXX' to the beginning of the paragraph or
section.
* It's OK to just add a fragmentary note about a change. For
example: "XXX Describe the transmogrify() function added to the
socket module." The maintainer will research the change and
write the necessary text.
* You can comment out your additions if you like, but it's not
necessary (especially when a final release is some months away).
* Credit the author of a patch or bugfix. Just the name is
sufficient; the e-mail address isn't necessary.
* It's helpful to add the bug/patch number in a parenthetical comment.
XXX Describe the transmogrify() function added to the socket
module.
(Contributed by P.Y. Developer; :issue:`12345`.)
This saves the maintainer some effort going through the SVN logs
when researching a change.
This article explains the new features in Python 2.7.
No release schedule has been decided yet for 2.7.
.. Compare with previous release in 2 - 3 sentences here.
add hyperlink when the documentation becomes available online.
.. ========================================================================
.. Large, PEP-level features and changes should be described here.
.. Should there be a new section here for 3k migration?
.. Or perhaps a more general section describing module changes/deprecation?
.. ========================================================================
Other Language Changes
======================
Some smaller changes made to the core Python language are:
* List of changes to be written here.
.. ======================================================================
Optimizations
-------------
To be written.
.. ======================================================================
New, Improved, and Deprecated Modules
=====================================
As in every release, Python's standard library received a number of
enhancements and bug fixes. Here's a partial list of the most notable
changes, sorted alphabetically by module name. Consult the
:file:`Misc/NEWS` file in the source tree for a more complete list of
changes, or look through the Subversion logs for all the details.
* To be written.
.. ======================================================================
.. whole new modules get described in subsections here
.. ======================================================================
Build and C API Changes
=======================
Changes to Python's build process and to the C API include:
* To be written.
.. ======================================================================
Port-Specific Changes: Windows
-----------------------------------
.. ======================================================================
Port-Specific Changes: Mac OS X
-----------------------------------
.. ======================================================================
Porting to Python 2.7
=====================
This section lists previously described changes and other bugfixes
that may require changes to your code:
To be written.
.. ======================================================================
.. _acks27:
Acknowledgements
================
The author would like to thank the following people for offering
suggestions, corrections and assistance with various drafts of this
article: no one yet.
Doc/whatsnew/3.0.rst
View file @
0daf79bd
...
...
@@ -440,7 +440,7 @@ Platform-specific changes go here.
.. ======================================================================
.. _section-other:
.. _
30
section-other:
Other Changes and Fixes
=======================
...
...
Doc/whatsnew/index.rst
0 → 100644
View file @
0daf79bd
.. _whatsnew-index:
######################
What's New in Python
######################
The "What's New in Python" series of essays takes tours through the most
important changes between major Python versions. They are a "must read" for
anyone wishing to stay up-to-date after a new release.
.. toctree::
:maxdepth: 1
3.0.rst
2.7.rst
2.6.rst
2.5.rst
2.4.rst
2.3.rst
2.2.rst
2.1.rst
2.0.rst
Lib/optparse.py
View file @
0daf79bd
"""
optparse - a
powerful, extensible, and easy-to-use option parser.
"""
A
powerful, extensible, and easy-to-use option parser.
By Greg Ward <gward@python.net>
Originally distributed as Optik; see http://optik.sourceforge.net/ .
If you have problems with this module, please do not file bugs,
patches, or feature requests with Python; instead, use Optik's
SourceForge project page:
http://sourceforge.net/projects/optik
Originally distributed as Optik.
For support, use the optik-users@lists.sourceforge.net mailing list
(http://lists.sourceforge.net/lists/listinfo/optik-users).
"""
# Python developers: please do not make changes to this file, since
# it is automatically generated from the Optik source code.
__version__
=
"1.5.3"
__all__
=
[
'Option'
,
...
...
@@ -1263,9 +1255,19 @@ class OptionParser (OptionContainer):
self
.
usage
=
usage
def
enable_interspersed_args
(
self
):
"""Set parsing to not stop on the first non-option, allowing
interspersing switches with command arguments. This is the
default behavior. See also disable_interspersed_args() and the
class documentation description of the attribute
allow_interspersed_args."""
self
.
allow_interspersed_args
=
True
def
disable_interspersed_args
(
self
):
"""Set parsing to stop on the first non-option. Use this if
you have a command processor which runs another command that
has options of its own and you want to make sure these options
don't get confused.
"""
self
.
allow_interspersed_args
=
False
def
set_process_default_values
(
self
,
process
):
...
...
Lib/test/test_atexit.py
View file @
0daf79bd
...
...
@@ -26,12 +26,13 @@ def raise2():
class
TestCase
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
stream
=
io
.
StringIO
()
self
.
save_stdout
,
self
.
save_stderr
=
sys
.
stderr
,
sys
.
stdout
sys
.
stdout
=
sys
.
stderr
=
self
.
stream
atexit
.
_clear
()
def
tearDown
(
self
):
sys
.
stdout
=
s
ys
.
__stdout__
sys
.
stderr
=
s
ys
.
__stderr__
sys
.
stdout
=
s
elf
.
save_stdout
sys
.
stderr
=
s
elf
.
save_stderr
atexit
.
_clear
()
def
test_args
(
self
):
...
...
Lib/test/test_bisect.py
View file @
0daf79bd
...
...
@@ -196,6 +196,17 @@ class TestInsort(unittest.TestCase):
def
test_backcompatibility
(
self
):
self
.
assertEqual
(
self
.
module
.
insort
,
self
.
module
.
insort_right
)
def
test_listDerived
(
self
):
class
List
(
list
):
data
=
[]
def
insert
(
self
,
index
,
item
):
self
.
data
.
insert
(
index
,
item
)
lst
=
List
()
self
.
module
.
insort_left
(
lst
,
10
)
self
.
module
.
insort_right
(
lst
,
5
)
self
.
assertEqual
([
5
,
10
],
lst
.
data
)
class
TestInsortPython
(
TestInsort
):
module
=
py_bisect
...
...
Lib/test/test_datetime.py
View file @
0daf79bd
...
...
@@ -249,7 +249,7 @@ class TestTimeDelta(HarmlessMixedComparison, unittest.TestCase):
self
.
assertRaises
(
TypeError
,
lambda
:
a
//
x
)
self
.
assertRaises
(
TypeError
,
lambda
:
x
//
a
)
# Divison of int by timedelta doesn't make sense.
# Divis
i
on of int by timedelta doesn't make sense.
# Division by zero doesn't make sense.
for
zero
in
0
,
0
:
self
.
assertRaises
(
TypeError
,
lambda
:
zero
//
a
)
...
...
Lib/test/test_dbm.py
View file @
0daf79bd
...
...
@@ -140,6 +140,23 @@ class WhichDBTestCase(unittest.TestCase):
def
setUp
(
self
):
delete_files
()
self
.
filename
=
test
.
support
.
TESTFN
self
.
d
=
dbm
.
open
(
self
.
filename
,
'c'
)
self
.
d
.
close
()
def
test_keys
(
self
):
self
.
d
=
dbm
.
open
(
self
.
filename
,
'c'
)
self
.
assertEqual
(
self
.
d
.
keys
(),
[])
a
=
[(
b'a'
,
b'b'
),
(
b'12345678910'
,
b'019237410982340912840198242'
)]
for
k
,
v
in
a
:
self
.
d
[
k
]
=
v
self
.
assertEqual
(
sorted
(
self
.
d
.
keys
()),
sorted
(
k
for
(
k
,
v
)
in
a
))
for
k
,
v
in
a
:
self
.
assert_
(
k
in
self
.
d
)
self
.
assertEqual
(
self
.
d
[
k
],
v
)
self
.
assert_
(
'xxx'
not
in
self
.
d
)
self
.
assertRaises
(
KeyError
,
lambda
:
self
.
d
[
'xxx'
])
self
.
d
.
close
()
def
test_main
():
...
...
Lib/test/test_docxmlrpc.py
View file @
0daf79bd
...
...
@@ -8,9 +8,9 @@ import unittest
PORT
=
None
def
server
(
evt
,
numrequests
):
try
:
serv
=
DocXMLRPCServer
((
"localhost"
,
0
),
logRequests
=
False
)
serv
=
DocXMLRPCServer
((
"localhost"
,
0
),
logRequests
=
False
)
try
:
global
PORT
PORT
=
serv
.
socket
.
getsockname
()[
1
]
...
...
Lib/test/test_set.py
View file @
0daf79bd
...
...
@@ -391,6 +391,17 @@ class TestSet(TestJointOps):
else
:
self
.
fail
()
def
test_remove_keyerror_set
(
self
):
key
=
self
.
thetype
([
3
,
4
])
try
:
self
.
s
.
remove
(
key
)
except
KeyError
as
e
:
self
.
assert_
(
e
.
args
[
0
]
is
key
,
"KeyError should be {0}, not {1}"
.
format
(
key
,
e
.
args
[
0
]))
else
:
self
.
fail
()
def
test_discard
(
self
):
self
.
s
.
discard
(
'a'
)
self
.
assert_
(
'a'
not
in
self
.
s
)
...
...
Mac/BuildScript/build-installer.py
View file @
0daf79bd
...
...
@@ -130,8 +130,8 @@ LIBRARY_RECIPES = [
),
dict
(
name
=
"SQLite 3.
3.5
"
,
url
=
"http://www.sqlite.org/sqlite-3.
3.5
.tar.gz"
,
name
=
"SQLite 3.
6.3
"
,
url
=
"http://www.sqlite.org/sqlite-3.
6.3
.tar.gz"
,
checksum
=
'93f742986e8bc2dfa34792e16df017a6feccf3a2'
,
configure_pre
=
[
'--enable-threadsafe'
,
...
...
@@ -171,8 +171,8 @@ LIBRARY_RECIPES = [
),
),
dict
(
name
=
"Sleepycat DB 4.
4
"
,
url
=
"http://download
s.sleepycat.com/db-4.4.20
.tar.gz"
,
name
=
"Sleepycat DB 4.
7.25
"
,
url
=
"http://download
.oracle.com/berkeley-db/db-4.7.25
.tar.gz"
,
#name="Sleepycat DB 4.3.29",
#url="http://downloads.sleepycat.com/db-4.3.29.tar.gz",
buildDir
=
"build_unix"
,
...
...
@@ -586,21 +586,23 @@ def buildPythonDocs():
version
=
getVersion
()
docdir
=
os
.
path
.
join
(
rootDir
,
'pydocs'
)
novername
=
'python-docs-html.tar.bz2'
name
=
'html-%s.tar.bz2'
%
(
getFullVersion
(),)
sourceArchive
=
os
.
path
.
join
(
DEPSRC
,
name
)
if
os
.
path
.
exists
(
sourceArchive
):
print
(
"Using local copy of %s"
%
(
name
,))
else
:
print
(
"Downloading %s"
%
(
name
,)
)
print
"Downloading %s"
%
(
novername
,
)
downloadURL
(
'http://www.python.org/ftp/python/doc/%s/%s'
%
(
getFullVersion
(),
name
),
sourceArchive
)
getFullVersion
(),
n
overn
ame
),
sourceArchive
)
print
(
"Archive for %s stored as %s"
%
(
name
,
sourceArchive
))
extractArchive
(
os
.
path
.
dirname
(
docdir
),
sourceArchive
)
os
.
rename
(
os
.
path
.
join
(
os
.
path
.
dirname
(
docdir
),
'
Python-Docs-%s'
%
(
getFullVersion
(),)
),
os
.
path
.
dirname
(
docdir
),
'
python-docs-html'
),
docdir
)
...
...
@@ -1029,11 +1031,11 @@ def main():
buildPython
()
buildPythonDocs
()
fn
=
os
.
path
.
join
(
WORKDIR
,
"_root"
,
"Applications"
,
"
Mac
Python %s"
%
(
getVersion
(),),
"Update Shell Profile.command"
)
"Python %s"
%
(
getVersion
(),),
"Update Shell Profile.command"
)
patchFile
(
"scripts/postflight.patch-profile"
,
fn
)
os
.
chmod
(
fn
,
0755
)
folder
=
os
.
path
.
join
(
WORKDIR
,
"_root"
,
"Applications"
,
"
Mac
Python %s"
%
(
folder
=
os
.
path
.
join
(
WORKDIR
,
"_root"
,
"Applications"
,
"Python %s"
%
(
getVersion
(),))
os
.
chmod
(
folder
,
0755
)
setIcon
(
folder
,
"../Icons/Python Folder.icns"
)
...
...
Makefile.pre.in
View file @
0daf79bd
...
...
@@ -176,8 +176,8 @@ PYTHON= python$(EXE)
BUILDPYTHON
=
python
$(BUILDEXE)
# The task to run while instrument when building the profile-opt target
PROFILE_TASK
=
Tools/pybench/pybench.py
-n
2
--with-gc
--with-syscheck
#PROFILE_TASK= Lib/test/regrtest.py
PROFILE_TASK
=
$(srcdir)
/
Tools/pybench/pybench.py
-n
2
--with-gc
--with-syscheck
#PROFILE_TASK=
$(srcdir)/
Lib/test/regrtest.py
# === Definitions added by makesetup ===
...
...
Modules/_bisectmodule.c
View file @
0daf79bd
...
...
@@ -82,7 +82,7 @@ insort_right(PyObject *self, PyObject *args, PyObject *kw)
index
=
internal_bisect_right
(
list
,
item
,
lo
,
hi
);
if
(
index
<
0
)
return
NULL
;
if
(
PyList_Check
(
list
))
{
if
(
PyList_Check
Exact
(
list
))
{
if
(
PyList_Insert
(
list
,
index
,
item
)
<
0
)
return
NULL
;
}
else
{
...
...
@@ -183,7 +183,7 @@ insort_left(PyObject *self, PyObject *args, PyObject *kw)
index
=
internal_bisect_left
(
list
,
item
,
lo
,
hi
);
if
(
index
<
0
)
return
NULL
;
if
(
PyList_Check
(
list
))
{
if
(
PyList_Check
Exact
(
list
))
{
if
(
PyList_Insert
(
list
,
index
,
item
)
<
0
)
return
NULL
;
}
else
{
...
...
Modules/_codecsmodule.c
View file @
0daf79bd
...
...
@@ -108,7 +108,7 @@ Decodes obj using the codec registered for encoding. encoding defaults\n\
to the default encoding. errors may be given to set a different error
\n
\
handling scheme. Default is 'strict' meaning that encoding errors raise
\n
\
a ValueError. Other possible values are 'ignore' and 'replace'
\n
\
as well as any other name registerd with codecs.register_error that is
\n
\
as well as any other name register
e
d with codecs.register_error that is
\n
\
able to handle ValueErrors."
);
static
PyObject
*
...
...
Modules/cjkcodecs/multibytecodec.c
View file @
0daf79bd
...
...
@@ -36,7 +36,7 @@ PyDoc_STRVAR(MultibyteCodec_Decode__doc__,
Decodes `string' using I, an MultibyteCodec instance. errors may be given
\n
\
to set a different error handling scheme. Default is 'strict' meaning
\n
\
that encoding errors raise a UnicodeDecodeError. Other possible values
\n
\
are 'ignore' and 'replace' as well as any other name registerd with
\n
\
are 'ignore' and 'replace' as well as any other name register
e
d with
\n
\
codecs.register_error that is able to handle UnicodeDecodeErrors."
);
static
char
*
codeckwarglist
[]
=
{
"input"
,
"errors"
,
NULL
};
...
...
Modules/posixmodule.c
View file @
0daf79bd
...
...
@@ -751,11 +751,16 @@ win32_wchdir(LPCWSTR path)
if
(
!
result
)
return
FALSE
;
if
(
result
>
MAX_PATH
+
1
)
{
new_path
=
malloc
(
result
);
new_path
=
malloc
(
result
*
sizeof
(
wchar_t
)
);
if
(
!
new_path
)
{
SetLastError
(
ERROR_OUTOFMEMORY
);
return
FALSE
;
}
result
=
GetCurrentDirectoryW
(
result
,
new_path
);
if
(
!
result
)
{
free
(
new_path
);
return
FALSE
;
}
}
if
(
wcsncmp
(
new_path
,
L"
\\\\
"
,
2
)
==
0
||
wcsncmp
(
new_path
,
L"//"
,
2
)
==
0
)
...
...
Objects/dictobject.c
View file @
0daf79bd
...
...
@@ -1870,16 +1870,18 @@ PyDoc_STRVAR(setdefault_doc__,
"D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D"
);
PyDoc_STRVAR
(
pop__doc__
,
"D.pop(k[,d]) -> v, remove specified key and return the corresponding value
\n
\
"D.pop(k[,d]) -> v, remove specified key and return the corresponding value
.
\n
\
If key is not found, d is returned if given, otherwise KeyError is raised"
);
PyDoc_STRVAR
(
popitem__doc__
,
"D.popitem() -> (k, v), remove and return some (key, value) pair as a
\n
\
2-tuple; but raise KeyError if D is empty"
);
2-tuple; but raise KeyError if D is empty
.
"
);
PyDoc_STRVAR
(
update__doc__
,
"D.update(E, **F) -> None. Update D from E and F: for k in E: D[k] = E[k]\
\n
(if E has keys else: for (k, v) in E: D[k] = v) then: for k in F: D[k] = F[k]"
);
"D.update(E, **F) -> None. Update D from dict/iterable E and F.
\n
"
"If E has a .keys() method, does: for k in E: D[k] = E[k]
\n
\
If E lacks .keys() method, does: for (k, v) in E: D[k] = v
\n
\
In either case, this is followed by: for k in F: D[k] = F[k]"
);
PyDoc_STRVAR
(
fromkeys__doc__
,
"dict.fromkeys(S[,v]) -> New dict with keys from S and values equal to v.
\n
\
...
...
Objects/floatobject.c
View file @
0daf79bd
...
...
@@ -1457,7 +1457,7 @@ float_as_integer_ratio(PyObject *v, PyObject *unused)
#ifdef Py_NAN
if
(
Py_IS_NAN
(
self
))
{
PyErr_SetString
(
PyExc_ValueError
,
"Cannot pass
nan
to float.as_integer_ratio."
);
"Cannot pass
NaN
to float.as_integer_ratio."
);
return
NULL
;
}
#endif
...
...
@@ -1516,7 +1516,7 @@ PyDoc_STRVAR(float_as_integer_ratio_doc,
"
\n
"
"Returns a pair of integers, whose ratio is exactly equal to the original
\n
"
"float and with a positive denominator.
\n
"
"Raises OverflowError on infinities and a ValueError on
nan
s.
\n
"
"Raises OverflowError on infinities and a ValueError on
NaN
s.
\n
"
"
\n
"
">>> (10.0).as_integer_ratio()
\n
"
"(10, 1)
\n
"
...
...
Objects/listobject.c
View file @
0daf79bd
...
...
@@ -2286,11 +2286,14 @@ PyDoc_STRVAR(extend_doc,
PyDoc_STRVAR
(
insert_doc
,
"L.insert(index, object) -- insert object before index"
);
PyDoc_STRVAR
(
pop_doc
,
"L.pop([index]) -> item -- remove and return item at index (default last)"
);
"L.pop([index]) -> item -- remove and return item at index (default last).
\n
"
"Raises IndexError if list is empty or index is out of range."
);
PyDoc_STRVAR
(
remove_doc
,
"L.remove(value) -- remove first occurrence of value"
);
"L.remove(value) -- remove first occurrence of value.
\n
"
"Raises ValueError if the value is not present."
);
PyDoc_STRVAR
(
index_doc
,
"L.index(value, [start, [stop]]) -> integer -- return first index of value"
);
"L.index(value, [start, [stop]]) -> integer -- return first index of value.
\n
"
"Raises ValueError if the value is not present."
);
PyDoc_STRVAR
(
count_doc
,
"L.count(value) -> integer -- return number of occurrences of value"
);
PyDoc_STRVAR
(
reverse_doc
,
...
...
Objects/setobject.c
View file @
0daf79bd
...
...
@@ -746,7 +746,8 @@ set_pop(PySetObject *so)
return
key
;
}
PyDoc_STRVAR
(
pop_doc
,
"Remove and return an arbitrary set element."
);
PyDoc_STRVAR
(
pop_doc
,
"Remove and return an arbitrary set element.
\n
\
Raises KeyError if the set is empty."
);
static
int
set_traverse
(
PySetObject
*
so
,
visitproc
visit
,
void
*
arg
)
...
...
@@ -1861,7 +1862,7 @@ PyDoc_STRVAR(contains_doc, "x.__contains__(y) <==> y in x.");
static
PyObject
*
set_remove
(
PySetObject
*
so
,
PyObject
*
key
)
{
PyObject
*
tmpkey
,
*
result
;
PyObject
*
tmpkey
;
int
rv
;
rv
=
set_discard_key
(
so
,
key
);
...
...
@@ -1873,11 +1874,14 @@ set_remove(PySetObject *so, PyObject *key)
if
(
tmpkey
==
NULL
)
return
NULL
;
set_swap_bodies
((
PySetObject
*
)
tmpkey
,
(
PySetObject
*
)
key
);
r
esult
=
set_remove
(
so
,
tmpkey
);
r
v
=
set_discard_key
(
so
,
tmpkey
);
set_swap_bodies
((
PySetObject
*
)
tmpkey
,
(
PySetObject
*
)
key
);
Py_DECREF
(
tmpkey
);
return
result
;
}
else
if
(
rv
==
DISCARD_NOTFOUND
)
{
if
(
rv
==
-
1
)
return
NULL
;
}
if
(
rv
==
DISCARD_NOTFOUND
)
{
set_key_error
(
key
);
return
NULL
;
}
...
...
Objects/tupleobject.c
View file @
0daf79bd
...
...
@@ -694,7 +694,9 @@ tuple_sizeof(PyTupleObject *self)
}
PyDoc_STRVAR
(
index_doc
,
"T.index(value, [start, [stop]]) -> integer -- return first index of value"
);
"T.index(value, [start, [stop]]) -> integer -- return first index of value.
\n
"
"Raises ValueError if the value is not present."
);
PyDoc_STRVAR
(
count_doc
,
"T.count(value) -> integer -- return number of occurrences of value"
);
PyDoc_STRVAR
(
sizeof_doc
,
...
...
Objects/unicodeobject.c
View file @
0daf79bd
...
...
@@ -7300,7 +7300,7 @@ unicode_length(PyUnicodeObject *self)
PyDoc_STRVAR
(
ljust__doc__
,
"S.ljust(width[, fillchar]) -> str
\n
\
\n
\
Return S left
justified in a Unicode string of length width. Padding is
\n
\
Return S left
-
justified in a Unicode string of length width. Padding is
\n
\
done using the specified fill character (default is a space)."
);
static
PyObject
*
...
...
@@ -7815,7 +7815,7 @@ unicode_rindex(PyUnicodeObject *self, PyObject *args)
PyDoc_STRVAR
(
rjust__doc__
,
"S.rjust(width[, fillchar]) -> str
\n
\
\n
\
Return S right
justified in a string of length width. Padding is
\n
\
Return S right
-
justified in a string of length width. Padding is
\n
\
done using the specified fill character (default is a space)."
);
static
PyObject
*
...
...
@@ -7945,7 +7945,7 @@ PyDoc_STRVAR(partition__doc__,
\n
\
Search for the separator sep in S, and return the part before it,
\n
\
the separator itself, and the part after it. If the separator is not
\n
\
found, return
s
S and two empty strings."
);
found, return S and two empty strings."
);
static
PyObject
*
unicode_partition
(
PyUnicodeObject
*
self
,
PyObject
*
separator
)
...
...
@@ -7958,7 +7958,7 @@ PyDoc_STRVAR(rpartition__doc__,
\n
\
Search for the separator sep in S, starting at the end of S, and return
\n
\
the part before it, the separator itself, and the part after it. If the
\n
\
separator is not found, return
s
two empty strings and S."
);
separator is not found, return two empty strings and S."
);
static
PyObject
*
unicode_rpartition
(
PyUnicodeObject
*
self
,
PyObject
*
separator
)
...
...
setup.py
View file @
0daf79bd
...
...
@@ -730,7 +730,8 @@ class PyBuildExt(build_ext):
]
sqlite_libfile = self.compiler.find_library_file(
sqlite_dirs_to_check + lib_dirs, 'sqlite3')
sqlite_libdir = [os.path.abspath(os.path.dirname(sqlite_libfile))]
if sqlite_libfile:
sqlite_libdir = [os.path.abspath(os.path.dirname(sqlite_libfile))]
if sqlite_incdir and sqlite_libdir:
sqlite_srcs = ['_sqlite/cache.c',
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment