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
7fa5a99b
Commit
7fa5a99b
authored
Jan 24, 2012
by
Benjamin Peterson
Browse files
Options
Browse Files
Download
Plain Diff
merge heads
parents
91eef984
5311c1d7
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
16 additions
and
21 deletions
+16
-21
Doc/library/functools.rst
Doc/library/functools.rst
+1
-1
Doc/library/os.rst
Doc/library/os.rst
+3
-6
Doc/library/stdtypes.rst
Doc/library/stdtypes.rst
+1
-1
Lib/test/test_os.py
Lib/test/test_os.py
+7
-2
Misc/NEWS
Misc/NEWS
+4
-0
Modules/posixmodule.c
Modules/posixmodule.c
+0
-11
No files found.
Doc/library/functools.rst
View file @
7fa5a99b
...
@@ -20,7 +20,7 @@ The :mod:`functools` module defines the following functions:
...
@@ -20,7 +20,7 @@ The :mod:`functools` module defines the following functions:
.. function:: cmp_to_key(func)
.. function:: cmp_to_key(func)
Transform an old-style comparison function to a key
-
function. Used with
Transform an old-style comparison function to a key
function. Used with
tools that accept key functions (such as :func:`sorted`, :func:`min`,
tools that accept key functions (such as :func:`sorted`, :func:`min`,
:func:`max`, :func:`heapq.nlargest`, :func:`heapq.nsmallest`,
:func:`max`, :func:`heapq.nlargest`, :func:`heapq.nsmallest`,
:func:`itertools.groupby`). This function is primarily used as a transition
:func:`itertools.groupby`). This function is primarily used as a transition
...
...
Doc/library/os.rst
View file @
7fa5a99b
...
@@ -1429,11 +1429,9 @@ Files and Directories
...
@@ -1429,11 +1429,9 @@ Files and Directories
*target_is_directory*, which defaults to ``False``.
*target_is_directory*, which defaults to ``False``.
On Windows, a symlink represents a file or a directory, and does not morph to
On Windows, a symlink represents a file or a directory, and does not morph to
the target dynamically. For this reason, when creating a symlink on Windows,
the target dynamically. If *target_is_directory* is set to ``True``, the
if the target is not already present, the symlink will default to being a
symlink will be created as a directory symlink, otherwise as a file symlink
file symlink. If *target_is_directory* is set to ``True``, the symlink will
(the default).
be created as a directory symlink. This parameter is ignored if the target
exists (and the symlink is created with the same type as the target).
Symbolic link support was introduced in Windows 6.0 (Vista). :func:`symlink`
Symbolic link support was introduced in Windows 6.0 (Vista). :func:`symlink`
will raise a :exc:`NotImplementedError` on Windows versions earlier than 6.0.
will raise a :exc:`NotImplementedError` on Windows versions earlier than 6.0.
...
@@ -1446,7 +1444,6 @@ Files and Directories
...
@@ -1446,7 +1444,6 @@ Files and Directories
administrator level. Either obtaining the privilege or running your
administrator level. Either obtaining the privilege or running your
application as an administrator are ways to successfully create symlinks.
application as an administrator are ways to successfully create symlinks.
:exc:`OSError` is raised when the function is called by an unprivileged
:exc:`OSError` is raised when the function is called by an unprivileged
user.
user.
...
...
Doc/library/stdtypes.rst
View file @
7fa5a99b
...
@@ -873,7 +873,7 @@ are sequences of the same type; *n*, *i*, *j* and *k* are integers.
...
@@ -873,7 +873,7 @@ are sequences of the same type; *n*, *i*, *j* and *k* are integers.
| ``s * n, n * s`` | *n* shallow copies of *s* | \(2) |
| ``s * n, n * s`` | *n* shallow copies of *s* | \(2) |
| | concatenated | |
| | concatenated | |
+------------------+--------------------------------+----------+
+------------------+--------------------------------+----------+
| ``s[i]`` | *i*
'th item of *s*, origin 0
| \(3) |
| ``s[i]`` | *i*
\ th item of *s*, origin 0
| \(3) |
+------------------+--------------------------------+----------+
+------------------+--------------------------------+----------+
| ``s[i:j]`` | slice of *s* from *i* to *j* | (3)(4) |
| ``s[i:j]`` | slice of *s* from *i* to *j* | (3)(4) |
+------------------+--------------------------------+----------+
+------------------+--------------------------------+----------+
...
...
Lib/test/test_os.py
View file @
7fa5a99b
...
@@ -476,7 +476,12 @@ class WalkTests(unittest.TestCase):
...
@@ -476,7 +476,12 @@ class WalkTests(unittest.TestCase):
f
.
write
(
"I'm "
+
path
+
" and proud of it. Blame test_os.
\
n
"
)
f
.
write
(
"I'm "
+
path
+
" and proud of it. Blame test_os.
\
n
"
)
f
.
close
()
f
.
close
()
if
support
.
can_symlink
():
if
support
.
can_symlink
():
os
.
symlink
(
os
.
path
.
abspath
(
t2_path
),
link_path
)
if
os
.
name
==
'nt'
:
def
symlink_to_dir
(
src
,
dest
):
os
.
symlink
(
src
,
dest
,
True
)
else
:
symlink_to_dir
=
os
.
symlink
symlink_to_dir
(
os
.
path
.
abspath
(
t2_path
),
link_path
)
sub2_tree
=
(
sub2_path
,
[
"link"
],
[
"tmp3"
])
sub2_tree
=
(
sub2_path
,
[
"link"
],
[
"tmp3"
])
else
:
else
:
sub2_tree
=
(
sub2_path
,
[],
[
"tmp3"
])
sub2_tree
=
(
sub2_path
,
[],
[
"tmp3"
])
...
@@ -1106,7 +1111,7 @@ class Win32SymlinkTests(unittest.TestCase):
...
@@ -1106,7 +1111,7 @@ class Win32SymlinkTests(unittest.TestCase):
os
.
remove
(
self
.
missing_link
)
os
.
remove
(
self
.
missing_link
)
def
test_directory_link
(
self
):
def
test_directory_link
(
self
):
os
.
symlink
(
self
.
dirlink_target
,
self
.
dirlink
)
os
.
symlink
(
self
.
dirlink_target
,
self
.
dirlink
,
True
)
self
.
assertTrue
(
os
.
path
.
exists
(
self
.
dirlink
))
self
.
assertTrue
(
os
.
path
.
exists
(
self
.
dirlink
))
self
.
assertTrue
(
os
.
path
.
isdir
(
self
.
dirlink
))
self
.
assertTrue
(
os
.
path
.
isdir
(
self
.
dirlink
))
self
.
assertTrue
(
os
.
path
.
islink
(
self
.
dirlink
))
self
.
assertTrue
(
os
.
path
.
islink
(
self
.
dirlink
))
...
...
Misc/NEWS
View file @
7fa5a99b
...
@@ -108,6 +108,10 @@ Core and Builtins
...
@@ -108,6 +108,10 @@ Core and Builtins
Library
Library
-------
-------
- Issue #13772: In os.symlink() under Windows, do not try to guess the link
target's type (file or directory). The detection was buggy and made the
call non-atomic (therefore prone to race conditions).
- Issue #6631: Disallow relative file paths in urllib urlopen methods.
- Issue #6631: Disallow relative file paths in urllib urlopen methods.
- Issue #13722: Avoid silencing ImportErrors when initializing the codecs
- Issue #13722: Avoid silencing ImportErrors when initializing the codecs
...
...
Modules/posixmodule.c
View file @
7fa5a99b
...
@@ -5330,7 +5330,6 @@ win_symlink(PyObject *self, PyObject *args, PyObject *kwargs)
...
@@ -5330,7 +5330,6 @@ win_symlink(PyObject *self, PyObject *args, PyObject *kwargs)
PyObject
*
src
,
*
dest
;
PyObject
*
src
,
*
dest
;
int
target_is_directory
=
0
;
int
target_is_directory
=
0
;
DWORD
res
;
DWORD
res
;
WIN32_FILE_ATTRIBUTE_DATA
src_info
;
if
(
!
check_CreateSymbolicLinkW
())
if
(
!
check_CreateSymbolicLinkW
())
{
{
...
@@ -5351,16 +5350,6 @@ win_symlink(PyObject *self, PyObject *args, PyObject *kwargs)
...
@@ -5351,16 +5350,6 @@ win_symlink(PyObject *self, PyObject *args, PyObject *kwargs)
return
NULL
;
return
NULL
;
}
}
/* if src is a directory, ensure target_is_directory==1 */
if
(
GetFileAttributesExW
(
PyUnicode_AsUnicode
(
src
),
GetFileExInfoStandard
,
&
src_info
))
{
target_is_directory
=
target_is_directory
||
(
src_info
.
dwFileAttributes
&
FILE_ATTRIBUTE_DIRECTORY
);
}
Py_BEGIN_ALLOW_THREADS
Py_BEGIN_ALLOW_THREADS
res
=
Py_CreateSymbolicLinkW
(
res
=
Py_CreateSymbolicLinkW
(
PyUnicode_AsUnicode
(
dest
),
PyUnicode_AsUnicode
(
dest
),
...
...
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