| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
Extend the exhaustive package-version tests in t/op/packagev.t
to test each case using package-block syntax in addition to the
package-declaration syntax.
|
|
|
|
|
|
| |
Test that __PACKAGE__ propagates into string eval correctly. Test that
__LINE__ is correct. Test that goto into and out of package blocks
works correctly.
|
|
|
|
|
|
| |
OPs relating to the package name and version were subject to double
freeing during error recovery from an incomplete package block. Fixed by
using the op_latefree mechanism to shift the op free time.
|
|
|
|
|
|
| |
Package block syntax limits the scope of the package declaration to the
attached block. It's cleaner than requiring the declaration to come
inside the block.
|
|\ |
|
| | |
|
| |
| |
| |
| | |
'id -a' doesn't work, so try it without the -a if that fails.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The fix for #23810, 27e904532594b7fb, introduced a regression, spotted by
Nicholas as RT #75146.
Basically, in S_doeval() if the yyparse() fails due to dying (rather than
just bailing out with with a syntax error, say), then the topmost EVAL
context will have been popped. My improved error handling code mostly
understood the difference, but forgot that in the die case, PL_eval_root
will have been restored to its previous value by the CX pop, and thus
its value shouldn't be messed with.
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The function perl_ebcdic_control() is unnecessary, as the toCTRL macro
that calls it can be changed to just map EBCDIC to ASCII first, and then
doing the normal procedure.
This means that EBCDIC and ASCII will no longer diverge. Currently,
EBCIDIC gives a syntax error for inputs outside its domain, whereas the
ASCII version accepts some of them.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
When the replacement is in utf8, there was failure to upgrade the result
when the source and the pattern weren't in utf8. This simply checks
that when there is a match that will lead to the replacement being done.
It then does the upgrade. If this led to changes in the source, we redo
the match because pointers to saved buffers could have changed. There
may be other cases where we don't need to redo the match, but I don't
know the code well-enough to easily figure it out.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
There is special case code in the sprintf implementation, for simple %f and %g
formats, conditionally compiled in only when NVs are doubles. Under long
doubles, these are handled by the general purpose code, which always returns
0 if the argument is missing. Note that sprintf(" %.0g"), ie a leading space,
sufficient to bypass the special case code, would return the string " 0".
The special case code used to return an empty string, meaning that the
behaviour of sprintf("%.0g") and sprintf("%.0f") was inconsistent between a
perl built with doubles, and a perl with long doubles, and the behaviour of
sprintf("%.0g") and sprintf(" %.0g") was inconsistent.
5b98cd54dff3b163 fixed #62874 - the special case code did not warn, but
changed behaviour to return 0. d347ad18ecf3da70 undid the behaviour change,
viewing it as a regression. However, the tests added in 5b98cd54dff3b163
expose the inconsistency in behaviour between doubles and long doubles.
There should be no inconsistency, hence the only logically consistent
conclusion is that the special case implementation was wrong - it cannot
give results inconsistent with the general code. Hence this commit changes
it to return 0 (with a warning). This is achieved by simply skipping the
special case code, if there are insufficient arguments.
|
| |
| |
| |
| | |
octal literal is concatenation".
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The problem is that a dot can come between the braces in \N{foo.bar},
but when searching for it, I didn't stop looking at the right brace, so
it generated an error inappropriately.
This is essentially a minimum patch; efficiency could be improved
slightly with a little more work.
|
| | |
|
| | |
|
| |
| |
| |
| |
| |
| | |
A tied hash lookup could return an overloaded object but sort wouldn't
notice that it was overloaded because it checked for overload before doing
mg_get().
|
| | |
|
| |
| |
| |
| |
| |
| | |
And also from throwing two "Missing argument" warnings for this construct.
This was a regression introduced by 5b98cd54dff3b16344eab33ce6b09fb6fb1b89c2.
|
| | |
|
| |
| |
| |
| |
| |
| | |
their argument
This fixes [RT #62874] : printf does not print a warning when a lone %s conversion is used
|
| |
| |
| |
| |
| |
| |
| | |
This reverts commit 6fb472bab4fadd0ae2ca9624b74596afab4fb8cb.
Zefram asked me to revert this as he's going to be doing something more
pluggable
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
last change"
This reverts commit c4deb7365787eb01845a9d0e371e343169530659.
Zefram asked me to revert this as he's going to be doing something more
pluggable
|
| |
| |
| |
| |
| |
| |
| | |
This reverts commit 1183a10042af0734ee65e252f15bd820b7bbe686.
Zefram asked me to revert this as he's going to be doing something more
pluggable
|
| |
| |
| |
| | |
When localising a tied scalar, don't make the scalar tied
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Fix for RT #7938, #7939: when localising an array or hash, don't make the
new aggregate tied.
The old behaviour of { local @tied; ... } was equivalent to:
{
my $saved = \@tied;
*tied = [];
tied(@tied) = tied(@$saved) # if tied() were an lvalue function
...
*tied = $saved;
}
This patch simply removes the 'tied(@tied) = ...' step
|
|\ \
| | |
| | |
| | |
| | | |
Conflicts:
pp_ctl.c
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Makes the G_KEEPERR logic more consistent, and in particular make it
sensibly handle non-string exceptions. An exception in a destructor
is now always emitted as a warning, and never copied or merged into
$@ of the surrounding context. No more clobbering exceptions being
handled elsewhere, and no more double reporting. This fixes the rest of
[perl #74538].
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
New functions croak_sv(), die_sv(), mess_sv(), and warn_sv(), each act
much like their _sv-less counterparts, but take a single SV argument
instead of sprintf-like format and args. They will accept RVs, passing
them through as such. This means there's no more need to clobber ERRSV
in order to throw a structured exception.
pp_warn() and pp_die() are rewritten to use the _sv interfaces.
This fixes part of [perl #74538]. It also means that a structured
warning object will be passed through to $SIG{__WARN__} instead of
being stringified, thus bringing warn in line with die with respect to
structured exception objects.
The new functions and their existing counterparts are all fully
documented.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Put the exception into $@ last thing before longjmping to the op following
the eval block, where previously it went into $@ before unwinding the
stack. This change means that the exception is not liable to be lost
by $@ being clobbered by destructors, cleanup code, or restoration after
"local $@". The code running immediately after eval can now rely on $@
accurately indicating the exception status of the eval.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Some improvements to the deprecation added in commit
6fb472bab4fadd0ae2ca9624b74596afab4fb8cb:
- warning message includes the word "deprecated"
- warning is in "syntax" category as well as "deprecated"
- more systematic tests
- dot detected more efficiently by incorporation into existing switch
- small doc rewording
- avoid the warning in t/op/taint.t
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This is an indirect fix for
[perl #74484] Regex causing exponential runtime+mem usage
The trie runtime code was doing more SAVETMPS than FREETMPS and was thus
growing a large tmps stack on heavy backtracking. Rather than fixing this
directly, I rewrote part of the trie code so that it no longer needs to
allocate memory in S_regmatch (it still does in find_byclass()).
The basic issue is that multiple branches in the trie may trigger an
accept state; for example:
"abcd" =~ /xyz/abcd.*X|ab.*Y|/
here, words (branches) 2 and 3 are accept states. The original approach
was, at run time, to create a list of accepted word numbers and the
character positions of the end of each of those words. Then run the rest
of the pattern for each word in the list in turn (in word index order).
This requires memory for the list to be allocated and freed.
The new approach involves creating extra info at compile time; in
particular, for each word, a pointer to the previous accepted word (if
any) in the state tree. For example for the above pattern, part of the
state tree may be
q b c d
1 -> 2 -> 3 -> 4 -> 5
(#3) (#2)
(e.g. at state 1, if the next char is 'a', we transition to state 2).
Here, state 3 is an accept state with word #3, and 5 is an accept state
with word #2. So we build a table indexed by word number, which has
wordinfo[2] = 3, wordinfo[3] = 0, thus building the word chain 2->3->0.
At run time we run the trie to completion, and remember the word
associated with the longest accept state (word #2 above). Then by following
back the chain of .prev fields, we can produce a list of all accepting
words. We then iteratively find the smallest-numbered (ie LH-most) word in
the chain, and run with it. On failure and backtrack, we find the
next-smallest and so on.
Since we are no longer recording the end-position of each word in the
string, we have to recalculate this for each backtrack. We initially
record the end-position of the shortest accepting word, and given that we
know the length of each word, we can calculate the new position each time
as an offset from that first word. Depending on unicode and folding, that
calculation can be cheap or expensive.
This algorithm is optimised for the typical case where there are a small
number (<= 2) accepting states.
This patch creates a new compile-time array, trie->wordinfo[], indexed by
word number, which contains relevant info about each word. This also
supersedes the old trie->newword[] array, whose function of recording
"overspills" of multiple words per accept state, is now handled as part of
the wordinfo[].prev chain.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
split() would crash because the third item on the stack wasn't the
regular expression it expected. unpack("%2H", ...) would return both
the unpacked result and the checksum on the stack, similarly for
unpack("%2u", ...).
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
If a symbol table entry is undefined when a glob is assigned into it, it
gets a FAKE flag which makes it possible to be downgraded when non-glob
is subsequently assigned into it. It doesn't really matter, until we
decide to localize it -- it wouldn't be possible to restore its GP upon
context return if it changed type, therefore we must not do that.
This patch turns off FAKE flag when localizing a GV and restores it when
the context is left. A test case is included.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
make regen is needed
This patch forbids non-ascii following the "\c". It also terminates for
"\c{" with a message to contact p5p if there is need for continuing its
current definition. And if the character following the "\c" causes the
result to not be a control character, a warning is issued. This is
currently 'deprecated', which by default is turned on. This can easily
be changed later.
This patch is the initial patch. It does not do any fancy showing the
context where the problematic construct occurs. This can be added
later.
It gathers the 3 occurrences of evaluating \c and puts them in one
common routine.
|
| | | |
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
The fix 2d961f6deff7 for RT #5475 included a mechanism for the early
calling of get magic on something like
$tied[0];
so that even though the element is used in void context, we still call
FETCH. Some people seem to rely on this.
However, the call to mg_get() didn't distinguish between a tiedelem
member retrieved from a tied array/hash, and a tiedscalar element
retrieved from a plain array/hash. In the latter case, the S_GSKIP
protection mechanism doesn't apply and a simple $foo = $h{tiedelem}
generated two calls to FETCH.
Fix this by only calling mg_get() on the element if it came from a *tied*
array/hash.
A side-effect of this fix is that the following no longer calls FETCH:
my @plain_array;
tie $plain_array[0], ....; # element 0 is now a tied scalar
$plain_array[0]; # void context: no longer calls FETCH.
This required one test in op/tie.t to be fixed up, but in general I think
this is a reasonable compromise.
|
| | |
| | |
| | |
| | |
| | | |
It seems that Dylan Reference Book has been relocated, so included is
the small patch for the vulcan_* test files with the new link.
|
| | | |
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | | |
So any fudging in the timing needs to be at least 1 second to have any
effect. Upped the total $sleep value to 4 (on Windows) to make sure at
least 3 seconds have passed. Amends commit 0ebb4f0.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This solves bug: [perl #74572] chop dies with error about schop
This is not backwards-compatible, as some error messages can change,
as seen by the required change to t/op/sprintf2.t.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
sleep() time on Win32 may be rounded down to multiple of
the clock tick interval.
http://www.nntp.perl.org/group/perl.perl5.porters/2010/03/msg157878.html
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
The original fix for tied elements losing magic had a bug that was masked
by a bool casting issue. Once the casting was fixed, the bug surfaced:
elements of @+ lost their values when returned from a sub. By removing the
TEMP flag from the regdatum PVLV, we force it to be copied when returned.
|
|/ /
| |
| |
| |
| | |
Also add leak_expr function to svleak.t to test an expression for leakage
rather than a whole sub
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
With the move of PERL_ASYNC_CHECK() out from the runloop to control ops,
infinite loops became truely infinite, as their optree has no control ops.
Hence add a PERL_ASYNC_CHECK() to pp_unstack to ensure signals will be
dispatched.
Bug noticed by Jerry Hedden.
|
| |
| |
| |
| |
| |
| | |
Fix location identified by Father Chrysostomos, who also offered a patch, but
this patch is more efficient, as it avoids any allocation. Test code based on
his test example.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Ever since perl 4.000 we've only set the POSIX process name via
argv[0]. Unfortunately on Linux the POSIX name isn't used by utilities
like top(1), ps(1) and killall(1).
Now when we set C<$0 = "hello"> both C<qx[ps h $$]> (POSIX) and
C<qx[ps hc $$]> (legacy) will say "hello", instead of the latter being
"perl" as was previously the case.
See also the March 9 2010 thread "Why doesn't assignment to $0 on
Linux also call prctl()?" on perl5-porters.
|
| |
| |
| |
| |
| | |
fixing a bool cast bug exposes a hidden bug in @+ scope.
Mark as TODO for now.
|