Perl / perl5

🐪 The Perl programming language
https://dev.perl.org/perl5/
Other
1.85k stars 527 forks source link

fix deparse of state sub with empty prototype #22093

Closed haarg closed 1 month ago

haarg commented 1 month ago

Fixes #21315

iabyn commented 1 month ago

LGTM, except that Deparse's version needs bumping

jkeenan commented 1 month ago

I'm seeing this test failure in this branch:

$ cd t; ./perl harness ../lib/B/Deparse.t; cd -
../lib/B/Deparse.t .. 1/? # Failed test 289 - preserve __LINE__ etc at ../lib/B/Deparse.t line 96
#      got '{\n    CORE::state sub FOO () { 42 }\n    \n    use feature \'state\';\n    print 42, \"\\n\";\n}'
# expected /(?^:^\{\s*use\s+feature\s+\'state\'\;\s+state\s+sub\s+FOO\s+\:prototype\(\)\s+\{\s+42\s+\}\s+print\(FOO\,\s+\"\\n\"\)\;\s+\s*\}$)/
# =============================================
# CODE:
# --------
# use feature 'state';
# state sub FOO :prototype() { 42 }
# print(FOO, "\n");
# 
# --------
# EXPECTED:
# --------
# {
# use feature 'state';
# state sub FOO :prototype() { 42 }
# print(FOO, "\n");
# 
# }
# --------
# GOT:
# --------
# {\n    CORE::state sub FOO () { 42 }\n    \n    use feature \'state\';\n    print 42, \"\\n\";\n}
# --------
# =============================================
Attempt to free unreferenced scalar: SV 0x5b9097e7ff58 at ../lib/B/Deparse.t line 83, <DATA> chunk 288.
../lib/B/Deparse.t .. Failed 1/340 subtests 
    (less 2 skipped subtests: 337 okay)

Test Summary Report
-------------------
../lib/B/Deparse.t (Wstat: 0 Tests: 340 Failed: 1)
  Failed test:  289
Files=1, Tests=340,  1 wallclock secs ( 0.05 usr  0.00 sys +  1.23 cusr  0.15 csys =  1.43 CPU)
Result: FAIL

I think our CI is seeing that as well. @haarg, can you take a look? thanks.

tonycoz commented 1 month ago

I think our CI is seeing that as well.

The CI failure is a cygwin issue, it looks like cygwin fork emulation isn't able to map a DLL where it was in the parent process.

iabyn commented 3 weeks ago

The 'Attempt to free unreferenced scalar' message is now fixed by v5.39.9-66-g17535c984a.