plpython: sys module doesn't know about _getframe

From: pgsql-bugs(at)postgresql(dot)org
To: pgsql-bugs(at)postgresql(dot)org
Subject: plpython: sys module doesn't know about _getframe
Date: 2001-06-03 20:32:15
Message-ID: 200106032032.f53KWFL40251@hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Steven D. Arnold (stevena(at)neosynapse(dot)net) reports a bug with a severity of 3
The lower the number the more severe it is.

Short Description
plpython: sys module doesn't know about _getframe

Long Description
I have a module which I import and use in plpython functions. One function in this module imports sys and then uses sys._getframe(). When it tries to do this, plpython says:

exceptions.AttributeError: 'sys' module has no attribute '_getframe'

The same function using Python directly works fine. Does plpython use a specialized version of Python or a specialized sys module?

Sample Code
create function foo() returns integer as '
import data_handler
result = data_handler.qse("""SELECT * FROM users""")
return 1
' language 'plpython';

[In module data_handler]
import sys
def qse(s, layers=1):
loc = sys._getframe(layers).f_locals
glb = sys._getframe(layers).f_globals
[...]
return s

No file was uploaded with this report

Browse pgsql-bugs by date

  From Date Subject
Next Message pgsql-bugs 2001-06-03 22:17:59 repeated syntax errors in plpython modules cause database to reset
Previous Message J. Michael Caine 2001-06-03 05:05:21 REFERENCES fails on derived classes