Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb913f47

Browse files
bpo-39950: Fix deprecation warning in test forpathlib.Path.link_to() (GH-26155) (GH-26178)
(cherry picked from commit1a08c5a)Co-authored-by: Barney Gale <barney.gale@gmail.com>
1 parent68b79f7 commitb913f47

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

‎Lib/pathlib.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1265,7 +1265,7 @@ def link_to(self, target):
12651265
warnings.warn("pathlib.Path.link_to() is deprecated and is scheduled "
12661266
"for removal in Python 3.12. "
12671267
"Use pathlib.Path.hardlink_to() instead.",
1268-
DeprecationWarning)
1268+
DeprecationWarning,stacklevel=2)
12691269
self._accessor.link(self,target)
12701270

12711271
# Convenience functions for querying the stat results

‎Lib/test/test_pathlib.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1934,7 +1934,8 @@ def test_link_to(self):
19341934
self.assertTrue(p.stat)
19351935
# Linking to a str of a relative path.
19361936
r=rel_join('fileAAA')
1937-
q.link_to(r)
1937+
withself.assertWarns(DeprecationWarning):
1938+
q.link_to(r)
19381939
self.assertEqual(os.stat(r).st_size,size)
19391940
self.assertTrue(q.stat)
19401941

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp