Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search archives
  Advanced Search

Re: can't load plpython


  • From: Euler Taveira de Oliveira <euler(at)timbira(dot)com>
  • To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
  • Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
  • Subject: Re: can't load plpython
  • Date: Tue, 31 Mar 2009 13:55:02 -0300
  • Message-id: <49D24AE6.4020105@timbira.com> <text/plain>

Tom Lane escreveu:
> Alvaro Herrera <alvherre(at)commandprompt(dot)com> writes:
>> ... However, on HEAD this is crashing for me, and it's right when plpython
>> loads.  Backtrace below.
> 
> Does plpython pass its regression tests for you (I'd suppose not)?
> 
> For me on Fedora 10 x86_64, CVS HEAD plus python 2.5.2 passes regression
> but the given example still dumps core.  postmaster log says
> 
> postgres: tgl regression [local] SELECT: Objects/stringobject.c:107: PyString_FromString: Assertion `str != ((void *)0)' failed.
> LOG:  server process (PID 4714) was terminated by signal 6: Aborted
> LOG:  terminating any other active server processes
> 
PyString_FromString() [1] fails to return something useful, i.e, null pointer
when  its argument is null.  The trivial fix (that is attached) is to ensure
that we don't pass a null pointer as the second argument of
PyDict_SetItemString(). Of course, it's a Python bug and I filled it [3].

>> Obviously I don't know Python to fix it :-)
> 
> Me either.  Something is pretty bad in python-land, it seems.
> 
Me either. ;)

[1]
http://svn.python.org/view/python/trunk/Objects/stringobject.c?revision=70682&view=markup
[2]
http://svn.python.org/view/python/trunk/Objects/dictobject.c?revision=70550&view=markup
[3] http://bugs.python.org/issue5627


-- 
  Euler Taveira de Oliveira
  http://www.timbira.com/
Index: plpython.c
===================================================================
RCS file: /a/pgsql/dev/anoncvs/pgsql/src/pl/plpython/plpython.c,v
retrieving revision 1.118
diff -c -r1.118 plpython.c
*** plpython.c	15 Jan 2009 13:49:56 -0000	1.118
--- plpython.c	31 Mar 2009 16:48:47 -0000
***************
*** 1053,1059 ****
  			}
  
  			if (PyList_SetItem(args, i, arg) == -1 ||
! 				(proc->argnames &&
  				 PyDict_SetItemString(proc->globals, proc->argnames[i], arg) == -1))
  				PLy_elog(ERROR, "PyDict_SetItemString() failed for PL/Python function \"%s\" while setting up arguments", proc->proname);
  			arg = NULL;
--- 1053,1059 ----
  			}
  
  			if (PyList_SetItem(args, i, arg) == -1 ||
! 				(proc->argnames && proc->argnames[i] != NULL &&
  				 PyDict_SetItemString(proc->globals, proc->argnames[i], arg) == -1))
  				PLy_elog(ERROR, "PyDict_SetItemString() failed for PL/Python function \"%s\" while setting up arguments", proc->proname);
  			arg = NULL;


Home | Main Index | Thread Index

Privacy Policy | About PostgreSQL
Copyright © 1996 – 2012 PostgreSQL Global Development Group