FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-129393: Make 'sys.platform' return "freebsd" only on FreeBSD witho… by michael-o · Pull Request #129394 · python/cpython · GitHub

/ cpython Public
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .ac  (1) .rst  (3) No extension  (1) All 3 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
15 changes: 10 additions & 5 deletions Doc/library/sys.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -1422,6 +1422,7 @@ always available. Unless explicitly noted otherwise, all variables are read-only
AIX ``'aix'``
Android ``'android'``
Emscripten ``'emscripten'``
FreeBSD ``'freebsd'``
iOS ``'ios'``
Linux ``'linux'``
macOS ``'darwin'``
Expand All @@ -1432,12 +1433,12 @@ always available. Unless explicitly noted otherwise, all variables are read-only

On Unix systems not listed in the table, the value is the lowercased OS name
as returned by ``uname -s``, with the first part of the version as returned by
``uname -r`` appended, e.g. ``'sunos5'`` or ``'freebsd8'``, *at the time
when Python was built*. Unless you want to test for a specific system
version, it is therefore recommended to use the following idiom::
``uname -r`` appended, e.g. ``'sunos5'``, *at the time when Python was built*.
Unless you want to test for a specific system version, it is therefore
recommended to use the following idiom::

if sys.platform.startswith('freebsd'):
# FreeBSD-specific code here...
if sys.platform.startswith('sunos'):
# SunOS-specific code here...

.. versionchanged:: 3.3
On Linux, :data:`sys.platform` doesn't contain the major version anymore.
Expand All @@ -1451,6 +1452,10 @@ always available. Unless explicitly noted otherwise, all variables are read-only
On Android, :data:`sys.platform` now returns ``'android'`` rather than
``'linux'``.

.. versionchanged:: 3.14
On FreeBSD, :data:`sys.platform` doesn't contain the major version anymore.
It is always ``'freebsd'``, instead of ``'freebsd13'`` or ``'freebsd14'``.

.. seealso::

:data:`os.name` has a coarser granularity. :func:`os.uname` gives
Expand Down
3 changes: 3 additions & 0 deletions Doc/whatsnew/3.14.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,9 @@ sys
which only exists in specialized builds of Python, may now return objects
from other interpreters than the one it's called in.

* On FreeBSD, :data:`sys.platform` doesn't contain the major version anymore.
It is always ``'freebsd'``, instead of ``'freebsd13'`` or ``'freebsd14'``.

sys.monitoring
--------------

Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
On FreeBSD, :data:`sys.platform` doesn't contain the major version anymore.
It is always ``'freebsd'``, instead of ``'freebsd13'`` or ``'freebsd14'``.
1 change: 1 addition & 0 deletions configure

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions configure.ac
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ then

case $MACHDEP in
aix*) MACHDEP="aix";;
freebsd*) MACHDEP="freebsd";;
linux-android*) MACHDEP="android";;
linux*) MACHDEP="linux";;
cygwin*) MACHDEP="cygwin";;
Expand Down

Back | FazBrowse Home | New Git URL