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

Commit562bdee

Browse files
committed
Fix compat.is_darwin
This fixes compat.is_darwin to use sys.platform instead of os.nameso that it is True on macOS systems instead of always being False.The deprecation rationale in compat.py is accordingly adjusted.Together withc01fe76, this largely addresses#1731.
1 parentc01fe76 commit562bdee

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

‎git/compat.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,14 @@
3636

3737
# DEPRECATED attributes providing shortcuts to operating system checks based on os.name.
3838
#
39-
# - is_win and is_posix are deprecated because it is clearer, and helps avoid bugs, to
40-
# write out the os.name checks explicitly. For example, is_win is False on Cygwin, but
41-
# is often assumed to be True.
39+
# These are deprecated because it is clearer, and helps avoid bugs, to write out the
40+
# os.name or sys.platform checks explicitly, especially in cases where it matters which
41+
# is used. For example, is_win is False on Cygwin, but is often assumed True. To detect
42+
# Cygwin, use sys.platform == "cygwin". (Also, in the past, is_darwin was unreliable.)
4243
#
43-
# - is_darwin is deprecated because it is always False on all systems, as os.name is
44-
# never "darwin". For macOS, you can check for sys.platform == "darwin". (As on other
45-
# Unix-like systems, os.name == "posix" on macOS. This is also the case on Cygwin.)
46-
#
47-
is_win:bool=os.name=="nt"
44+
is_win=os.name=="nt"
4845
is_posix=os.name=="posix"
49-
is_darwin=os.name=="darwin"
46+
is_darwin=sys.platform=="darwin"
5047

5148
defenc=sys.getfilesystemencoding()
5249

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp