[pypy-dev] small problem with return values
tismer at stackless.com
Thu Mar 16 03:00:59 CET 2006
today I stumbled over a tiny problem.
I'm actually not sure how to fix it, so here it is:
When we annotate a function in a way that it does not return
a value, but we happen to use its return value, this case
is not caught early, but very late in backend_optimizations.
An example is here:
See line 77, where we call something that has no return value:
ll_call_destructor(thing) # <<========== if you use return here
# then we crash in backend_optimizations
The ll_call_destructor call is actually mapped this way:
and the rtype function is this:
v_any, = hop.inputargs(hop.args_r)
return hop.genop('gc_unprotect', [v_any], resulttype=lltype.Void)
As you can see, the rtype func returns lltype.Void, nothing.
I think the backend_optimization does a cleanup and removes
the unused return variable from the ll function's graph,
but then it is required because we return this value.
Question: should we silently ignore this case, or raise an exception?
It would need a more exact check that we don't pass variables around
which are really Void.
ciao - chris
Christian Tismer :^) <mailto:tismer at stackless.com>
tismerysoft GmbH : Have a break! Take a ride on Python's
Johannes-Niemeyer-Weg 9A : *Starship* http://starship.python.net/
14109 Berlin : PGP key -> http://wwwkeys.pgp.net/
work +49 30 802 86 56 mobile +49 173 24 18 776 fax +49 30 80 90 57 05
PGP 0x57F3BF04 9064 F4E1 D754 C2FF 1619 305B C09C 5A3B 57F3 BF04
whom do you want to sponsor today? http://www.stackless.com/
More information about the Pypy-dev