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
fe625581
Commit
fe625581
authored
Aug 08, 2011
by
Éric Araujo
Browse files
Options
Browse Files
Download
Plain Diff
Branch merge
parents
ad6e3113
4066eca6
Changes
13
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
127 additions
and
159 deletions
+127
-159
Doc/c-api/init.rst
Doc/c-api/init.rst
+8
-0
Doc/library/multiprocessing.rst
Doc/library/multiprocessing.rst
+1
-1
Doc/library/string.rst
Doc/library/string.rst
+3
-3
Doc/library/timeit.rst
Doc/library/timeit.rst
+6
-6
Doc/library/turtle.rst
Doc/library/turtle.rst
+2
-2
Doc/whatsnew/2.7.rst
Doc/whatsnew/2.7.rst
+2
-2
Include/pystate.h
Include/pystate.h
+1
-1
Lib/copy.py
Lib/copy.py
+0
-65
Lib/test/test_copy.py
Lib/test/test_copy.py
+95
-73
Lib/test/test_urllib.py
Lib/test/test_urllib.py
+3
-1
Lib/turtle.py
Lib/turtle.py
+2
-2
Lib/turtledemo/about_turtle.txt
Lib/turtledemo/about_turtle.txt
+2
-2
Lib/urllib/request.py
Lib/urllib/request.py
+2
-1
No files found.
Doc/c-api/init.rst
View file @
fe625581
...
...
@@ -646,6 +646,14 @@ with sub-interpreters:
:c:func:`PyGILState_Release` on the same thread.
.. c:function:: PyThreadState PyGILState_GetThisThreadState()
Get the current thread state for this thread. May return ``NULL`` if no
GILState API has been used on the current thread. Note that the main thread
always has such a thread-state, even if no auto-thread-state call has been
made on the main thread. This is mainly a helper/diagnostic function.
The following macros are normally used without a trailing semicolon; look for
example usage in the Python source distribution.
...
...
Doc/library/multiprocessing.rst
View file @
fe625581
...
...
@@ -1628,7 +1628,7 @@ with the :class:`Pool` class.
the
process
pool
as
separate
tasks
.
The
(
approximate
)
size
of
these
chunks
can
be
specified
by
setting
*
chunksize
*
to
a
positive
integer
.
..
method
::
map_async
(
func
,
iterable
[,
chunksize
[,
callback
]])
..
method
::
map_async
(
func
,
iterable
[,
chunksize
[,
callback
[,
error_callback
]
]])
A
variant
of
the
:
meth
:`.
map
`
method
which
returns
a
result
object
.
...
...
Doc/library/string.rst
View file @
fe625581
...
...
@@ -709,9 +709,9 @@ placeholder syntax, delimiter character, or the entire regular expression used
to parse template strings. To do this, you can override these class attributes:
* *delimiter* -- This is the literal string describing a placeholder introducing
delimiter. The default value
``$``. Note that this should *not* be a regular
expression, as the implementation will call :meth:`re.escape` on this string a
s
needed.
delimiter. The default value
is ``$``. Note that this should *not* be a
regular expression, as the implementation will call :meth:`re.escape` on thi
s
string as
needed.
* *idpattern* -- This is the regular expression describing the pattern for
non-braced placeholders (the braces will be added automatically as
...
...
Doc/library/timeit.rst
View file @
fe625581
...
...
@@ -191,13 +191,13 @@ interface) that compare the cost of using :func:`hasattr` vs.
:keyword:`try`/:keyword:`except` to test for missing and present object
attributes. ::
% timeit.py
'try:' ' str.__bool__' 'except AttributeError:' ' pass'
$ python -m timeit
'try:' ' str.__bool__' 'except AttributeError:' ' pass'
100000 loops, best of 3: 15.7 usec per loop
% timeit.py
'if hasattr(str, "__bool__"): pass'
$ python -m timeit
'if hasattr(str, "__bool__"): pass'
100000 loops, best of 3: 4.26 usec per loop
% timeit.py
'try:' ' int.__bool__' 'except AttributeError:' ' pass'
$ python -m timeit
'try:' ' int.__bool__' 'except AttributeError:' ' pass'
1000000 loops, best of 3: 1.43 usec per loop
% timeit.py
'if hasattr(int, "__bool__"): pass'
$ python -m timeit
'if hasattr(int, "__bool__"): pass'
100000 loops, best of 3: 2.23 usec per loop
::
...
...
@@ -238,10 +238,10 @@ To give the :mod:`timeit` module access to functions you define, you can pass a
``setup`` parameter which contains an import statement::
def test():
"
Stupid test function
"
"
""Stupid test function""
"
L = [i for i in range(100)]
if __name__
==
'__main__':
if __name__
==
'__main__':
from timeit import Timer
t = Timer("test()", "from __main__ import test")
print(t.timeit())
...
...
Doc/library/turtle.rst
View file @
fe625581
...
...
@@ -18,10 +18,10 @@ Turtle graphics is a popular way for introducing programming to kids. It was
part of the original Logo programming language developed by Wally Feurzig and
Seymour Papert in 1966.
Imagine a robotic turtle starting at (0, 0) in the x-y plane.
G
ive it the
Imagine a robotic turtle starting at (0, 0) in the x-y plane.
After an ``import turtle``, g
ive it the
command ``turtle.forward(15)``, and it moves (on-screen!) 15 pixels in the
direction it is facing, drawing a line as it moves. Give it the command
``turtle.
lef
t(25)``, and it rotates in-place 25 degrees clockwise.
``turtle.
righ
t(25)``, and it rotates in-place 25 degrees clockwise.
.. sidebar:: Turtle star
...
...
Doc/whatsnew/2.7.rst
View file @
fe625581
...
...
@@ -782,8 +782,8 @@ Some smaller changes made to the core Python language are:
(Contributed by Fredrik Johansson and Victor Stinner; :issue:`3439`.)
* The :keyword:`import` statement will no longer try a
relativ
e import
if a
n absolut
e import (e.g. ``from .os import sep``) fails. This
* The :keyword:`import` statement will no longer try a
n absolut
e import
if a
relativ
e import (e.g. ``from .os import sep``) fails. This
fixes a bug, but could possibly break certain :keyword:`import`
statements that were only working by accident. (Fixed by Meador Inge;
:issue:`7902`.)
...
...
Include/pystate.h
View file @
fe625581
...
...
@@ -197,7 +197,7 @@ PyAPI_FUNC(void) PyGILState_Release(PyGILState_STATE);
/* Helper/diagnostic function - get the current thread state for
this thread. May return NULL if no GILState API has been used
on the current thread. Note the main thread always has such a
on the current thread. Note th
at th
e main thread always has such a
thread-state, even if no auto-thread-state call has been made
on the main thread.
*/
...
...
Lib/copy.py
View file @
fe625581
...
...
@@ -323,68 +323,3 @@ del types
# Helper for instance creation without calling __init__
class
_EmptyClass
:
pass
def
_test
():
l
=
[
None
,
1
,
2
,
3.14
,
'xyzzy'
,
(
1
,
2
),
[
3.14
,
'abc'
],
{
'abc'
:
'ABC'
},
(),
[],
{}]
l1
=
copy
(
l
)
print
(
l1
==
l
)
l1
=
map
(
copy
,
l
)
print
(
l1
==
l
)
l1
=
deepcopy
(
l
)
print
(
l1
==
l
)
class
C
:
def
__init__
(
self
,
arg
=
None
):
self
.
a
=
1
self
.
arg
=
arg
if
__name__
==
'__main__'
:
import
sys
file
=
sys
.
argv
[
0
]
else
:
file
=
__file__
self
.
fp
=
open
(
file
)
self
.
fp
.
close
()
def
__getstate__
(
self
):
return
{
'a'
:
self
.
a
,
'arg'
:
self
.
arg
}
def
__setstate__
(
self
,
state
):
for
key
,
value
in
state
.
items
():
setattr
(
self
,
key
,
value
)
def
__deepcopy__
(
self
,
memo
=
None
):
new
=
self
.
__class__
(
deepcopy
(
self
.
arg
,
memo
))
new
.
a
=
self
.
a
return
new
c
=
C
(
'argument sketch'
)
l
.
append
(
c
)
l2
=
copy
(
l
)
print
(
l
==
l2
)
print
(
l
)
print
(
l2
)
l2
=
deepcopy
(
l
)
print
(
l
==
l2
)
print
(
l
)
print
(
l2
)
l
.
append
({
l
[
1
]:
l
,
'xyz'
:
l
[
2
]})
l3
=
copy
(
l
)
import
reprlib
print
(
map
(
reprlib
.
repr
,
l
))
print
(
map
(
reprlib
.
repr
,
l1
))
print
(
map
(
reprlib
.
repr
,
l2
))
print
(
map
(
reprlib
.
repr
,
l3
))
l3
=
deepcopy
(
l
)
print
(
map
(
reprlib
.
repr
,
l
))
print
(
map
(
reprlib
.
repr
,
l1
))
print
(
map
(
reprlib
.
repr
,
l2
))
print
(
map
(
reprlib
.
repr
,
l3
))
class
odict
(
dict
):
def
__init__
(
self
,
d
=
{}):
self
.
a
=
99
dict
.
__init__
(
self
,
d
)
def
__setitem__
(
self
,
k
,
i
):
dict
.
__setitem__
(
self
,
k
,
i
)
self
.
a
o
=
odict
({
"A"
:
"B"
})
x
=
deepcopy
(
o
)
print
(
o
,
x
)
if
__name__
==
'__main__'
:
_test
()
Lib/test/test_copy.py
View file @
fe625581
This diff is collapsed.
Click to expand it.
Lib/test/test_urllib.py
View file @
fe625581
...
...
@@ -135,7 +135,9 @@ class ProxyTests(unittest.TestCase):
proxies
=
urllib
.
request
.
getproxies_environment
()
# getproxies_environment use lowered case truncated (no '_proxy') keys
self
.
assertEqual
(
'localhost'
,
proxies
[
'no'
])
# List of no_proxies with space.
self
.
env
.
set
(
'NO_PROXY'
,
'localhost, anotherdomain.com, newdomain.com'
)
self
.
assertTrue
(
urllib
.
request
.
proxy_bypass_environment
(
'anotherdomain.com'
))
class
urlopen_HttpTests
(
unittest
.
TestCase
):
"""Test urlopen() opening a fake http connection."""
...
...
Lib/turtle.py
View file @
fe625581
...
...
@@ -27,10 +27,10 @@ Turtle graphics is a popular way for introducing programming to
kids. It was part of the original Logo programming language developed
by Wally Feurzig and Seymour Papert in 1966.
Imagine a robotic turtle starting at (0, 0) in the x-y plane.
G
ive it
Imagine a robotic turtle starting at (0, 0) in the x-y plane.
After an ``import turtle``, g
ive it
the command turtle.forward(15), and it moves (on-screen!) 15 pixels in
the direction it is facing, drawing a line as it moves. Give it the
command turtle.
lef
t(25), and it rotates in-place 25 degrees clockwise.
command turtle.
righ
t(25), and it rotates in-place 25 degrees clockwise.
By combining together these and similar commands, intricate shapes and
pictures can easily be drawn.
...
...
Lib/turtledemo/about_turtle.txt
View file @
fe625581
...
...
@@ -7,10 +7,10 @@ Turtle graphics is a popular way for introducing programming to
kids. It was part of the original Logo programming language developed
by Wally Feurzig and Seymour Papert in 1966.
Imagine a robotic turtle starting at (0, 0) in the x-y plane.
G
ive it
Imagine a robotic turtle starting at (0, 0) in the x-y plane.
After an ``import turtle``, g
ive it
the command turtle.forward(15), and it moves (on-screen!) 15 pixels in
the direction it is facing, drawing a line as it moves. Give it the
command turtle.
lef
t(25), and it rotates in-place 25 degrees clockwise.
command turtle.
righ
t(25), and it rotates in-place 25 degrees clockwise.
By combining together these and similar commands, intricate shapes and
pictures can easily be drawn.
...
...
Lib/urllib/request.py
View file @
fe625581
...
...
@@ -2274,7 +2274,8 @@ def proxy_bypass_environment(host):
# strip port off host
hostonly
,
port
=
splitport
(
host
)
# check if the host ends with any of the DNS suffixes
for
name
in
no_proxy
.
split
(
','
):
no_proxy_list
=
[
proxy
.
strip
()
for
proxy
in
no_proxy
.
split
(
','
)]
for
name
in
no_proxy_list
:
if
name
and
(
hostonly
.
endswith
(
name
)
or
host
.
endswith
(
name
)):
return
1
# otherwise, don't bypass
...
...
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