This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: PYTHON_API_VERSION needs to be bumped?
Type: behavior Stage: resolved
Components: Extension Modules, Interpreter Core Versions: Python 2.7
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: holdenweb, loewis, pitrou, ronaldoussoren
Priority: high Keywords:

Created on 2010-03-11 15:38 by ronaldoussoren, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (7)
msg100867 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2010-03-11 15:38
If I understand the code correct Python 2.6 has the same value for PYTHON_API_VERSION, even though extensions are not compatible.

In particular: when you compile an extension that uses PyInt_Check with python2.6 and load that extension with python 2.5 you will not get a version warning from Py_InitModule4 and you will also not get the right answers from PyInt_Check.

This due to PyType_FastSubclass (in python 2.6) which tests flags in the type structure that are not initiazed in 2.5.  That is a change in the ABI and hence should be accompanied by increasing PYTHON_API_VERSION.

 
This is technically a bug in 2.6, but I'm not selecting that version in the list because increasing PYTHON_API_VERSION in 2.6.x would break existing installations when they upgrade.
msg100967 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-03-12 20:56
Is PYTHON_API_VERSION actually useful right now? It seems to me that we need Martin's ABI stability PEP to be implemented before extension modules can be safely shared between several non-bugfix releases.
msg100973 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2010-03-12 21:31
> Is PYTHON_API_VERSION actually useful right now? It seems to me that
> we need Martin's ABI stability PEP to be implemented before extension
> modules can be safely shared between several non-bugfix releases.

Today, PYTHON_API_VERSION primarily serves as a check that the extension
you load had been compiled for the Python release that its being loaded
into. We promise ABI stability across bug fix releases for the same
feature release, so yes, it is useful.

The original motivation (allowing to share extensions across feature
releases) was last relevant in the 1.x series, IIRC.
msg101254 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2010-03-18 09:34
But should PYTHON_API_VERSION be increased for the 2.7 release?  

I think it should because of the binary incompatible differences between 2.5 and 2.6. In a perfect world that would have resulted in an increase of PYTHON_API_VERSION for the 2.6.0 release, but that's something that slipped through the cracks. By increasing the value in 2.7.0 users that switch from 2.5 to 2.7 get warnings that should help then find why their compiled extension stopped working (users migrating from 2.6 to 2.7 would also get the warning while it is technically not necessary, but that's harmless because you shouldn't reuse extensions  anyway).

The primary reason for posting this issue was that a colleague ran into this problem: he compiled an extension on a machine with python2.5 and ran the result on a machine with python2.6 and that misteriously didn't work  (in his defense: he thought that both machines ran the same version of python).  A warning at import would have made it more clear what was going wrong.
msg101255 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-03-18 10:19
> But should PYTHON_API_VERSION be increased for the 2.7 release?  

Sounds like a good idea.
msg111271 - (view) Author: Steve Holden (holdenweb) * (Python committer) Date: 2010-07-23 10:46
With the 2.7 release now completed should we close this issue? There's nothing to be done about the 2.6 issue.
msg111274 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2010-07-23 10:59
I agree, this issue can be closed as there's nothing useful we can do at this point in time.
History
Date User Action Args
2022-04-11 14:56:58adminsetgithub: 52365
2010-07-23 10:59:47ronaldoussorensetstatus: open -> closed
resolution: wont fix
messages: + msg111274

stage: resolved
2010-07-23 10:46:59holdenwebsetnosy: + holdenweb
messages: + msg111271
2010-03-18 10:19:25pitrousetmessages: + msg101255
2010-03-18 09:34:28ronaldoussorensetmessages: + msg101254
2010-03-12 21:31:37loewissetmessages: + msg100973
2010-03-12 20:56:43pitrousetnosy: + loewis, pitrou
messages: + msg100967
2010-03-11 15:38:23ronaldoussorencreate