Re: process crash when a plpython function returns unicode

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: process crash when a plpython function returns unicode
Date: 2005-06-18 14:41:15
Message-ID: 20050618144115.GA91757@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

I've moved this thread from pgsql-bugs to pgsql-hackers; here are
the original messages:

http://archives.postgresql.org/pgsql-bugs/2005-06/msg00105.php
http://archives.postgresql.org/pgsql-bugs/2005-06/msg00107.php

As I mentioned in my followup to the bug report, a simple fix would
appear to be to check for a NULL return value from PyObject_Str()
before calling PyString_AsString() at the following location:

/* Lines 776-77 in plpython.c */
plrv_so = PyObject_Str(plrv);
plrv_sc = PyString_AsString(plrv_so);

I was going to submit a patch, but I don't know enough about the
Python API or how Python and PostgreSQL handle Unicode to know
whether adding that simple check is the appropriate solution (I was
planning to raise an error if PyObject_Str() returned NULL). Can
anybody think of a better fix?

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tino Wildenhain 2005-06-18 15:27:28 Re: process crash when a plpython function returns
Previous Message Tom Lane 2005-06-18 05:54:26 Re: BUG #1720: placeholders do not work with timestamp prefix

Browse pgsql-hackers by date

  From Date Subject
Next Message Tino Wildenhain 2005-06-18 15:04:18 Re: [PATCHES] default database creation with initdb
Previous Message Bruno Wolff III 2005-06-18 14:36:00 Re: default database creation with initdb