This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perldelta: Blanket entry for memory leaks
[perl5.git] / pod / perldelta.pod
index 59f4e4a..9f0d1ab 100644 (file)
@@ -5,15 +5,15 @@
 [ this is a template for a new perldelta file.  Any text flagged as XXX needs
 to be processed before release. ]
 
-perldelta - what is new for perl v5.17.3
+perldelta - what is new for perl v5.17.7
 
 =head1 DESCRIPTION
 
-This document describes differences between the 5.17.2 release and the 5.17.3
+This document describes differences between the 5.17.6 release and the 5.17.7
 release.
 
-If you are upgrading from an earlier release such as 5.17.1, first read
-L<perl5172delta>, which describes differences between 5.17.1 and 5.17.2.
+If you are upgrading from an earlier release such as 5.17.5, first read
+L<perl5176delta>, which describes differences between 5.17.5 and 5.17.6.
 
 =head1 Notice
 
@@ -27,13 +27,6 @@ here, but most should go in the L</Performance Enhancements> section.
 
 [ List each enhancement as a =head2 entry ]
 
-=head2 Computed Labels
-
-The loop controls C<next>, C<last> and C<redo>, and the special C<dump>
-operator, now allow arbitrary expressions to be used to compute labels at
-run time.  Previously, any argument that was not a constant was treated as
-the empty string.
-
 =head1 Security
 
 XXX Any security-related notices go here.  In particular, any security
@@ -44,28 +37,24 @@ L</Selected Bug Fixes> section.
 
 =head1 Incompatible Changes
 
-[ List each incompatible change as a =head2 entry ]
+=head2 readline() with C<$/ = \N> now reads N characters, not N bytes
 
