-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi folks, for 10.2 release, we have switched to Python 2.5. It's quite a big change, so here's an assorted list of changes and things to look out for while migrating. toc: 1. pure Python apps and modules 2. C extensions and apps interfacing with Python 3. migrating packages - changes of the standard library 1. pure Python apps and modules Pure Python modules should be largely unaffected, as the majority of changes is backwards compatible. But, be sure to read through the list of changes [1]. Just in case. 2. C extensions and apps interfacing with Python Most of C extension modules will suffer from various problems on 64bit platforms, because of transition to 64bit indices. To sum it up, Python now uses a different type, Py_ssize_t instead of int, for indexing and measuring strings, lists, tuples and dictionaries. Py_ssize_t is the same size as int on 32bit platforms, but it is bigger on 64bits. The change is described in great detail at [2], I'll just list a few guidelines to fix the packages. First and foremost, it's absolutely necessary to fix function calls that use Py_ssize_t as output arguments. Most common are PyString_AsStringAndSize and PyDict_Next, but there are quite a few others. Second, when defining new Python types from C, you need to change certain function signatures: intargfunc becomes ssizeargfunc and must take Py_ssize_t argument, similarly with intintargfunc and other int*funcs. Then there are some lesser tasks - some functions (Py*_Size) return Py_ssize_t, so you should either store it in a proper variable, or check for integer overflow; many others take Py_ssize_t as input... None of this is really necessary to fix, though - if left as is, the extension will work, only it won't be able to access elements beyond int limit. A script [3] can be used to find problems in the extension modules. It also contains lists of affected functions, and provides a bit of interesting insight. It's a must-read for everybody who is going to tamper with C extensions. (I didn't read it at first, and i've regretted it deeply.) There is one more thing that can cause problems: due to a change in Python internal memory allocation, PyMem_* and PyObject_* allocation families are no longer interchangeable. That means that when deallocating a custom type, you need to use PyObject_Del insteand of PyMem_DEL, as many modules now do. If an app or extension is crashing on "invalid free()", it's almost certainly caused by this. Check your code, looking for functions like Py*_Dealloc. 3. migrating packages - changes of the standard library Good news everyone, distutils are back in the core python package. Bad news is that you still need python-devel to do "python setup.py install", because it includes the Makefile necessary for installation. As of now, this is intentional, but it will probably change before 10.3. On this place I'd like to remind everyone of two things: - - since 10.1 distutils install by default into /usr/local. You want to add --prefix=%{_prefix} to the install command in specfile - - Python packages, even pure Python, are not noarch. This is because of /usr/lib vs. /usr/lib64 discrepancy. On 64bit systems, /usr/lib is not in the search path (and yes, this is intentional, because of C extensions), so packages installed there will not work. We'd like to solve this issue somehow, but FHS is limiting, because it doesn't recognize arch-independent library code. In other news, Python 2.5 brings us new additions to the standard library. Part of the ElementTree module is now included. The module has a different name, but many packages out there can already use it. It's inside python-xml subpackate. Another welcome addition is the Sqlite3 module. (sadly it didn't work in intial release, we are now shipping an update) It's in the core package, you don't need to add any dependencies. We also have ctypes, hashlib and wsigref. You can read more about them in [4]. If you have any problems with the transition, feel free to contact me. Regards Jan Matejek [1] http://docs.python.org/whatsnew/other-lang.html [2] http://www.python.org/dev/peps/pep-0353/ [3] http://svn.effbot.python-hosting.com/stuff/sandbox/python/ssizecheck.py [4] http://docs.python.org/whatsnew/modules.html -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org iD8DBQFFp3f/jBrWA+AvBr8RAkIDAJ4jB/Hx4NKh2gSqlaQsnC8FAsCOhwCgk6gm hJ7gPwomVwbcfPR/ley3blM= =aRll -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org