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
dc0f5cdc
Commit
dc0f5cdc
authored
Jun 17, 2011
by
Éric Araujo
Browse files
Options
Browse Files
Download
Plain Diff
Brange merge
parents
3dc89e87
ac6f1c36
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
58 additions
and
45 deletions
+58
-45
Doc/library/crypto.rst
Doc/library/crypto.rst
+1
-1
Doc/whatsnew/3.2.rst
Doc/whatsnew/3.2.rst
+1
-1
Lib/multiprocessing/process.py
Lib/multiprocessing/process.py
+8
-2
Lib/packaging/tests/support.py
Lib/packaging/tests/support.py
+5
-9
Lib/packaging/tests/test_command_build_ext.py
Lib/packaging/tests/test_command_build_ext.py
+16
-22
Lib/test/test_urllib2.py
Lib/test/test_urllib2.py
+3
-0
Lib/test/test_urllib2net.py
Lib/test/test_urllib2net.py
+8
-0
Lib/urllib/request.py
Lib/urllib/request.py
+2
-0
Makefile.pre.in
Makefile.pre.in
+1
-1
Misc/NEWS
Misc/NEWS
+4
-0
Modules/posixmodule.c
Modules/posixmodule.c
+9
-9
No files found.
Doc/library/crypto.rst
View file @
dc0f5cdc
...
...
@@ -25,5 +25,5 @@ Hardcore cypherpunks will probably find the cryptographic modules written by
A.M. Kuchling of further interest; the package contains modules for various
encryption algorithms, most notably AES. These modules are not distributed with
Python but available separately. See the URL
http://www.
amk.ca/python/code/crypto.html
for more information.
http://www.
pycrypto.org
for more information.
Doc/whatsnew/3.2.rst
View file @
dc0f5cdc
...
...
@@ -385,7 +385,7 @@ PEP 3333: Python Web Server Gateway Interface v1.0.1
=====================================================
This informational PEP clarifies how bytes/text issues are to be handled by the
W
GS
I protocol. The challenge is that string handling in Python 3 is most
W
SG
I protocol. The challenge is that string handling in Python 3 is most
conveniently handled with the :class:`str` type even though the HTTP protocol
is itself bytes oriented.
...
...
Lib/multiprocessing/process.py
View file @
dc0f5cdc
...
...
@@ -267,9 +267,15 @@ class Process(object):
sys
.
stdin
=
open
(
os
.
devnull
)
except
(
OSError
,
ValueError
):
pass
old_process
=
_current_process
_current_process
=
self
try
:
util
.
_finalizer_registry
.
clear
()
util
.
_run_after_forkers
()
finally
:
# delay finalization of the old process object until after
# _run_after_forkers() is executed
del
old_process
util
.
info
(
'child process calling self.run()'
)
try
:
self
.
run
()
...
...
Lib/packaging/tests/support.py
View file @
dc0f5cdc
...
...
@@ -37,7 +37,7 @@ import tempfile
from
packaging
import
logger
from
packaging.dist
import
Distribution
from
packaging.tests
import
unittest
from
test.support
import
requires_zlib
from
test.support
import
requires_zlib
,
unlink
__all__
=
[
'LoggingCatcher'
,
'TempdirManager'
,
'EnvironRestorer'
,
'DummyCommand'
,
'unittest'
,
'create_distribution'
,
...
...
@@ -121,21 +121,17 @@ class TempdirManager:
def
setUp
(
self
):
super
(
TempdirManager
,
self
).
setUp
()
self
.
_olddir
=
os
.
getcwd
()
self
.
_basetempdir
=
tempfile
.
mkdtemp
()
self
.
_files
=
[]
def
tearDown
(
self
):
shutil
.
rmtree
(
self
.
_basetempdir
,
os
.
name
in
(
'nt'
,
'cygwin'
))
for
handle
,
name
in
self
.
_files
:
handle
.
close
()
if
os
.
path
.
exists
(
name
):
try
:
os
.
remove
(
name
)
except
OSError
as
exc
:
if
exc
.
errno
!=
errno
.
ENOENT
:
raise
unlink
(
name
)
os
.
chdir
(
self
.
_olddir
)
shutil
.
rmtree
(
self
.
_basetempdir
)
super
(
TempdirManager
,
self
).
tearDown
()
def
mktempfile
(
self
):
...
...
Lib/packaging/tests/test_command_build_ext.py
View file @
dc0f5cdc
...
...
@@ -8,13 +8,10 @@ from packaging.dist import Distribution
from
packaging.errors
import
UnknownFileError
,
CompileError
from
packaging.command.build_ext
import
build_ext
from
packaging.compiler.extension
import
Extension
from
test.script_helper
import
assert_python_ok
from
packaging.tests
import
support
,
unittest
,
verbose
,
unload
# http://bugs.python.org/issue4373
# Don't load the xx module more than once.
ALREADY_TESTED
=
False
def
_get_source_filename
():
srcdir
=
sysconfig
.
get_config_var
(
'srcdir'
)
...
...
@@ -29,7 +26,6 @@ class BuildExtTestCase(support.TempdirManager,
# Note that we're making changes to sys.path
super
(
BuildExtTestCase
,
self
).
setUp
()
self
.
tmp_dir
=
self
.
mkdtemp
()
sys
.
path
.
append
(
self
.
tmp_dir
)
filename
=
_get_source_filename
()
if
os
.
path
.
exists
(
filename
):
shutil
.
copy
(
filename
,
self
.
tmp_dir
)
...
...
@@ -39,8 +35,6 @@ class BuildExtTestCase(support.TempdirManager,
def
tearDown
(
self
):
# Get everything back to normal
unload
(
'xx'
)
sys
.
path
.
remove
(
self
.
tmp_dir
)
if
sys
.
version
>
"2.6"
:
site
.
USER_BASE
=
self
.
old_user_base
build_ext
.
USER_BASE
=
self
.
old_user_base
...
...
@@ -67,7 +61,6 @@ class BuildExtTestCase(support.TempdirManager,
cmd
.
library_dirs
=
value
.
split
(
os
.
pathsep
)
def
test_build_ext
(
self
):
global
ALREADY_TESTED
xx_c
=
os
.
path
.
join
(
self
.
tmp_dir
,
'xxmodule.c'
)
if
not
os
.
path
.
exists
(
xx_c
):
# skipping if we cannot find it
...
...
@@ -95,23 +88,24 @@ class BuildExtTestCase(support.TempdirManager,
finally
:
sys
.
stdout
=
old_stdout
if
ALREADY_TESTED
:
return
else
:
ALREADY_TESTED
=
True
code
=
"""if 1:
import sys
sys.path.insert(0, %r)
import xx
for attr in ('error', 'foo', 'new', 'roj'):
self
.
assertTrue
(
hasattr
(
xx
,
attr
)
)
assert hasattr(xx, attr
)
self
.
assertEqual
(
xx
.
foo
(
2
,
5
),
7
)
self
.
assertEqual
(
xx
.
foo
(
13
,
15
),
28
)
self
.
assertEqual
(
xx
.
new
().
demo
(),
None
)
assert xx.foo(2, 5) == 7
assert xx.foo(13, 15) == 28
assert xx.new().demo() is None
doc = 'This is a template module just for instruction.'
self
.
assertEqual
(
xx
.
__doc__
,
doc
)
self
.
assertTrue
(
isinstance
(
xx
.
Null
(),
xx
.
Null
))
self
.
assertTrue
(
isinstance
(
xx
.
Str
(),
xx
.
Str
))
assert xx.__doc__ == doc
assert isinstance(xx.Null(), xx.Null)
assert isinstance(xx.Str(), xx.Str)"""
code
=
code
%
self
.
tmp_dir
assert_python_ok
(
'-c'
,
code
)
def
test_solaris_enable_shared
(
self
):
dist
=
Distribution
({
'name'
:
'xx'
})
...
...
Lib/test/test_urllib2.py
View file @
dc0f5cdc
...
...
@@ -318,6 +318,9 @@ class MockHTTPClass:
def
getresponse
(
self
):
return
MockHTTPResponse
(
MockFile
(),
{},
200
,
"OK"
)
def
close
(
self
):
pass
class
MockHandler
:
# useful for testing handler machinery
# see add_ordered_mock_handlers() docstring
...
...
Lib/test/test_urllib2net.py
View file @
dc0f5cdc
...
...
@@ -234,6 +234,7 @@ class TimeoutTest(unittest.TestCase):
url
=
"http://www.python.org"
with
support
.
transient_internet
(
url
,
timeout
=
None
):
u
=
_urlopen_with_retry
(
url
)
self
.
addCleanup
(
u
.
close
)
self
.
assertTrue
(
u
.
fp
.
raw
.
_sock
.
gettimeout
()
is
None
)
def
test_http_default_timeout
(
self
):
...
...
@@ -243,6 +244,7 @@ class TimeoutTest(unittest.TestCase):
socket
.
setdefaulttimeout
(
60
)
try
:
u
=
_urlopen_with_retry
(
url
)
self
.
addCleanup
(
u
.
close
)
finally
:
socket
.
setdefaulttimeout
(
None
)
self
.
assertEqual
(
u
.
fp
.
raw
.
_sock
.
gettimeout
(),
60
)
...
...
@@ -254,6 +256,7 @@ class TimeoutTest(unittest.TestCase):
socket
.
setdefaulttimeout
(
60
)
try
:
u
=
_urlopen_with_retry
(
url
,
timeout
=
None
)
self
.
addCleanup
(
u
.
close
)
finally
:
socket
.
setdefaulttimeout
(
None
)
self
.
assertTrue
(
u
.
fp
.
raw
.
_sock
.
gettimeout
()
is
None
)
...
...
@@ -262,6 +265,7 @@ class TimeoutTest(unittest.TestCase):
url
=
"http://www.python.org"
with
support
.
transient_internet
(
url
):
u
=
_urlopen_with_retry
(
url
,
timeout
=
120
)
self
.
addCleanup
(
u
.
close
)
self
.
assertEqual
(
u
.
fp
.
raw
.
_sock
.
gettimeout
(),
120
)
FTP_HOST
=
"ftp://ftp.mirror.nl/pub/gnu/"
...
...
@@ -270,6 +274,7 @@ class TimeoutTest(unittest.TestCase):
self
.
assertTrue
(
socket
.
getdefaulttimeout
()
is
None
)
with
support
.
transient_internet
(
self
.
FTP_HOST
,
timeout
=
None
):
u
=
_urlopen_with_retry
(
self
.
FTP_HOST
)
self
.
addCleanup
(
u
.
close
)
self
.
assertTrue
(
u
.
fp
.
fp
.
raw
.
_sock
.
gettimeout
()
is
None
)
def
test_ftp_default_timeout
(
self
):
...
...
@@ -278,6 +283,7 @@ class TimeoutTest(unittest.TestCase):
socket
.
setdefaulttimeout
(
60
)
try
:
u
=
_urlopen_with_retry
(
self
.
FTP_HOST
)
self
.
addCleanup
(
u
.
close
)
finally
:
socket
.
setdefaulttimeout
(
None
)
self
.
assertEqual
(
u
.
fp
.
fp
.
raw
.
_sock
.
gettimeout
(),
60
)
...
...
@@ -288,6 +294,7 @@ class TimeoutTest(unittest.TestCase):
socket
.
setdefaulttimeout
(
60
)
try
:
u
=
_urlopen_with_retry
(
self
.
FTP_HOST
,
timeout
=
None
)
self
.
addCleanup
(
u
.
close
)
finally
:
socket
.
setdefaulttimeout
(
None
)
self
.
assertTrue
(
u
.
fp
.
fp
.
raw
.
_sock
.
gettimeout
()
is
None
)
...
...
@@ -295,6 +302,7 @@ class TimeoutTest(unittest.TestCase):
def
test_ftp_timeout
(
self
):
with
support
.
transient_internet
(
self
.
FTP_HOST
):
u
=
_urlopen_with_retry
(
self
.
FTP_HOST
,
timeout
=
60
)
self
.
addCleanup
(
u
.
close
)
self
.
assertEqual
(
u
.
fp
.
fp
.
raw
.
_sock
.
gettimeout
(),
60
)
...
...
Lib/urllib/request.py
View file @
dc0f5cdc
...
...
@@ -1146,6 +1146,8 @@ class AbstractHTTPHandler(BaseHandler):
r
=
h
.
getresponse
()
# an HTTPResponse instance
except
socket
.
error
as
err
:
raise
URLError
(
err
)
finally
:
h
.
close
()
r
.
url
=
req
.
get_full_url
()
# This line replaces the .msg attribute of the HTTPResponse
...
...
Makefile.pre.in
View file @
dc0f5cdc
...
...
@@ -916,7 +916,7 @@ LIBSUBDIRS= tkinter tkinter/test tkinter/test/test_tkinter \
test
/subprocessdata
\
test
/tracedmodules
test
/encoded_modules
\
collections concurrent concurrent/futures encodings
\
email email/mime
email/test email/test
/data
\
email email/mime
test
/test_email
test
/test_email
/data
\
html json
test
/json_tests http dbm xmlrpc
\
sqlite3 sqlite3/test
\
logging csv wsgiref urllib
\
...
...
Misc/NEWS
View file @
dc0f5cdc
...
...
@@ -193,6 +193,10 @@ Core and Builtins
Library
-------
- Issue #12133: AbstractHTTPHandler.do_open() of urllib.request closes the HTTP
connection if its getresponse() method fails with a socket error. Patch
written by Ezio Melotti.
- Issue #12240: Allow multiple setup hooks in packaging'
s
setup
.
cfg
files
.
Original
patch
by
Erik
Bray
.
...
...
Modules/posixmodule.c
View file @
dc0f5cdc
...
...
@@ -2275,7 +2275,7 @@ posix_fchown(PyObject *self, PyObject *args)
int
fd
;
long
uid
,
gid
;
int
res
;
if
(
!
PyArg_ParseTuple
(
args
,
"ill:chown"
,
&
fd
,
&
uid
,
&
gid
))
if
(
!
PyArg_ParseTuple
(
args
,
"ill:
f
chown"
,
&
fd
,
&
uid
,
&
gid
))
return
NULL
;
Py_BEGIN_ALLOW_THREADS
res
=
fchown
(
fd
,
(
uid_t
)
uid
,
(
gid_t
)
gid
);
...
...
@@ -6076,7 +6076,7 @@ posix_open(PyObject *self, PyObject *args)
#ifdef MS_WINDOWS
PyUnicodeObject
*
po
;
if
(
PyArg_ParseTuple
(
args
,
"Ui|i:
mkdir
"
,
&
po
,
&
flag
,
&
mode
))
{
if
(
PyArg_ParseTuple
(
args
,
"Ui|i:
open
"
,
&
po
,
&
flag
,
&
mode
))
{
Py_BEGIN_ALLOW_THREADS
/* PyUnicode_AS_UNICODE OK without thread
lock as it is a simple dereference. */
...
...
@@ -6091,7 +6091,7 @@ posix_open(PyObject *self, PyObject *args)
PyErr_Clear
();
#endif
if
(
!
PyArg_ParseTuple
(
args
,
"O&i|i"
,
if
(
!
PyArg_ParseTuple
(
args
,
"O&i|i
:open
"
,
PyUnicode_FSConverter
,
&
ofile
,
&
flag
,
&
mode
))
return
NULL
;
...
...
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