This is a live mirror of the Perl 5 development currently hosted at
https://github.com/perl/perl5
https://perl5.git.perl.org
/
perl5.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix a bug in handling $+[0] and unicode
[perl5.git]
/
universal.c
diff --git
a/universal.c
b/universal.c
index
463651b
..
cb49e0b
100644
(file)
--- a/
universal.c
+++ b/
universal.c
@@
-164,6
+164,8
@@
Perl_sv_derived_from_pvn(pTHX_ SV *sv, const char *const name, const STRLEN len,
}
else {
stash = gv_stashsv(sv, 0);
}
else {
stash = gv_stashsv(sv, 0);
+ if (!stash)
+ stash = gv_stashpv("UNIVERSAL", 0);
}
return stash ? isa_lookup(stash, name, len, flags) : FALSE;
}
return stash ? isa_lookup(stash, name, len, flags) : FALSE;
@@
-196,8
+198,7
@@
Perl_sv_does_sv(pTHX_ SV *sv, SV *namesv, U32 flags)
SvGETMAGIC(sv);
SvGETMAGIC(sv);
- if (!SvOK(sv) || !(SvROK(sv) || (SvPOK(sv) && SvCUR(sv))
- || (SvGMAGICAL(sv) && SvPOKp(sv) && SvCUR(sv)))) {
+ if (!SvOK(sv) || !(SvROK(sv) || (SvPOK(sv) && SvCUR(sv)))) {
LEAVE;
return FALSE;
}
LEAVE;
return FALSE;
}
@@
-332,8
+333,7
@@
XS(XS_UNIVERSAL_isa)
SvGETMAGIC(sv);
SvGETMAGIC(sv);
- if (!SvOK(sv) || !(SvROK(sv) || (SvPOK(sv) && SvCUR(sv))
- || (SvGMAGICAL(sv) && SvPOKp(sv) && SvCUR(sv))))
+ if (!SvOK(sv) || !(SvROK(sv) || (SvPOK(sv) && SvCUR(sv))))
XSRETURN_UNDEF;
ST(0) = boolSV(sv_derived_from_sv(sv, ST(1), 0));
XSRETURN_UNDEF;
ST(0) = boolSV(sv_derived_from_sv(sv, ST(1), 0));
@@
-356,8
+356,8
@@
XS(XS_UNIVERSAL_can)
SvGETMAGIC(sv);
SvGETMAGIC(sv);
- if (!SvOK(sv) || !(SvROK(sv) || (SvPOK(sv) && SvCUR(sv))
-
|| (SvGMAGICAL(sv) && SvPOKp(sv) && SvCUR(sv))
))
+ if (!SvOK(sv) || !(SvROK(sv) ||
SvNIOK(sv) ||
(SvPOK(sv) && SvCUR(sv))
+ ))
XSRETURN_UNDEF;
rv = &PL_sv_undef;
XSRETURN_UNDEF;
rv = &PL_sv_undef;
@@
-369,6
+369,8
@@
XS(XS_UNIVERSAL_can)
}
else {
pkg = gv_stashsv(sv, 0);
}
else {
pkg = gv_stashsv(sv, 0);
+ if (!pkg)
+ pkg = gv_stashpv("UNIVERSAL", 0);
}
if (pkg) {
}
if (pkg) {
@@
-652,7
+654,13
@@
XS(XS_version_boolean)
SP -= items;
if (sv_isobject(ST(0)) && sv_derived_from(ST(0), "version")) {
SV * const lobj = SvRV(ST(0));
SP -= items;
if (sv_isobject(ST(0)) && sv_derived_from(ST(0), "version")) {
SV * const lobj = SvRV(ST(0));
- SV * const rs = newSViv( vcmp(lobj,new_version(newSVpvs("0"))) );
+ SV * const rs =
+ newSViv( vcmp(lobj,
+ sv_2mortal(new_version(
+ sv_2mortal(newSVpvs("0"))
+ ))
+ )
+ );
mPUSHs(rs);
PUTBACK;
return;
mPUSHs(rs);
PUTBACK;
return;
@@
-1413,9
+1421,6
@@
Perl_boot_core_UNIVERSAL(pTHX)
newXS_flags(xsub->name, xsub->xsub, file, xsub->proto, 0);
} while (++xsub < end);
newXS_flags(xsub->name, xsub->xsub, file, xsub->proto, 0);
} while (++xsub < end);
- /* register the overloading (type 'A') magic */
- PL_amagic_generation++;
-
/* Providing a Regexp::DESTROY fixes #21347. See test in t/op/ref.t */
{
CV * const cv =
/* Providing a Regexp::DESTROY fixes #21347. See test in t/op/ref.t */
{
CV * const cv =
@@
-1430,8
+1435,8
@@
Perl_boot_core_UNIVERSAL(pTHX)
* Local variables:
* c-indentation-style: bsd
* c-basic-offset: 4
* Local variables:
* c-indentation-style: bsd
* c-basic-offset: 4
- * indent-tabs-mode:
t
+ * indent-tabs-mode:
nil
* End:
*
* End:
*
- * ex: set ts=8 sts=4 sw=4
no
et:
+ * ex: set ts=8 sts=4 sw=4 et:
*/
*/