On Sunday, September 9, 2012 2:59:00 AM UTC+4, Sean Estabrooks wrote: > ---------------------------------------- > > > > No one's undefying PY_SSIZE_T_CLEAN in Python.h. Why? =) > > > > > > > > There are two different functions one for int length and the other for > > > Py_ssize_t. We define PY_SSIZE_T_CLEAN and that would work with implicit > > > linking (through linker flags, -lpython), because preprocessor > > > conditionally replaces one for the other in modsupport.h, but we need to > > > handle that ourselves with explicit linking, namely dlsym > > > _PyArg_ParseTuple_SizeT instead of PyArg_ParseTuple from libpython.so. > > > > > > Yes. But you must do this or your patch just adds a bunch of conditions > > > > > > #if 0 /* Originally #ifndef PY_SSIZE_T_CLEAN */ > > > /* Import int function variants */ > > > #else > > > /* Import Py_ssize_t function variants */ > > > #endif > > > . Don’t you think having “#if 0”-like conditions is strange? You should > > undefine PY_SSIZE_T_CLEAN based on some conditions, remove one of the > > branches or replace “#ifndef” with what makes more sense. > > > > Yes, Having an if 0 is strange, but I didn't think it was really worth > commenting on since I don't think this is the correct patch anyway. I'm > still trying to understand why he's seeing different compile results than I > am, especially since we're on the ostensibly the same setup. > > > > Am more interested to hear from Maxim why his compile isn't already making > the correct defines, as mine is here. > > > > Thanks, > > Sean
Sean, Here's what happens, 1. We define PY_SSIZE_T_CLEAN. 2. Include Python.h, which includes modsupport.h 3. modsupport.h sees PY_SSIZE_T_CLEAN and defines PyArg_ParseTuple as _PyArg_ParseTuple_SizeT 4. !!! We redefine PyArg_ParseTuple as dll_PyArg_ParseTuple (a function pointer) 5. We load PyArg_ParseTuple from libpython.so and set dll_PyArg_ParseTuple to point to it. Defined PY_SSIZE_T_CLEAN or not, dll_PyArg_ParseTuple will always point to PyArg_ParseTuple. -- 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
