rogerb at rogerbinns.com
Fri Nov 21 20:47:58 CET 2008
-----BEGIN PGP SIGNED MESSAGE-----
M.-A. Lemburg wrote:
> Starting with Python 3, you have to use PyVarObject_HEAD_INIT()
> on PyVarObjects and PyObject_HEAD_INIT() on PyObjects. I don't
> see the problem. It's just another change to remember when porting
> to Python 3.
The problem is that unless you are clairvoyant you have no way of
knowing about this change. Even in rc3 the documentation shows the old
PyObject_HEAD_INIT is documented:
PyVarObject_HEAD_INIT is not:
So anyone porting from Python 2 to Python 3 is just going to compile
their code. There will be some warnings but if they consult the docs
the code will still look correct. They will just assume it is a Python
quirk. Then the code will run and crash and they will have to examine
the Python 3 source to work out what the underlying issue is and how to
If PyObject_HEAD_INIT were removed/renamed then the code wouldn't even
compile and so they would realize they have to fix it.
> * PyNumberMethods have changed due to removal of the division,
> * PySequenceMethods have changed, but maintained binary compatibility
> (why ?) by replacing the removed slice functions with dummy pointers
> * PyBufferProcs is a completely new design
PyTypeObjects are used in every extension. The above changes affect
fewer extensions and the compiler error/warnings will be more
meaningful. I would have expected minor changes like these.
> * A lot type flags were removed.
That is fine. The Python 2 code would fail to compile so you would at
least know what to look for and about.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
-----END PGP SIGNATURE-----
More information about the Python-3000