On 2013/06/10, at 20:21, Bram Moolenaar <[email protected]> wrote:
>> +#define PY_SSIZE_T_CELAN
> 
> Didn't you mean PY_SSIZE_T_CLEAN ?

Of course I believe he (Elimar) means PY_SSIZE_T_CLEAN.

> It's defined further down, but inside an #ifdef.  Do we need that #ifdef
> here as well?  Or perhaps we should move the other define to this place?

No.
The macro PY_VERSION_HEX is defined in Python.h, so we can't use it
before including Python.h.

Python.h uses PY_SSIZE_T_CLEAN, and it must be defined before including it.
Python.h from python2.4 or earlier will simply ignore PY_SSIZE_T_CLEAN,
so defining it irrespective of the python version is OK.
But PY_SSIZE_T_CLEAN is also used by if_python.c itself, 
and must be defined only for python2.5 or later.

The following may be slightly better??

#define PY_SSIZE_T_CLEAN
#include <Python.h>
#if PY_VERSION_HEX < 0x02050000
#undef PY_SSIZE_T_CLEAN
#endif

(I believe we can assume PY_VERSION_HEX is defined if Python.h is
successfully included.)

Another possibility (but not sure a good idea or not) is to detect
python version by configure (yes, it already does so), and define
PY_SSIZE_T_CLEAN in config.h if version >= 2.5.

---
Jun

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Raspunde prin e-mail lui