Skip to content
Draft
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Change _architecture attribute value
  • Loading branch information
rruuaanng committed Sep 26, 2024
commit a47814e8a3b9567597e4be2cf5e7d711459470e0
14 changes: 13 additions & 1 deletion Python/sysmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ Data members:
# include <unistd.h> // getpid()
#endif

#ifdef HAVE_SYS_UTSNAME_H
# include <sys/utsname.h>
#endif /* HAVE_SYS_UTSNAME_H */

#ifdef MS_WINDOWS
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
Expand Down Expand Up @@ -3322,6 +3326,9 @@ static PyObject *
make_impl_info(PyObject *version_info)
{
int res;
#ifndef MS_WINDOWS
struct utsname u;
#endif /* !MS_WINDOWS */
PyObject *impl_info, *value, *ns;

impl_info = PyDict_New();
Expand Down Expand Up @@ -3358,13 +3365,18 @@ make_impl_info(PyObject *version_info)
if (res < 0)
goto error;

value = PyUnicode_FromString(Py_GetPlatform());
#ifndef MS_WINDOWS
res = uname(&u);
if (res < 0)
goto error;
value = PyUnicode_FromString(u.machine);
if (value == NULL)
goto error;
res = PyDict_SetItemString(impl_info, "_architecture", value);
Py_DECREF(value);
if (res < 0)
goto error;
#endif /* !MS_WINDOWS */

#ifdef MULTIARCH
value = PyUnicode_FromString(MULTIARCH);
Expand Down