This commit:
* Adds Python 3 module initialization functions. I split out the main init
of each module into a static setup_module function.
* Adds a py3.h which unifies int/long in Python 3 and unicode/bytes in
Python 2. _imagingft.c unfortunately looks a little kludgy after this
because it was already using PyUnicode functions, and I had to mix and
match there manually.
With this commit, the modules all build successfully under Python 3.
What this commit does NOT do is patch all of the uses of PyArg_ParseTuple
and Py_BuildValue, which all need to be checked for proper use of bytes
and unicode codes. It also does not let selftest.py run yet, because there
are probably hundreds of issues to fix in the Python code itself.
This updates several Python type definitions and uses to bring us closer
to Python 3 compatibility. This includes:
* Replacing staticforward and statichere with static. These were a hack for
old compilers and are not supported/needed anymore.
* Using Py_TYPE() instead of ob_type; ob_type is hidden in Py3.
* Replacing getattr with getters/setters. getattr is sort-of supported in
Py3, but Py_FindMethod is not. So we just use the newer
methods/getsetters mechanisms and start using PyType_Ready everywhere.
* Use PyVarObject_HEAD_INIT for types, since types are PyVarObject.
* Use PyMODINIT_FUNC for module initialization functions.
There are some tab/space issues in this commit. I'm set for spaces; the
source is a little schizo.