New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
perl_eval_{sv,pv} does not trap syntax errors #2380
Comments
From @gisleCreated by gisle@aas.noI have this application (actually Python) that embeds perl and calls This is a little example program showing this behaviour: --------------------------------------------------------- int main(int argc, char**argv, char**env) perl_eval_pv("sub { ", TRUE); if (SvTRUE(ERRSV)) printf("done\n"); /* This program prints: $ ./a.out instead of something with "syntax error in (eval 1)". Perl Info
|
From @gannett-ggreerOn Wed Aug 16 05:18:16 2000, gaas wrote:
My embed-fu is weak, but it appears to be a simple fix. http://m-l.org/~perl/misc/0001-Fix-for-perl-3719-Preserve-for-perl_eval_pv-while-em.patch http://github.com/greerga/perl/commit/8ba06c38ccf1582a01143760851f9396c16b78f5 or attached. -- |
From @gannett-ggreer0001-Fix-for-perl-3719-Preserve-for-perl_eval_pv-while-em.patchFrom 8ba06c38ccf1582a01143760851f9396c16b78f5 Mon Sep 17 00:00:00 2001
From: George Greer <perl@greerga.m-l.org>
Date: Sun, 25 Jul 2010 21:08:40 -0400
Subject: [PATCH] Fix for [perl #3719]: Preserve $@ for perl_eval_pv() while embedding.
Perl_eval_pv() wraps around Perl_eval_sv() but Perl_eval_sv() throws
away the error before Perl_eval_pv() can see it.
---
perl.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/perl.c b/perl.c
index d52d79f..13076b1 100644
--- a/perl.c
+++ b/perl.c
@@ -2765,7 +2765,7 @@ Perl_eval_pv(pTHX_ const char *p, I32 croak_on_error)
PERL_ARGS_ASSERT_EVAL_PV;
- eval_sv(sv, G_SCALAR);
+ eval_sv(sv, G_SCALAR | G_KEEPERR);
SvREFCNT_dec(sv);
SPAGAIN;
--
1.7.0.4
|
From @cpansproutOn Sun Jul 25 18:18:26 2010, greerga wrote:
So is mine.
http://github.com/greerga/perl/commit/8ba06c38ccf1582a01143760851f9396c16b78f5
Is anyone else able to review this? |
From @LeontOn Mon, Jul 26, 2010 at 3:18 AM, George Greer via RT
Disclaimer: I have embed-fu, but not so much internals-fu. The G_KEEPERR flag seems to affect eval in at least 3 places I suspect this patch has a wider impact than intended. I don't really Also, the fact that this G_KEEPERR behavior of eval_sv is not Leon |
From @iabynOn Mon, Sep 27, 2010 at 12:44:16AM +0200, Leon Timmermans wrote:
The patch is wrong, unfortunately. It only "works" in some circumstances In particular: under the original fix, if $@ wasn't null when calling I've fixed the original bug with commit and fixed the G_KEEPERR issue with
I've fixed that with -- |
@iabyn - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#3719 (status was 'resolved')
Searchable as RT3719$
The text was updated successfully, but these errors were encountered: