mirror of
https://github.com/python/cpython.git
synced 2025-08-03 00:23:06 +00:00
GH-73991: Support copying directory symlinks on older Windows (#120807)
Check for `ERROR_INVALID_PARAMETER` when calling `_winapi.CopyFile2()` and raise `UnsupportedOperation`. In `Path.copy()`, handle this exception and fall back to the `PathBase.copy()` implementation.
This commit is contained in:
parent
089835469d
commit
f09d184821
6 changed files with 40 additions and 29 deletions
|
@ -16,10 +16,7 @@ import operator
|
|||
import posixpath
|
||||
from glob import _GlobberBase, _no_recurse_symlinks
|
||||
from stat import S_ISDIR, S_ISLNK, S_ISREG, S_ISSOCK, S_ISBLK, S_ISCHR, S_ISFIFO
|
||||
from ._os import copyfileobj
|
||||
|
||||
|
||||
__all__ = ["UnsupportedOperation"]
|
||||
from ._os import UnsupportedOperation, copyfileobj
|
||||
|
||||
|
||||
@functools.cache
|
||||
|
@ -27,12 +24,6 @@ def _is_case_sensitive(parser):
|
|||
return parser.normcase('Aa') == 'Aa'
|
||||
|
||||
|
||||
class UnsupportedOperation(NotImplementedError):
|
||||
"""An exception that is raised when an unsupported operation is called on
|
||||
a path object.
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
class ParserBase:
|
||||
"""Base class for path parsers, which do low-level path manipulation.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue