Ingo Karkat wrote:

> On 29-Jun-2012 12:55:10 +0200, Bram Moolenaar wrote:
> 
> > Patch 7.3.569
> > Problem:    Evaluating Vim expression in Python is insufficient.
> > Solution:   Add vim.bindeval().  Also add pyeval() and py3eval(). (ZyX)
> > Files:          runtime/doc/eval.txt, runtime/doc/if_pyth.txt, src/eval.c,
> >         src/if_lua.c, src/if_py_both.h, src/if_python.c, src/if_python3.c,
> >         src/proto/eval.pro, src/proto/if_python.pro,
> >         src/proto/if_python3.pro, src/testdir/Make_amiga.mak,
> >         src/testdir/Make_dos.mak, src/testdir/Make_ming.mak,
> >         src/testdir/Make_os2.mak, src/testdir/Makefile,
> >         src/testdir/test86.in, src/testdir/test86.ok,
> >         src/testdir/test87.in, src/testdir/test87.ok
> > 
> > [...]
> > +   capsule = PyCapsule_New(tv, NULL, NULL);
> > +   PyDict_SetItemString(lookupDict, hexBuf, capsule);
> > +   Py_DECREF(capsule);
> > +   if (py_to_tv(obj, tv, lookupDict) == -1)
> > +   {
> > +       tv->v_type = VAR_UNKNOWN;
> > +       return -1;
> > +   }
> > +   /* As we are not using copy_tv which increments reference count we must
> > +    * do it ourself. */
> > +   switch(tv->v_type)
> > +   {
> > +       case VAR_DICT: ++tv->vval.v_dict->dv_refcount; break;
> > +       case VAR_LIST: ++tv->vval.v_list->lv_refcount; break;
> > +   }
> > +     }
> > +     else
> > +     {
> > +   typval_T        *v = PyCapsule_GetPointer(capsule, NULL);
> > [...]
> 
> After this patch, Vim fails to compile on my (admittedly, outdated, but useful
> as a minimal Portable Ubuntu instance running on a Windows Laptop) Ubuntu 
> 10.04
> system, whereas it previously compiled (the big version) just fine. If this
> means that I have to upgrade my system or drop Python support, I would be fine
> with that; I was just surprised that this broke without further notice.
> 
> link.sh: $LINK_AS_NEEDED set to 'yes': invoking linker directly.
>   gcc   -L. -Wl,-Bsymbolic-functions -rdynamic -Wl,-export-dynamic  -Wl,-E
> -L/usr/local/lib -Wl,--as-needed      -o vim objects/buffer.o 
> objects/blowfish.o
> objects/charset.o objects/diff.o objects/digraph.o objects/edit.o 
> objects/eval.o
> objects/ex_cmds.o objects/ex_cmds2.o objects/ex_docmd.o objects/ex_eval.o
> objects/ex_getln.o objects/fileio.o objects/fold.o objects/getchar.o
> objects/hardcopy.o objects/hashtab.o  objects/if_cscope.o objects/if_xcmdsrv.o
> objects/mark.o objects/memline.o objects/menu.o objects/message.o
> objects/misc1.o objects/misc2.o objects/move.o objects/mbyte.o 
> objects/normal.o
> objects/ops.o objects/option.o objects/os_unix.o objects/pathdef.o
> objects/popupmnu.o objects/quickfix.o objects/regexp.o objects/screen.o
> objects/search.o objects/sha256.o objects/spell.o objects/syntax.o
> objects/tag.o objects/term.o objects/ui.o objects/undo.o objects/version.o
> objects/window.o objects/gui.o objects/gui_gtk.o objects/gui_gtk_x11.o
> objects/pty.o objects/gui_gtk_f.o objects/gui_beval.o   objects/if_perl.o
> objects/if_perlsfio.o objects/if_python.o objects/py_config.o
> objects/if_ruby.o   objects/netbeans.o  objects/main.o objects/memfile.o
> -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangocairo-1.0
> -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0   -lSM -lICE
> -lXpm -lXt -lX11 -lXdmcp -lSM -lICE -lm -lncurses -lnsl  -lselinux     -Wl,-E
> -L/usr/local/lib /usr/lib/perl/5.8/auto/DynaLoader/DynaLoader.a
> -L/usr/lib/perl/5.8/CORE -lperl -ldl -lm -lpthread -lcrypt
> -L/usr/lib/python2.5/config -lpython2.5 -lpthread -ldl -lutil -lm -Xlinker
> -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions   -lruby1.8 -lpthread -ldl
> -lcrypt -lm  -L/usr/lib
> objects/if_python.o: In function `convert_dl':
> /home/inkarkat/swdev/vim/vim/src/if_py_both.h:2461: undefined reference to
> `PyCapsule_GetPointer'
> /home/inkarkat/swdev/vim/vim/src/if_py_both.h:2443: undefined reference to
> `PyCapsule_New'
> collect2: ld returned 1 exit status
> link.sh: Linking failed
> make[1]: *** [vim] Error 1
> make[1]: Leaving directory `/home/inkarkat/swdev/vim/vim/src'
> make: *** [first] Error 2
> 
> $ python --version
> Python 2.5.2
> 
> $ uname -a
> Linux pubuntu 2.6.22.18-co-0.7.3 #1 PREEMPT Sat May 24 22:27:30 UTC 2008 i686
> GNU/Linux

It appears PyCapsule_GetPointer is new in Python 2.7.  We should support
Python 2.5.

It is only used in convert_dl().  Perhaps there is another way to do the
same for older Python versions?

-- 
Q: How many legs does a giraffe have?
A: Eight: two in front, two behind, two on the left and two on the right

 /// Bram Moolenaar -- b...@moolenaar.net -- 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

Raspunde prin e-mail lui