Dear pyxser users, I’m pleased to announce that I’ve released pyxser-1.5.2r. This release adds backport support for Python 2.4 and few algorithm enhancements. As you know this serializer supports cross references and circular references, and have a wide variety of serialization options for your object trasmition and storage tasks. Please feel free to send me your feedback and participate on the pyxser development. You can participate through the SourceForge mailing lists and forums. Also you can report bugs and send me your feedback through the SourceForge web site.
The ChangeLog for this release is as follows:
1.5.2r (2011.01.08): Daniel Molina Wegener* Added support for Python 2.4 * Replaced the use of the commands package by the subprocess package on the setup script. * On the next release will be added support for Python 3.X ;) Thanks to pyxser users for their feedback.
type backporting
I’ve received an email from Juha Tuomala reporting incomapibility on pyxser to install it under Python 2.4. Also he has sent me a patch to make it work with Python 2.4. I’ve reviewed the patch and it was including some system macros, so it would be a little bit hard to include in the pyxser distribution. I’ve decided to study the problem about type backporting to make pyxser compatible with Python 2.4. The main problem was the Py_ssize_t, that is not available on Python 2.4, and used from Python 2.5 on the _PyTuple_Resize Python internal. The patch that Juha tried to send me was creating some macros to replace that type definition. But researching a little a about the Py_ssize_t type, I’ve found the PEP353 that guides on how to backport the usage of the Py_ssize_t type.
#if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN) typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN #endif
The preprocessor conditional block above can be used to backport the Py_ssize_t type without overwriting system types, and since it is a PEP, it should be the official way to backport that specific type. The other problem was about the PyAnySet_CheckExact macro. In this case, I’ve used the that portion of the patch directly, allowing me to backport some pyxser internal functions to Python 2.4
#if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN) #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) #define PyAnySet_CheckExact(ob) (Py_TYPE(ob) == &PySet_Type || Py_TYPE(ob) == &PyFrozenSet_Type) #endif
I’ve used the same technique to detect the Python version and use that specific macro just for the required Python version. This is not affecting the future versions of Pyxser. For the next pyxser release, I’m planning to port it to Python 3.X. I hope that you will enjoy trasmitting and sending Python objects in XML format using the pyxser serializer ;)