In perl.git, the branch sprout/misc-post-5.16 has been updated <http://perl5.git.perl.org/perl.git/commitdiff/82188168ad52a980401f741409976037f1192835?hp=489664859f2f12ce7e45cfee9d447b7d2a2303b1>
- Log ----------------------------------------------------------------- commit 82188168ad52a980401f741409976037f1192835 Author: Father Chrysostomos <[email protected]> Date: Sun Apr 22 22:32:09 2012 -0700 [perl #111000] Let hv_store work on hint hashes Magic attached to hash elements has its key stored differently depend- ing on how it was supplied to hv_common. hv_store passes a string/ length pair to hv_common, while hv_store_ent passes an SV. magic_clearhint wasnât able to handle string/length pairs, and only worked with SVs, resulting in assertion failures or crashes. This commit fixes magic_clearhint, so that XS code can use hv_store on hint hashes. M ext/XS-APItest/t/hash.t M mg.c commit fbd306cba73eab586443b08366cc8ac8ad5b8581 Author: Father Chrysostomos <[email protected]> Date: Sun Apr 22 22:27:50 2012 -0700 mg.c:magic_clearhint: remove redundant PERL_UNUSED_ARG M mg.c commit 4800f4e7e3ceba2f7c19b4faf137cc9283e6f4ab Author: Father Chrysostomos <[email protected]> Date: Sun Apr 22 22:06:57 2012 -0700 XS-APItest/t/hash.t: comment typo M t/op/hash.t commit 50a512424f053b15777a76a00fed62aaca3a70a9 Author: Father Chrysostomos <[email protected]> Date: Sun Apr 22 22:05:24 2012 -0700 Increase $XS::APItest::VERSION to 0.39 M ext/XS-APItest/APItest.pm ----------------------------------------------------------------------- Summary of changes: ext/XS-APItest/APItest.pm | 2 +- ext/XS-APItest/t/hash.t | 10 ++++++++++ mg.c | 11 +++++------ t/op/hash.t | 2 +- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/ext/XS-APItest/APItest.pm b/ext/XS-APItest/APItest.pm index 6c3c323..d7fb60a 100644 --- a/ext/XS-APItest/APItest.pm +++ b/ext/XS-APItest/APItest.pm @@ -5,7 +5,7 @@ use strict; use warnings; use Carp; -our $VERSION = '0.38'; +our $VERSION = '0.39'; require XSLoader; diff --git a/ext/XS-APItest/t/hash.t b/ext/XS-APItest/t/hash.t index 0fdd64e..84b6274 100644 --- a/ext/XS-APItest/t/hash.t +++ b/ext/XS-APItest/t/hash.t @@ -260,6 +260,16 @@ sub test_precomputed_hashes { pass 'no crash when writing to hash elem with null value via slice'; } +# [perl #111000] Bug number eleventy-one thousand: +# hv_store should work on hint hashes +eval q{ + BEGIN { + XS::APItest::Hash::store \%^H, "XS::APItest/hash.t", undef; + delete $^H{"XS::APItest/hash.t"}; + } +}; +pass("hv_store works on the hint hash"); + done_testing; exit; diff --git a/mg.c b/mg.c index 8b30f93..e202d58 100644 --- a/mg.c +++ b/mg.c @@ -3355,14 +3355,13 @@ Perl_magic_clearhint(pTHX_ SV *sv, MAGIC *mg) PERL_ARGS_ASSERT_MAGIC_CLEARHINT; PERL_UNUSED_ARG(sv); - assert(mg->mg_len == HEf_SVKEY); - - PERL_UNUSED_ARG(sv); - PL_hints |= HINT_LOCALIZE_HH; CopHINTHASH_set(&PL_compiling, - cophh_delete_sv(CopHINTHASH_get(&PL_compiling), - MUTABLE_SV(mg->mg_ptr), 0, 0)); + mg->mg_len == HEf_SVKEY + ? cophh_delete_sv(CopHINTHASH_get(&PL_compiling), + MUTABLE_SV(mg->mg_ptr), 0, 0) + : cophh_delete_pvn(CopHINTHASH_get(&PL_compiling), + mg->mg_ptr, mg->mg_len, 0, 0)); return 0; } diff --git a/t/op/hash.t b/t/op/hash.t index ef757a3..4093f2e 100644 --- a/t/op/hash.t +++ b/t/op/hash.t @@ -89,7 +89,7 @@ sub get_keys { # trying to provide the fastest equivalent of C macro's PERL_HASH in # Perl - the main complication is that it uses U32 integer, which we -# can't do it perl, without doing some tricks +# can't do in perl, without doing some tricks sub hash { my $s = shift; my @c = split //, $s; -- Perl5 Master Repository
