[Python-Dev] Restricted API versioning (original) (raw)
"Martin v. Löwis" martin at v.loewis.de
Sat Jun 23 23:31:07 CEST 2012
- Previous message: [Python-Dev] [Python-checkins] cpython: #4489: Add a shutil.rmtree that isn't suspectible to symlink attacks
- Next message: [Python-Dev] Restricted API versioning
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I've been thinking about extensions to the stable ABI. On the one hand, introducing new API can cause extension modules not to run on older Python versions. On the other hand, the new API may well be stable in itself, i.e. remain available for all coming 3.x versions.
As a compromise, I propose that such API can be added, but extension authors must explicitly opt into using it. To define their desired target Python versions, they need to set Py_LIMITED_API to the hexversion of the first Python release they want to support.
Objections?
The first use case of this are some glitches in the heap type API that Robin Schreiber detected in his GSoC project. E.g. specifying a heap type whose base also is a heap type was not really possible: the type spec would have to contain a pointer to the base, but that is not constant. In addition, if we use multiple interpreters, the base type should be a different object depending on the current interpreter - something that PyType_FromSpec couldn't support at all. So there is a new API function PyType_FromSpecWithBases which covers this case, and this API will only be available in 3.3+.
Regards, Martin
- Previous message: [Python-Dev] [Python-checkins] cpython: #4489: Add a shutil.rmtree that isn't suspectible to symlink attacks
- Next message: [Python-Dev] Restricted API versioning
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]