plpython: sys module doesn't know about _getframe

Поиск
Список
Период
Сортировка
От pgsql-bugs@postgresql.org
Тема plpython: sys module doesn't know about _getframe
Дата
Msg-id 200106032032.f53KWFL40251@hub.org
обсуждение исходный текст
Список pgsql-bugs
Steven D. Arnold (stevena@neosynapse.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
sysmodule? 

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

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Trigger causes the server to crash with SEGV
Следующее
От: pgsql-bugs@postgresql.org
Дата:
Сообщение: repeated syntax errors in plpython modules cause database to reset