[ python-Bugs-1669743 ] Python needs a way to detect implementation

SourceForge.net noreply at sourceforge.net
Thu Mar 1 22:40:45 CET 2007


Bugs item #1669743, was opened at 2007-02-27 08:32
Message generated for change (Comment added) made by loewis
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1669743&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Feature Request
Status: Closed
>Resolution: Works For Me
Priority: 5
Private: No
Submitted By: Kay Hayen (kayhayen2)
Assigned to: Nobody/Anonymous (nobody)
Summary: Python needs a way to detect implementation

Initial Comment:
Hello,

I am currently writing an application that will run under both CPython and PyPy. In this I encountered the need to discover the implementation of the current interpreter.

For example, with PyPy the use of StringIO may offer benefits due to the possibility of more complete analysis of data flows during compilation or JIT execution. I want to take advantage of this. (Granted, currently pypy will run on top of CPython most of the time, so it's not the real solution to my problem until PyPy-c is at comparable performance). This is only example, a lot of different performance behaviors exist, that at times, will make sense to be abstracted.

I have checked module sys of both implementations (plus Jython) and found in CPython only the property "subversion", which contains a tuple with CPython being the first element. My suspect is though that this is related to the detail of using svn in CPython development, and as such, would not be a good standard. 

So, what I believe with more and more Python versions existing (e.g. IronPython), it is needed to have sys.implementation that puts sys.version into context. My proposal is that CPython leads the effort to aid this, and the other Python variants can then adopt the standard property.

Thank you in advance,
Kay Hayen

----------------------------------------------------------------------

>Comment By: Martin v. Löwis (loewis)
Date: 2007-03-01 22:40

Message:
Logged In: YES 
user_id=21627
Originator: NO

No; it should be only available in Python implementations that do indeed
have subversion information available.

If you truly want something that all Python implementations must implement
to be valid implementations of the Python programming language, you will
have to write a PEP.

Closing this as "works for me".

----------------------------------------------------------------------

Comment By: Kay Hayen (kayhayen2)
Date: 2007-03-01 19:01

Message:
Logged In: YES 
user_id=1730054
Originator: YES

Well, I did find sys.subversion of CPython 2.5 and sys.pypy_svn_url of
Pypy 0.99 or so.

The docs currently say about sys.subversion:

"A triple (repo, branch, version) representing the Subversion information
of the Python interpreter. repo is the name of the repository, 'CPython'.
branch is a string of one of the forms 'trunk', 'branches/name' or
'tags/name'. version is the output of svnversion [...]"

Would you confirm that sys.subversion is a property that every
implementation of Python should have?





----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2007-03-01 07:40

Message:
Logged In: YES 
user_id=21627
Originator: NO

Please take a look at sys.subversion. This is fixed in Python 2.5.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1669743&group_id=5470


More information about the Python-bugs-list mailing list