Skip to content

WIP: fix Storable empty STORABLE_freeze return cancels hooks#429

Merged
fglock merged 2 commits into
masterfrom
feature/txn-scope-guard-fix
Apr 3, 2026
Merged

WIP: fix Storable empty STORABLE_freeze return cancels hooks#429
fglock merged 2 commits into
masterfrom
feature/txn-scope-guard-fix

Conversation

@fglock
Copy link
Copy Markdown
Owner

@fglock fglock commented Apr 3, 2026

Summary

  • fix: Storable empty STORABLE_freeze return now cancels hooks — Per Perl 5 Storable semantics, when STORABLE_freeze returns an empty list, the hook is cancelled and Storable falls back to default serialization. This is used by DateTime::Infinite which defines sub STORABLE_freeze {return} to opt out of hooks.

    Fixed in three codepaths:

    • serializeBinary(): falls back to SX_BLESS default serialization
    • deepClone(): falls back to regular deep-copy
    • convertToYAMLWithTags(): falls back to !!perl/hash: serialization

Test plan

  • make passes (all unit tests)
  • DateTime t/23storable.t: 20/20 tests pass (was 5/20 + crash)
  • ./jcpan -t DateTime: all 51 test files pass, 3589 subtests

Generated with Devin

fglock and others added 2 commits April 3, 2026 14:01
When deleting a stash namespace entry (key ending with '::'),
RuntimeStash.deleteGlob() was a no-op because it computed
fullKey = 'main::Foo::' but symbols are stored as 'Foo::bar'.
The exact-key lookup found nothing and returned early.

Fix: detect namespace keys and perform prefix-based removal from
all global maps (globalCodeRefs, globalVariables, globalArrays,
globalHashes, globalIORefs, globalFormatRefs) plus pinnedCodeRefs.

This fixes spurious 'Subroutine ACTION_foo redefined' warnings in
Module::Build t/help.t, and makes Foo->can('bar') correctly
return false after delete $::{'Foo::'}.

Generated with [Devin](https://cli.devin.ai/docs)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Per Perl 5 Storable semantics, when STORABLE_freeze returns an empty
list, the hook is cancelled and default serialization is used instead.
This fixes DateTime::Infinite::Past/Future which define
`sub STORABLE_freeze {return}` to opt out of hooks.

Fixed in three codepaths:
- serializeBinary(): falls back to SX_BLESS default serialization
- deepClone(): falls back to regular deep-copy
- convertToYAMLWithTags(): falls back to !!perl/hash: serialization

Fixes DateTime t/23storable.t (20/20 tests now pass).

Generated with [Devin](https://cli.devin.ai/docs)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@fglock fglock merged commit 537e0d9 into master Apr 3, 2026
2 checks passed
@fglock fglock deleted the feature/txn-scope-guard-fix branch April 3, 2026 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant