Skip to content

Commit 3d4d01f

Browse files
committed
Back out 7e9605697dfc, 2e3c31ab586a, 759b2cecc289.
These added a path attribute to pathlib.Path objects, and docs. Instead, we're going to use PEP 519. (Starting in the 3.4 branch and merging forward from there since that's what I did originally.)
1 parent 2a86122 commit 3d4d01f

File tree

4 files changed

+0
-58
lines changed

4 files changed

+0
-58
lines changed

Doc/library/pathlib.rst

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -365,24 +365,6 @@ Pure paths provide the following methods and properties:
365365
''
366366

367367

368-
.. data:: PurePath.path
369-
370-
A string representing the full path::
371-
372-
>>> PurePosixPath('my/library/setup.py').path
373-
'my/library/setup.py'
374-
375-
This always returns the same value as ``str(p)``; it is included to
376-
serve as a one-off protocol. Code that wants to support both
377-
strings and ``pathlib.Path`` objects as filenames can write
378-
``arg = getattr(arg, 'path', arg)`` to get the path as a string.
379-
This can then be passed to various system calls or library
380-
functions that expect a string. Unlike the alternative
381-
``arg = str(arg)``, this will still raise an exception if an object
382-
of some other type is given by accident.
383-
384-
.. versionadded:: 3.4.5
385-
386368
.. data:: PurePath.suffix
387369

388370
The file extension of the final component, if any::

Lib/pathlib.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -648,13 +648,6 @@ def __str__(self):
648648
self._parts) or '.'
649649
return self._str
650650

651-
@property
652-
def path(self):
653-
try:
654-
return self._str
655-
except AttributeError:
656-
return str(self)
657-
658651
def as_posix(self):
659652
"""Return the string representation of the path with forward (/)
660653
slashes."""

Lib/test/test_pathlib.py

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -480,22 +480,6 @@ def test_name_common(self):
480480
self.assertEqual(P('a/b.py').name, 'b.py')
481481
self.assertEqual(P('/a/b.py').name, 'b.py')
482482

483-
def test_path_common(self):
484-
P = self.cls
485-
def check(arg, expected=None):
486-
if expected is None:
487-
expected = arg
488-
self.assertEqual(P(arg).path, expected.replace('/', self.sep))
489-
check('', '.')
490-
check('.')
491-
check('/')
492-
check('a/b')
493-
check('/a/b')
494-
check('/a/b/', '/a/b')
495-
check('/a/b/.', '/a/b')
496-
check('a/b.py')
497-
check('/a/b.py')
498-
499483
def test_suffix_common(self):
500484
P = self.cls
501485
self.assertEqual(P('').suffix, '')
@@ -919,17 +903,6 @@ def test_name(self):
919903
self.assertEqual(P('//My.py/Share.php').name, '')
920904
self.assertEqual(P('//My.py/Share.php/a/b').name, 'b')
921905

922-
def test_path(self):
923-
P = self.cls
924-
self.assertEqual(P('c:').path, 'c:')
925-
self.assertEqual(P('c:/').path, 'c:\\')
926-
self.assertEqual(P('c:a/b').path, 'c:a\\b')
927-
self.assertEqual(P('c:/a/b').path, 'c:\\a\\b')
928-
self.assertEqual(P('c:a/b.py').path, 'c:a\\b.py')
929-
self.assertEqual(P('c:/a/b.py').path, 'c:\\a\\b.py')
930-
self.assertEqual(P('//My.py/Share.php').path, '\\\\My.py\\Share.php\\')
931-
self.assertEqual(P('//My.py/Share.php/a/b').path, '\\\\My.py\\Share.php\\a\\b')
932-
933906
def test_suffix(self):
934907
P = self.cls
935908
self.assertEqual(P('c:').suffix, '')

Misc/NEWS

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,6 @@ Library
2121

2222
- Issue #25939: On Windows open the cert store readonly in ssl.enum_certificates.
2323

24-
- Issue #22570: Add 'path' attribute to pathlib.Path objects,
25-
returning the same as str(), to make it more similar to DirEntry.
26-
Library code can now write getattr(p, 'path', p) to get the path as
27-
a string from a Path, a DirEntry, or a plain string. This is
28-
essentially a small one-off protocol.
29-
3024
- Issue #26012: Don't traverse into symlinks for ** pattern in
3125
pathlib.Path.[r]glob().
3226

0 commit comments

Comments
 (0)