Title: platform.architecture() fails if python is lanched via its symbolic link (cygwin)
Type: Stage:
Components: Library (Lib) Versions: Python 3.0, Python 2.6, Python 2.5
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: amaury.forgeotdarc, ocean-city
Priority: normal Keywords: easy, patch

Created on 2008-09-03 07:04 by ocean-city, last changed 2008-09-04 11:25 by ocean-city. This issue is now closed.

File name Uploaded Description Edit
platform_v2.patch ocean-city, 2008-09-03 09:15
platform.patch ocean-city, 2008-09-03 09:21
Messages (5)
msg72376 - (view) Author: Hirokazu Yamamoto (ocean-city) * (Python committer) Date: 2008-09-03 07:04
I created symbolic link to python.exe as dummy.exe on cygwin.
But I noticed platform.architecture() printed ('32bit', '')

$ ./dummy
Python 2.6b3+ (trunk:66166M, Sep  3 2008, 06:43:59)
[GCC 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import platform
>>> platform._follow_symlinks("dummy.exe")

Is this _follow_symlinks's intended behavior? If no, I hope attached
patch will fix problem. Now platform.architecture() prints
('32bit', 'WindowsPE')
msg72377 - (view) Author: Hirokazu Yamamoto (ocean-city) * (Python committer) Date: 2008-09-03 07:05
- But I noticed platform.architecture() printed ('32bit', '')
+ But I noticed platform.architecture() printed ('32bit', '')
when I lanched python via dummy.exe
msg72378 - (view) Author: Hirokazu Yamamoto (ocean-city) * (Python committer) Date: 2008-09-03 09:15
This sliped out of my mind. :-(

>Python versions and must at least support Python 2.1.

os.path.realpath is new feature in Python2.2, so probably this cannot be
used. I attached another patch platform_v2.patch.
msg72488 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2008-09-04 09:26
The problem shows up on other platforms as well.
The following comes from a standard Debian 64bit:

$ /usr/bin/python -c "import platform; print platform.architecture()"
('64bit', '')
$ /usr/bin/python2.4 -c "import platform; print platform.architecture()"
('64bit', 'ELF')

And the patch corrects this.
msg72493 - (view) Author: Hirokazu Yamamoto (ocean-city) * (Python committer) Date: 2008-09-04 11:25
Thanks, fixed in r66213(trunk), r66214(release-maint25), r66216(py3k).
Date User Action Args
2008-09-04 11:25:14ocean-citysetstatus: open -> closed
resolution: accepted -> fixed
messages: + msg72493
2008-09-04 09:26:32amaury.forgeotdarcsetkeywords: - needs review
resolution: accepted
messages: + msg72488
nosy: + amaury.forgeotdarc
2008-09-04 01:36:08ocean-citysetkeywords: + easy, needs review
2008-09-03 09:21:45ocean-citysetfiles: + platform.patch
2008-09-03 09:15:45ocean-citysetfiles: + platform_v2.patch
keywords: + patch
messages: + msg72378
2008-09-03 07:05:49ocean-citysetmessages: + msg72377
components: + Library (Lib)
2008-09-03 07:04:22ocean-citycreate