Hi!

I'm trying to compile one of my python applications using "translate.py".
Because the application needs access to postgreSQL, it's using pypq. The application runs fine in python, and pypy as well. Using the error messages from translate.py, I made a lot of changes to my program to make it as much RPython as I can make it.

But even after changing the code many, many times, I never get past the following error message. It's from pypq and I'm not sure what command in my application triggers the error, but by looking at the pypq source, I assume it's from a pypq-"commit" command.

My questions are:
- Is it even possible to use pypq in RPython?
- If not, is there any other postgreSQL adapter that works?
- Is there example-code for connecting to a database in RPython?
- Is it possible to find the command in my application that triggered the error?

Thanks!

This is the error message:
[translation:ERROR] Error:
[translation:ERROR]  Traceback (most recent call last):
[translation:ERROR] File "/opt/pypy_source/pypy/translator/goal/translate.py", line 303, in main
[translation:ERROR]     drv.proceed(goals)
[translation:ERROR] File "/opt/pypy_source/pypy/translator/driver.py", line 771, in proceed [translation:ERROR] return self._execute(goals, task_skip = self._maybe_skip()) [translation:ERROR] File "/opt/pypy_source/pypy/translator/tool/taskengine.py", line 116, in _execute
[translation:ERROR]     res = self._do(goal, taskcallable, *args, **kwds)
[translation:ERROR] File "/opt/pypy_source/pypy/translator/driver.py", line 283, in _do
[translation:ERROR]     res = func()
[translation:ERROR] File "/opt/pypy_source/pypy/translator/driver.py", line 319, in task_annotate [translation:ERROR] s = annotator.build_types(self.entry_point, self.inputtypes) [translation:ERROR] File "/opt/pypy_source/pypy/annotation/annrpython.py", line 89, in build_types [translation:ERROR] return self.build_graph_types(flowgraph, inputcells, complete_now=complete_now) [translation:ERROR] File "/opt/pypy_source/pypy/annotation/annrpython.py", line 142, in build_graph_types
[translation:ERROR]     self.complete()
[translation:ERROR] File "/opt/pypy_source/pypy/annotation/annrpython.py", line 195, in complete
[translation:ERROR]     self.processblock(graph, block)
[translation:ERROR] File "/opt/pypy_source/pypy/annotation/annrpython.py", line 340, in processblock
[translation:ERROR]     self.flowin(graph, block)
[translation:ERROR] File "/opt/pypy_source/pypy/annotation/annrpython.py", line 399, in flowin
[translation:ERROR]     self.consider_op(block, i)
[translation:ERROR] File "/opt/pypy_source/pypy/annotation/annrpython.py", line 577, in consider_op
[translation:ERROR]     argcells = [self.binding(a) for a in op.args]
[translation:ERROR] File "/opt/pypy_source/pypy/annotation/annrpython.py", line 238, in binding
[translation:ERROR]     return self.bookkeeper.immutableconstant(arg)
[translation:ERROR] File "/opt/pypy_source/pypy/annotation/bookkeeper.py", line 314, in immutableconstant
[translation:ERROR]     return self.immutablevalue(const.value)
[translation:ERROR] File "/opt/pypy_source/pypy/annotation/bookkeeper.py", line 461, in immutablevalue
[translation:ERROR]     result = SomePBC([self.getdesc(x)])
[translation:ERROR] File "/opt/pypy_source/pypy/annotation/bookkeeper.py", line 535, in getdesc
[translation:ERROR]     raise Exception("%s: %r" % (msg, pyobj))
[translation:ERROR] Exception: object with a __call__ is not RPython: <_ctypes.function.CFuncPtrFast object at 0x000000001f11b6a0>
[translation:ERROR] Processing block:
[translation:ERROR] block@9 is a <class 'pypy.objspace.flow.flowcontext.SpamBlock'> [translation:ERROR] in (pypq.connection:68)Connection._get_transaction_status
[translation:ERROR]  containing the following operations:
[translation:ERROR]        v0 = getattr(self_0, ('_db'))
[translation:ERROR] v1 = simple_call((CFuncPtrFast PQtransactionStatus), v0)
[translation:ERROR]  --end--
[translation] start debugger...
> /opt/pypy_source/pypy/annotation/bookkeeper.py(535)getdesc()
-> raise Exception("%s: %r" % (msg, pyobj))


My program is structured like this in respect to database access:

database_connection=pypq.connect('connect_string')

def foo():
 dbc=database_connection.cursor()
 dbc.execute('SELECT what,val FROM some_table')
 some_dict={}
 for w,v in dbc.fetchall(): some_dict[w]=v
 dbc.close()
 return some_dict

def maincode(args):
 Some code, which call foo, among other functions.

def target(driver,args):
 return maincode,None
_______________________________________________
pypy-dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-dev

Reply via email to