| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit moves attribute handling in newATTRSUB so that it happens
after the op tree is attached to the sub. So when the sub is freed,
the op tree goes with it, instead af leaking when an attribute han-
dler dies.
Witness what happens without that:
$ PERL_DESTRUCT_LEVEL=2 ./perl -Ilib -le 'BEGIN {$^H{a}="b"}; sub foo:bar{1}'
Invalid CODE attribute: bar at -e line 1
BEGIN failed--compilation aborted at -e line 1.
Unbalanced string table refcount: (1) for "a" at (null) line 1 during global destruction.
It was the ‘Unbalanced string table’ warnings that alerted me to the
problem. The fairly new t/uni/attrs.t happens to trigger this bug.
Not that this told me anything, but I did a binary search which lead
me to this commit:
commit b3ca2e834c3607fd8aa8736a51aa3a2b8bba1044
Author: Nicholas Clark <nick@ccl4.org>
Date: Fri Mar 31 13:45:57 2006 +0000
Serialise changes to %^H onto the current COP. Return the compile time
state of %^H as an eleventh value from caller. This allows users to
write pragmas.
That commit started indirectly storing HEKs in cops (in the hints
hash), which means we have an easy way to tell when ops are leaking.
|
| |
|
|
|
|
|
|
|
|
| |
This is something that ‘sub foo :lvalue;’ declarations do. This brings
attributes.pm in line with them.
See commits fff96ff and 885ef6f, ticket #68758, and
<364E1F98-FDCC-49A7-BADB-BD844626B8AE@cpan.org>.
|
|
|
|
|
| |
attributes::get was being called before attributes.pm was loaded.
Why this did not warn before I know not. Maybe that’s another bug....
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This script works in 5.6.x:
#!perl -l
sub MODIFY_SCALAR_ATTRIBUTES { return } # need these
sub MODIFY_ARRAY_ATTRIBUTES { return } # for it to
sub MODIFY_HASH_ATTRIBUTES { return } # compile
my ($x,@y,%z) : Bent = 72; # based on example from attributes.pm’s pod
print $x;
print "ok";
$ pbpaste|perl5.6.2
72
ok
(pbpaste is a Mac command that outputs the clipboard contents.)
In 5.8.0 to 5.8.8:
$ pbpaste|perl5.8.1
ok
So the assignment never happens. And with warnings:
$ pbpaste|perl5.8.1 -w
Bizarre copy of ARRAY in aassign at - line 5.
In 5.8.9 it gets slightly worse:
$ pbpaste|perl5.8.9
Bizarre copy of ARRAY in aassign at - line 5.
So warnings are not required to trigger the error. If my ($x,@y,%z)
is changed to my($x,$y), there is no error, but the assignment
doesn’t happen.
This was broken in 5.8.0 by this change:
commit 95f0a2f1ffc68ef908768ec5d39e4102afd28c1e
Author: Spider Boardman <spider@orb.nashua.nh.us>
Date: Sat Dec 8 19:09:23 2001 -0500
Re: attributes are broken
Message-Id: <200112090509.AAA02053@Orb.Nashua.NH.US>
p4raw-id: //depot/perl@13543
(Is there a ‘hereby’ missing from that subject? :-)
Oddly enough, that was the commit that put the attribute and list
assignment example in attribute.pm’s pod.
This change caused the bizarre assignment error to occur more often in
5.8.9 and 5.10.0, but I don’t think it’s actually relevant (just try-
ng to see how long I can get this commit message):
commit f17e6c41cacfbc6fe88a5ea5e01ba690dfdc7f2e
Author: Rafael Garcia-Suarez <rgarciasuarez@gmail.com>
Date: Wed Jul 5 20:00:10 2006 +0000
Fix a bug on setting OPpASSIGN_COMMON on a AASSIGN op when the left
side is made out a list declared with our(). In this case OPpLVAL_INTRO
isn't set on the left op, so we just remove that check. Add new tests.
p4raw-id: //depot/perl@28488
What’s happening is that there is an extra pushmark in the list when
attributes are present:
$ perl5.14.0 -MO=Concise -e 'my ($a,@b):foo'
o <@> leave[1 ref] vKP/REFC ->(end)
1 <0> enter ->2
2 <;> nextstate(main 39 -e:1) v:{ ->3
n <@> list vKPM/128 ->o
3 <0> pushmark vM/128 ->4
4 <0> padsv[$a:39,40] vM/LVINTRO ->5
5 <0> padav[@b:39,40] vM/LVINTRO ->6
6 <0> pushmark v ->7 <------- right here
e <1> entersub[t3] vKS*/NOMOD,TARG ->f
7 <0> pushmark s ->8
8 <$> const[PV "attributes"] sM ->9
9 <$> const[PV "main"] sM ->a
b <1> srefgen sKM/1 ->c
- <1> ex-list lKRM ->b
a <0> padsv[$a:39,40] sRM ->b
c <$> const[PV "foo"] sM ->d
d <$> method_named[PV "import"] ->e
m <1> entersub[t4] vKS*/NOMOD,TARG ->n
f <0> pushmark s ->g
g <$> const[PV "attributes"] sM ->h
h <$> const[PV "main"] sM ->i
j <1> srefgen sKM/1 ->k
- <1> ex-list lKRM ->j
i <0> padsv[@b:39,40] sRM ->j
k <$> const[PV "foo"] sM ->l
l <$> method_named[PV "import"] ->m
-e syntax OK
That leaves an extra mark that confuses pp_aassign, which doesn’t know
what it’s supposed to be reading and what it’s supposed to be assign-
ing to (hence the bizarre copy).
The pushmark is the result of the concatenation of two lists, the sec-
ond one beginning with a pushmark (as listops do by default). The con-
catenation occurs in Perl_my_attrs, at this spot (in the ‘else’):
if (rops) {
if (maybe_scalar && o->op_type == OP_PADSV) {
o = scalar(op_append_list(OP_LIST, rops, o));
o->op_private |= OPpLVAL_INTRO;
}
else
o = op_append_list(OP_LIST, o, rops);
}
So this commit make that ‘else’ clause check for a pushmark and oblit-
erate it if present, before concatenating the lists.
|
| |
|
|
|
|
|
|
|
| |
# New Ticket Created by (Peter J. Acklam)
# Please include the string: [perl #81916]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=81916 >
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is for two reasons:
• In S_my_kid, the attribute-handling code comes before the code that
marks the padop as being a state instead of a my, which it knows to
do based on the value of PL_parser->in_my. The attribute-handling
code begins by setting PL_parser->in_my to FALSE, preventing the
code that follows from doing its job.
So now PL_parser->in_my is read at the top of S_my_kid, before the
attribute code, with the statehood recorded in a boolean. Then the
code that marks the padop as being state checks that boolean
instead of in_my.
• A lexical variable declaration that has an attribute and is assigned
to in the same expression compiles to something similar to:
(attributes->import(... \$x ...), my $x) = 3;
where the list is actually in scalar context, returning the my $x
which is then assigned to (something that cannot be expressed
directly in Perl syntax). So Perl_ck_sassign needs to take that list
op into account when creating the ‘once’ op that actually makes
state assignment work. Up till now it was just looking for a padsv
on its LHS. This commit makes it check also for a list op whose last
item is a padsv.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When a closure is created, the original sub is cloned (except that the
op tree is shared). That original sub (called the closure prototype)
is not usually accessible to perl.
An attribute handler (MODIFY_CODE_ATTRIBUTES) is passed a reference
to it, however. If that code reference is called within the attribute
handler, an ‘Undefined subroutine called’ error results, because the
op tree has not been attached yet.
If that code reference is stashed away and called after the attribute
handler returns, it will most likely crash.
This is because its pad is full of nulls.
A regular $proto->() or &$proto() call that sets up @_ will crash in
attempting to do so.
A &$proto call will bypass that, but attempting to read any lexical
variables from the containing scope will cause a crash. Any operator
that uses TARG (i.e., most of them) will crash.
So this commit puts a check for closure prototypes in pp_entersub. It
produces a new error message, ‘Closure prototype called’.
This does introduce a backward-incompatible change: code like this
used to work:
sub MODIFY_CODE_ATTRIBUTES { $'proto = $_[1] }
{ my $x; () = sub :attr { () = $x; print "hello\n" } }
&$'proto;
But writing a useful subroutine that tiptoes past the crashes is so
difficult that I think this breakage is acceptable.
|
|
|
|
|
| |
Previously it interpreted := as an empty attribute list, and issued a
deprecation warning. This change permits := to be used as a binding operator.
|
|
|
|
|
|
|
|
| |
Include <label> in productions before <decl> and <package_block>. This
means that labels can now appear at the beginning of all statement-like
things. There was no technical reason for the restriction of labels
to substantive statements, and that restriction in any case couldn't be
applied to PLUGSTMT-based plugged-in declarations.
|
| |
|
|
|
|
| |
about it. Fixes part of [perl #68758].
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Attribute handlers being applied to a temporary CV has actually been
reported as a bug, #66970. The attached patch fixes the bug, by
changing the order in which things happen: attributes are now applied
after the temporary CV has been merged into the existing CV or has
otherwise been added to the appropriate GV.
The change breaks part of Attribute::Handlers. Part of A:H searches the
package to find the name of the sub to which a :ATTR attribute is being
applied, and the correct time at which to launch that search depends
crucially on the order in which the CV construction events occur. So
this patch also includes a change to A:H, to make it detect which way
things happen. The resulting A:H works either way, which is essential
for its dual-life nature.
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
| |
Message-ID: <20080628160017.GA81579@osiris.mauzo.dyndns.org>
p4raw-id: //depot/perl@34092
|
|
|
| |
p4raw-id: //depot/perl@31333
|
|
|
|
|
| |
documented in perldiag.
p4raw-id: //depot/perl@29330
|
|
|
|
|
| |
by Jerry D. Hedden
p4raw-id: //depot/perl@28761
|
|
|
|
|
|
| |
From: Salvador "FandiXXo" (via RT) <perlbug-followup@perl.org>
Message-ID: <rt-3.0.11-36297-115797.8.75971493113916@perl.org>
p4raw-id: //depot/perl@24851
|
|
|
| |
p4raw-id: //depot/perl@23827
|
|
|
| |
p4raw-id: //depot/perl@23747
|
|
|
|
|
| |
Fix bug where 'assertion' was always rejected as invalid.
p4raw-id: //depot/perl@23744
|
|
|
|
|
| |
attributes manpage.
p4raw-id: //depot/perl@17705
|
|
|
| |
p4raw-id: //depot/perl@17704
|
|
|
|
|
| |
Message-id: <20020802234421.11c62fe6.rgarciasuarez@free.fr>
p4raw-id: //depot/perl@17699
|
|
|
|
|
| |
Message-Id: <200203290552.AAA47443@leggy.zk3.dec.com>
p4raw-id: //depot/perl@15592
|
|
|
|
|
| |
Message-Id: <200203280152.UAA415562@leggy.zk3.dec.com>
p4raw-id: //depot/perl@15565
|
|
|
|
|
| |
Message-Id: <200112090509.AAA02053@Orb.Nashua.NH.US>
p4raw-id: //depot/perl@13543
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Date: Sat, 10 Feb 2001 14:04:40 -0800 (PST)
Message-ID: <Pine.LNX.4.21.0102101356000.15298-100000@mako.covalent.net>
Subject: Re: [patch] GvSHARED
From: Doug MacEachern <dougm@covalent.net>
Date: Sat, 10 Feb 2001 15:00:54 -0800 (PST)
Message-ID: <Pine.LNX.4.21.0102101453220.15298-100000@mako.covalent.net>
Subject: [patch] attributes.pm support for `shared'
From: Doug MacEachern <dougm@covalent.net>
Date: Sat, 10 Feb 2001 20:08:48 -0800 (PST)
Message-ID: <Pine.LNX.4.21.0102102004190.15298-100000@mako.covalent.net>
our() attributes were ignored, our :shared pieces missing,
allow attributes.pm to turn on shared.
p4raw-id: //depot/perl@8766
|
|
|
|
|
| |
Message-ID: <20001224040949.B3090@darkstar>
p4raw-id: //depot/perl@8236
|
|
|
|
|
|
|
|
| |
so that we simply can't pick up stuff from other Perls than
the one we are testing. Pointed out by
Subject: Re: [PATCH: 6757] make new Storable tests forgiving of places where not built
Message-Id: <E13SKH1-00031D-00@virgo.cus.cam.ac.uk>
p4raw-id: //depot/perl@6874
|
|
|
|
|
| |
and C<my $foo : a : b : c> are all valid (from Spider Boardman)
p4raw-id: //depot/perl@4907
|
|
To: Mailing list Perl5 <perl5-porters@perl.org>
Message-Id: <199908290702.DAA32191@Orb.Nashua.NH.US>
p4raw-id: //depot/cfgperl@4043
|