summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2014-12-19 16:20:42 -0800
committerFather Chrysostomos <sprout@cpan.org>2014-12-19 16:30:40 -0800
commit7b46bf4c9fea9c8ec5466c74e7b96886d1a4f1da (patch)
treedf896705b9b1a0c35dea8fa4220f3005f1d90f9b
parentb1dcc8e278f8fb24401a718bd5acc1b867192967 (diff)
downloadperl-7b46bf4c9fea9c8ec5466c74e7b96886d1a4f1da.tar.gz
[perl #123458] list cx re::regexp_pattern($nonre)
It was returning (undef) in list context, though it was documented to return the empty list.
-rw-r--r--ext/re/t/re_funcs_u.t1
-rw-r--r--universal.c2
2 files changed, 2 insertions, 1 deletions
diff --git a/ext/re/t/re_funcs_u.t b/ext/re/t/re_funcs_u.t
index 706437ec18..770b456ca6 100644
--- a/ext/re/t/re_funcs_u.t
+++ b/ext/re/t/re_funcs_u.t
@@ -33,6 +33,7 @@ use re qw(is_regexp regexp_pattern
is(regexp_pattern($rx),'(?^upi:foo)', 'scalar regexp_pattern (bare REGEXP)');
ok(!regexp_pattern(''),'!regexp_pattern("")');
+ is +()=regexp_pattern(''), 0, 'regexp_pattern("") in list cx';
}
if ('1234'=~/(?:(?<A>\d)|(?<C>!))(?<B>\d)(?<A>\d)(?<B>\d)/){
diff --git a/universal.c b/universal.c
index 2b334ea116..5d78fd6327 100644
--- a/universal.c
+++ b/universal.c
@@ -980,7 +980,7 @@ XS(XS_re_regexp_pattern)
/* It ain't a regexp folks */
if ( gimme == G_ARRAY ) {
/* return the empty list */
- XSRETURN_UNDEF;
+ XSRETURN_EMPTY;
} else {
/* Because of the (?:..) wrapping involved in a
stringified pattern it is impossible to get a