Jun Takimoto wrote:
> 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 like this solution. Since for Python 3 the #if is never try we can
leave it out. Don't know why it was there in the first place.
> (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.
I think that's more complicated.
--
"The sun oozed over the horizon, shoved aside darkness, crept along the
greensward, and, with sickly fingers, pushed through the castle window,
revealing the pillaged princess, hand at throat, crown asunder, gaping
in frenzied horror at the sated, sodden amphibian lying beside her,
disbelieving the magnitude of the frog's deception, screaming madly,
"You lied!"
- Winner of the Bulwer-Lytton contest (San Jose State University),
wherein one writes only the first line of a bad novel
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
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.