fix: support cloning Perl 5.38+ class instances (SVt_PVOBJ)#140
Draft
Koan-Bot wants to merge 2 commits into
Draft
fix: support cloning Perl 5.38+ class instances (SVt_PVOBJ)#140Koan-Bot wants to merge 2 commits into
Koan-Bot wants to merge 2 commits into
Conversation
Clone crashed with "unknown type: 0x10" when cloning objects created with the `use feature 'class'` syntax introduced in Perl 5.38. The new SVt_PVOBJ type was not handled in sv_clone's type switch. Add deep-clone support for PVOBJ by iterating ObjectFIELDS and recursively cloning each field value. Blessing uses direct stash assignment instead of sv_bless, which rejects class stashes with "Attempt to bless into a class" on Perl 5.38+. Both Clone and Storable::dclone failed on class objects before this change; Clone now handles them correctly. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
install-with-cpm@v1 regressed on Perl 5.8-5.22 after a recent cpm update requiring Perl 5.24+. Bump to @v2 for action-based jobs and use direct `cpm install` in the Docker-based Linux matrix (where cpm is pre-installed). Matches the approach approved by @atoomic in PR garu#120. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Deep-clone support for
use feature 'class'objects (SVt_PVOBJ, Perl 5.38+).Why
clone()crashes withunknown type: 0x10on any object created with the coreclasskeyword — a feature that's been in Perl since 5.38 and increasingly adopted. Neither Clone nor Storable::dclone handle this type today.How
SVt_PVOBJcase insv_clone's type switch: creates a new PVOBJ vianewSV(0)+sv_upgrade, then clones each field from theObjectFIELDSarray in the post-magic section (same pattern as PVHV/PVAV).SvOBJECT_on+SvSTASH_setinstead ofsv_bless, which rejects class stashes with "Attempt to bless into a class" on Perl 5.38+.#if PERL_VERSION >= 38— no impact on older Perls.hseencycle detection.Testing
12 new tests in
t/28-class-objects.tcovering:All existing tests continue to pass.
🤖 Generated with Claude Code
Quality Report
Changes: 3 files changed, 188 insertions(+)
Code scan: clean
Tests: passed (OK)
Branch hygiene: clean
Generated by Kōan post-mission quality pipeline