| Lorenz Minder on Thu, 14 May 2009 04:17:58 +0200 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
| Broken exception handling in gp_read_str() |
Hi,
I can't seem to catch errors of gp_read_str() with the TRY / CATCH
mechanism anymore. I don't know when this broke, but it worked in PARI
2.4.2 and earlier.
Example:
#include <stdio.h>
#include <pari/pari.h>
int main(void)
{
const size_t parisize = 8 * 1024 * 1024;
const ulong maxprime = 500000;
const ulong init_opts = INIT_JMPm | INIT_DFTm;
pari_init_opts(parisize, maxprime, init_opts);
GEN g = 0;
CATCH(CATCH_ALL) {
printf("Caught, very well.\n");
} TRY {
g = gp_read_str("2**13"); /* Note: 2**13 is a gp syntax
error */
} ENDCATCH
printf("Survived. g = %p\n", g);
return 0;
}
I would expect this to print "Caught, very well." and then "Survived. g
= (nil)", and then exit normally. With the code in SVN it gives an
error message and terminates my program instead:
*** syntax error, unexpected '*': 2**13
*** ^---
*** Error in the PARI system. End of program.
After which I'm back to the shell. Have the semantics of gp_read_str()
changed?
Best,
--Lorenz
--
Neu: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate + Telefonanschluss für nur 17,95 Euro/mtl.!* http://dslspecial.gmx.de/freedsl-surfflat/?ac=OM.AD.PD003K11308T4569a