-=head2 C<$ENV{foo}=undef> deletes value from environ, like C<delete $ENV{foo}>
+Previously, when reading from a stream with I/O layers such as
+C<encoding>, the readline() function, otherwise known as the C<< <> >>
+operator, would read I<N> bytes from the top-most layer. [perl #79960]
 
-This facilitates use of C<local()> with C<%ENV> entries.  In previous
-versions of Perl, C<undef> was converted to the empty string.
+Now, I<N> characters are read instead.
 
-=head2 Defined values stored in environment are forced to byte strings
+There is no change in behaviour when reading from streams with no
+extra layers, since bytes map exactly to characters.
 
-A value stored in an environment variable has always been stringified.  In
-this release, it is converted to be only a byte string.  First, it is forced
-to be a only a string.  Then if the string is utf8 and the equivalent of
-C<utf8::downgrade()> works, that result is used; otherwise, the equivalent of
-C<utf8::encode()> is used, and a warning is issued about wide characters
-(L</Diagnostics>).
+XXX For a release on a stable branch, this section aspires to be:
 
-=head2 C<given> now aliases the global C<$_>
+    There are no changes intentionally incompatible with 5.XXX.XXX
+    If any exist, they are bugs, and we request that you submit a
+    report.  See L</Reporting Bugs> below.
 
-Instead of assigning to an implicit lexical C<$_>, C<given> now makes the
-global C<$_> an alias for its argument, just like C<foreach>.  However, it
-still uses lexical C<$_> if there is lexical C<$_> in scope (again, just like
-C<foreach>).
+[ List each incompatible change as a =head2 entry ]
 
 =head1 Deprecations
 
@@ -75,6 +64,41 @@ an updated module in the L</Modules and Pragmata> section.
 
 [ List each deprecation as a =head2 entry ]
 
+=head2 Various XS-callable functions are now deprecated
+
+The following functions will be removed from a future version of Perl,
+and should not be used.  With participating C compilers (e.g., gcc),
+compiling any file that uses any of these will generate a warning.
+These were not intended for public use; there are equivalent, faster,
+macros for most of them.  See L<perlapi/Character classes>:
+C<is_uni_ascii>,
+C<is_uni_ascii_lc>,
+C<is_uni_blank>,
+C<is_uni_blank_lc>,
+C<is_uni_cntrl>,
+C<is_uni_cntrl_lc>,
+C<is_uni_idfirst_lc>,
+C<is_uni_space>,
+C<is_uni_space_lc>,
+C<is_uni_xdigit>,
+C<is_uni_xdigit_lc>,
+C<is_utf8_ascii>,
+C<is_utf8_blank>,
+C<is_utf8_cntrl>,
+C<is_utf8_idcont>,
+C<is_utf8_idfirst>,
+C<is_utf8_perl_space>,
+C<is_utf8_perl_word>,
+C<is_utf8_posix_digit>,
+C<is_utf8_space>,
+C<is_utf8_xdigit>.
+C<is_utf8_xidcont>,
+C<is_utf8_xidfirst>,
+C<to_uni_lower_lc>,
+C<to_uni_title_lc>,
+and
+C<to_uni_upper_lc>.
+
 =head1 Performance Enhancements
 
 XXX Changes which enhance performance without changing behaviour go here.
@@ -118,143 +142,30 @@ XXX
 
 =item *
 
-L<B> has been upgraded from version 1.36 to 1.37.  All C<CVf_*> and C<GVf_*>
-and more SV-related flag values are now provided as constants in the C<B::>
-namespace and available for export.  The default export list has not changed.
-
-=item *
-
-L<B::Concise> has been upgraded from version 0.91 to 0.92.  The C<-nobanner>
-option has been fixed, and C<format>s can now be dumped.  When passed a sub
-name to dump, it will check also to see whether it is the name of a format.  If
-a sub and a format share the same name, it will dump both.
-
-=item *
-
-L<B::Deparse> has been upgraded from version 1.15 to 1.16.  It now deparses
-loop controls with the correct precedence, and multiple statements in a
-C<format> line are also now deparsed correctly.
-
-=item *
-
-L<Compress::Raw::Bzip2> has been upgraded from version 2.05201 to 2.055.  The
-misuse of Perl's "magic" API has been fixed.
-
-=item *
-
-L<Compress::Raw::Zlib> has been upgraded from version 2.05401 to 2.056.  The
-misuse of Perl's "magic" API has been fixed.
-
-=item *
-
-L<Compress::Zlib> has been upgraded from version 2.052 to 2.055.
-C<compress()>, C<uncompress()>, C<memGzip()> and C<memGunzip()> have been
-speeded up by making parameter validation more efficient.
-
-=item *
-
-L<Data::Dumper> has been upgraded from version 2.135_06 to 2.135_07.  It has
-been optimized to only build a seen-scalar hash as necessary, thereby speeding
-up serialization drastically.
-
-=item *
-
-L<Devel::Peek> has been upgraded from version 1.08 to 1.09.  The only change
-has been to the test script, to account for changes to some flags in perl's
-internals.
-
-=item *
-
-L<Encode> has been upgraded from version 2.44 to 2.47.  The Mac alias x-mac-ce
-has been added, and various bugs have been fixed in Encode::Unicode,
-Encode::UTF7 and Encode::GSM0338.
-
-=item *
-
-L<Module::Build> has been upgraded from version 0.40 to 0.4002.  A minor bug
-fix allows markup to be used around the leading "Name" in a POD "abstract"
-line, and some documentation improvements have been made.
-
-=item *
-
-L<Module::CoreList> has been upgraded from version 2.69 to 2.70.  Version
-information is now stored as a delta, which greatly reduces the size of the
-F<CoreList.pm> file.
-
-=item *
-
-L<Module::Load::Conditional> has been upgraded from version 0.50 to 0.54.
-Various enhancements include the new use of Module::Metadata.
-
-=item *
-
-L<Module::Metadata> has been upgraded from version 1.000009 to 1.000010.  The
-creation of a Module::Metadata object for a typical module file has been sped
-up by about 40%.
-
-=item *
-
-L<Module::Pluggable> has been upgraded from version 4.0 to 4.2.  Amongst other
-changes, triggers are now allowed on events, which gives a powerful way to
-modify behaviour.
-
-=item *
-
-L<Pod::Simple> has been upgraded from version 3.20 to 3.23.  Numerous
-improvements have been made, mostly to Pod::Simple::XHTML, which also has a
-compatibility change: the C<codes_in_verbatim> option is now disabled by
-default.  See F<cpan/Pod-Simple/ChangeLog> for the full details.
-
-=item *
-
-L<re> has been upgraded from version 0.21 to 0.22.  Single character [class]es
-like C</[s]/> or C</[s]/i> are now optimized as if they did not have the
-brackets, i.e. C</s/> or C</s/i>.
+L<GDBM_File> has been upgraded from version 1.14 to 1.15. The undocumented
+optional fifth parameter to C<TIEHASH> has been removed. This was intended
+to provide control of the callback used by C<gdbm*> functions in case of
+fatal errors (such as filesystem problems), but did not work (and could
+never have worked). No code on CPAN even attempted to use it. The callback
+is now always the previous default, C<croak>. Problems on some platforms with
+how the C<C> C<croak> function is called have also been resolved.
 
-=item *
-
-L<Socket> has been upgraded from version 2.002 to 2.003.  Constants and
-functions required for IP multicast source group membership have been added.
-
-=item *
-
-L<Storable> has been upgraded from version 2.37 to 2.38.  It can now freeze
-and thaw vstrings correctly.  This causes a slight incompatible change in
-the storage format, so the format version has increased to 2.9.
-
-=item *
-
-L<Sys::Syslog> has been upgraded from version 0.29 to 0.30.  An issue with
-C<POSIX::strftime()> on Windows and a build problem on Haiku-OS have been
-resolved, and <getservbyname()> is no longer called when the port is specified.
-
-=item *
-
-L<Time::Local> has been upgraded from version 1.2000 to 1.2300.  Seconds values
-greater than 59 but less than 60 no longer cause C<timegm()> and C<timelocal()>
-to croak.
-
-=item *
-
-L<Unicode::UCD> has been upgraded from version 0.44 to 0.45.  This has been
-modified slightly for reasons of perl internal use only.
+=back
 
-=item *
+=head2 Removed Modules and Pragmata
 
-L<Win32> has been upgraded from version 0.44 to 0.45.  New APIs have been added
-for getting and setting the current code page.
+=over 4
 
 =item *
 
-L<Win32CORE> has been upgraded from version 0.02 to 0.03.  The use of
-PERL_NO_GET_CONTEXT here has resulted in smaller machine code.
+XXX
 
 =back
 
 =head1 Documentation
 
-XXX Changes to files in F<pod/> go here.  Consider grouping entries by file and
-be sure to link to the appropriate page, e.g. L<perlfunc>.
+XXX Changes to files in F<pod/> go here.  Consider grouping entries by
+file and be sure to link to the appropriate page, e.g. L<perlfunc>.
 
 =head2 New Documentation
 
@@ -270,15 +181,16 @@ XXX Changes which significantly change existing files in F<pod/> go here.
 However, any changes to F<pod/perldiag.pod> should go in the L</Diagnostics>
 section.
 
-=head3 L<perlfunc>, L<perlop>
+=head3 L<perlapi/Character classes>
 
 =over 4
 
 =item *
 
-Loop control verbs (C<dump>, C<goto>, C<next>, C<last> and C<redo>) have
-always had the same precedence as assignment operators, but this was never
-documented until now.
+There are quite a few macros callable from XS modules that classify
+characters into things like alphabetic, punctuation, etc.  More of these
+are now documented, including ones which work on characters whose code
+points are outside the Latin-1 range.
 
 =back
 
@@ -302,13 +214,7 @@ and New Warnings
 
 =item *
 
-L<Unterminated delimiter for here document|perldiag/"Unterminated delimiter for here document">
-
-This message now occurs when a here document label has an initial quotation
-mark but the final quotation mark is missing.
-
-This replaces a bogus and misleading error message about not finding the
-label itself [perl #114104].
+XXX L<message|perldiag/"message">
 
 =back
 
@@ -318,10 +224,7 @@ label itself [perl #114104].
 
 =item *
 
-L<Wide character in setenv|perldiag/"Wide character in %s">
-
-Attempts to put wide characters into environment variables via C<%ENV> now
-provoke this warning.
+XXX L<message|perldiag/"message">
 
 =back
 
@@ -401,7 +304,7 @@ changes as paragraphs below it. ]
 =head2 New Platforms
 
 XXX List any platforms that this version of perl compiles on, that previous
-versions did not . These will either be enabled by new files in the F<hints/>
+versions did not These will either be enabled by new files in the F<hints/>
 directories, or new subdirectories and F<README> files at the top level of the
 source tree.
 
@@ -415,13 +318,11 @@ XXX
 
 =head2 Discontinued Platforms
 
-XXX List any platforms that this version of perl no longer compiles on.
-
 =over 4
 
-=item XXX-some-platform
+=item BeOS
 
-XXX
+Support for BeOS has been removed.
 
 =back
 
@@ -452,126 +353,52 @@ well.
 
 =item *
 
-XXX
-
-=back
-
-=head1 Selected Bug Fixes
-
-XXX Important bug fixes in the core language are summarized here.  Bug fixes in
-files in F<ext/> and F<lib/> are best summarized in L</Modules and Pragmata>.
-
-[ List each fix as a =item entry ]
-
-=over 4
-
-=item *
-
-C<\w> now matches the code points U+200C (ZERO WIDTH NON-JOINER) and
-U+200D (ZERO WIDTH JOINER).  C<\W> no longer matches these.  This change
-is because Unicode corrected their definition of what C<\w> should match.
-
-=item *
-
-C<dump LABEL> no longer leaks its label.
-
-=item *
-
-Constant folding no longer changes the behaviour of functions like C<stat()>
-and C<truncate()> that can take either filenames or handles.
-C<stat 1 ? foo : bar> nows treats its argument as a file name (since it is
-an arbitrary expression), rather than the handle "foo".
-
-=item *
-
-C<truncate FOO, $len> no longer falls back to treating "FOO" as a file name
-if the filehandle has been deleted.  This was broken in Perl 5.16.0.
-
-=item *
-
-Subroutine redefinitions after sub-to-glob and glob-to-glob assignments no
-longer cause double frees or panic messages.
+SvUPGRADE() is no longer an expression. Originally this macro (and its
+underlying function, sv_upgrade()) were documented as boolean, although
+in reality they always croaked on error and never returned false. In 2005
+the documentation was updated to specify a void return value, but
+SvUPGRADE() was left always returning 1 for backwards compatibility. This
+has now been removed, and SvUPGRADE() is now a statement with no return
+value.
 
-=item *
+So this is now a syntax error:
 
-C<s///> now turns vstrings into plain strings when performing a
-substitution, even if the resulting string is the same (C<s/a/a/>).
-
-=item *
+    if (!SvUPGRADE(sv)) { croak(...); }
 
-Prototype mismatch warnings no longer erroneously treat constant subs as
-having no prototype when they actually have "".
+If you have code like that, simply replace it with
 
-=item *
-
-Constant subroutines and forward declarations no longer prevent prototype
-mismatch warnings from omitting the sub name.
-
-=item *
+    SvUPGRADE(sv);
 
-C<undef> on a subroutine now clears call checkers.
-
-=item *
-
-The C<ref> operator started leaking memory on blessed objects in Perl
-5.16.0.  This has been fixed [perl #114340].
-
-=item *
-
-C<use> no longer tries to parse its arguments as a statement, making
-C<use constant { () };> a syntax error [perl #114222].
-
-=item *
+or to to avoid compiler warnings with older perls, possibly
 
-On debugging builds, "uninitialized" warnings inside formats no longer
-cause assertion failures.
+    (void)SvUPGRADE(sv);
 
-=item *
-
-On debugging builds, subroutines nested inside formats no longer cause
-assertion failures [perl #78550].
-
-=item *
-
-C<print $x> and C<sub { print $x }->()> now always produce the same output.
-It was possible for the latter to refuse to close over $x if the variable
-was not active; e.g., if it was defined outside a currently-running named
-subroutine.
-
-=item *
-
-Similarly, C<print $x> and C<print eval '$x'> now produce the same output.
-This also allows "my $x if 0" variables to be seen in the debugger
-[perl #114018].
+=back
 
-=item *
+=head1 Selected Bug Fixes
 
-Formats called recursively no longer stomp on their own lexical variables,
-but each recursive call has its own set of lexicals.
+XXX Important bug fixes in the core language are summarized here.  Bug fixes in
+files in F<ext/> and F<lib/> are best summarized in L</Modules and Pragmata>.
 
-=item *
+[ List each fix as a =item entry ]
 
-Attempting to free an active format or the handle associated with it no
-longer results in a crash.
+=over 4
 
 =item *
 
-Format parsing no longer gets confused by braces, semicolons and
-low-precedence operators.  It used to be possible to use braces as format
-delimiters (instead of C<=> and C<.>), but only sometimes.  Semicolons and
-low-precedence operators in format argument lines no longer confuse the
-parser into ignoring the line's return value.  In format argument lines,
-braces can now be used for anonymous hashes, instead of being treated
-always as C<do> blocks.
+C<sort {undef} ...> under fatal warnings no longer crashes.  It started
+crashing in Perl 5.16.
 
 =item *
 
-Formats can now be nested inside code blocks in regular expressions and
-other quoted constructs (C</(?{...})/> and C<qq/${...}/>) [perl #114040].
+Stashes blessed into each other
+(C<bless \%Foo::, 'Bar'; bless \%Bar::, 'Foo'>) no longer result in double
+frees.  This bug started happening in Perl 5.16.
 
 =item *
 
-Formats are no longer created after compilation errors.
+Numerous memory leaks have been fixed, mostly involving fatal warnings and
+syntax errors.
 
 =back
 
@@ -600,7 +427,7 @@ here.
 
 XXX Generate this with:
 
-  perl Porting/acknowledgements.pl v5.17.2..HEAD
+  perl Porting/acknowledgements.pl v5.17.6..HEAD
 
 =head1 Reporting Bugs