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

Re: [HACKERS] Patch to fix plpython on OS X

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>,"Jim C(dot) Nasby" <decibel(at)decibel(dot)org>, pgsql-patches(at)postgresql(dot)org,pgsql-hackers(at)postgresql(dot)org
Subject: Re: [HACKERS] Patch to fix plpython on OS X
Date: 2005-07-24 13:21:11
Message-ID: 20050724132111.GA892@winnie.fuhr.org (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-patches
On Sat, Jul 23, 2005 at 10:38:59PM -0400, Tom Lane wrote:
> Well, if it is just a Python version issue then all we need do is add
> a variant expected-output file to match.  I was just expressing a
> desire to know that for sure before we wallpaper over the symptom...

I just built Python 2.3 and it does indeed format the error differently
than later versions (the format appears to have changed in 2.3.1):

% python2.3 
Python 2.3 (#1, Jul 24 2005, 06:18:30) 
[GCC 3.4.2] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> str(u'\x80')
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
UnicodeEncodeError: 'ascii' codec can't encode character '\u80' in position 0: ordinal not in range(128)

% python2.4
Python 2.4.1 (#1, Apr  6 2005, 09:52:02) 
[GCC 3.4.2] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> str(u'\x80')
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
UnicodeEncodeError: 'ascii' codec can't encode character u'\x80' in position 0: ordinal not in range(128)

One could check the version of Python that PL/Python is using with
the following function (assuming that Python isn't so broken that
it would use the core of one version but find modules from another):

CREATE FUNCTION pyversion() RETURNS text AS $$
import sys
return sys.version
$$ LANGUAGE plpythonu;

I've attached two new files that should go in the plpython directory:

resultmap
expected/plpython_error_py23.out

A problem with this patch is that it assumes a version of Python
based on the OS, which might clean up the current buildfarm but
that isn't really correct.  Is there a better way to handle this?

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

In response to

Responses

pgsql-hackers by date

Next:From: Andrew DunstanDate: 2005-07-24 13:40:42
Subject: Re: [HACKERS] Patch to fix plpython on OS X
Previous:From: Simon RiggsDate: 2005-07-24 09:54:27
Subject: Re: Constraint Exclusion on all tables

pgsql-patches by date

Next:From: Andrew DunstanDate: 2005-07-24 13:40:42
Subject: Re: [HACKERS] Patch to fix plpython on OS X
Previous:From: Petr JelinekDate: 2005-07-24 12:46:13
Subject: Re: per user/database connections limit again

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group