Skip to content
Draft
Show file tree
Hide file tree
Changes from 22 commits
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
4 changes: 4 additions & 0 deletions Lib/test/test_sys.py
Original file line number Diff line number Diff line change
Expand Up @@ -1032,6 +1032,10 @@ def test_implementation(self):
self.assertEqual(sys.implementation.name,
sys.implementation.name.lower())

if hasattr(sys.implementation, '_architecture'):
self.assertIn(sys.implementation._architecture,
['win32', 'amd64', 'arm32', 'arm64', ''])

@test.support.cpython_only
def test_debugmallocstats(self):
# Test sys._debugmallocstats()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Added ``_architecture`` attribute to :data:`sys.implementation`
to describe the current system platform.
6 changes: 5 additions & 1 deletion PCbuild/pythoncore.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,11 @@
<ClCompile Include="..\Python\structmember.c" />
<ClCompile Include="..\Python\symtable.c" />
<ClCompile Include="..\Python\sysmodule.c">
<PreprocessorDefinitions>VPATH="$(PyVPath)";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>
VARCH_NAME="$(ArchName)";
VPATH="$(PyVPath)";
%(PreprocessorDefinitions)
</PreprocessorDefinitions>
</ClCompile>
<ClCompile Include="..\Python\thread.c" />
<ClCompile Include="..\Python\traceback.c" />
Expand Down
12 changes: 12 additions & 0 deletions Python/sysmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -3358,6 +3358,18 @@ make_impl_info(PyObject *version_info)
if (res < 0)
goto error;

#ifdef VARCH_NAME
value = PyUnicode_FromString(VARCH_NAME);
if (value == NULL) {
goto error;
}
res = PyDict_SetItemString(impl_info, "arch", value);
Py_DECREF(value);
if (res < 0) {
goto error;
}
#endif

#ifdef MULTIARCH
value = PyUnicode_FromString(MULTIARCH);
if (value == NULL)
Expand Down
Loading