Bug#678122: vim-gnome: python bindings botched?

James McCoy jamessan at debian.org
Tue Jun 19 22:17:34 UTC 2012


reassign 678122 gcc-4.7 4.7.1-1
severity 678122 important
affects 678122 vim
thanks

On Tue, Jun 19, 2012 at 12:58:00PM +0200, Ph. Marek wrote:
> With vim 2:7.3.547-1 and the implied python2.7 the python bindings are broken
> in some way - although I cannot say whether it's vim or pythons fault.

As far as I can tell, it's a problem with GCC 4.7.  I though it had been
fixed in recent GCC uploads, but I guess not.

It's definitely optimization specific as building at -O1 instead of -O2
fixes the problem.  It seems to also be somewhat architecture specific.
The i386 binaries work fine, but the amd64 binaries don't.

> With 2:7.2.330-1ubuntu3 I get the correct result:
> 
> # vim -u NONE -U NONE -N -c "python sys.stdout.write('1')" -c ':q!'
> 1

It was built with GCC 4.6.

The problem is that with GCC 4.7, the below call to PyArg_ParseTuple
(from src/if_py_both.h) results in str being NULL, but the function
still returns "success".

  70     static PyObject *
  71 OutputWrite(PyObject *self, PyObject *args)
  72 {
  73     int len;
  74     char *str = NULL;
  75     int error = ((OutputObject *)(self))->error;
  76 
  77     if (!PyArg_ParseTuple(args, "et#", ENC_OPT, &str, &len))
  78         return NULL;


Bram added a patch[0] to check for this NULL so Vim just doesn't do
anything instead of crashing, but the right fix is to get GCC to not
produce bad code when it optimizes this.

Cheers,
-- 
James
GPG Key: 4096R/331BA3DB 2011-12-05 James McCoy <jamessan at debian.org>





More information about the pkg-vim-maintainers mailing list