-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement SvIV_nomg(), SvUV_nomg(), SvNV_nomg() and SvTRUE_nomg() #128
Conversation
Use sv_mortalcopy_flags() macro with SV_NOSTEAL flag to create non-magical copy of input scalar. And on this non-magical copy call original Perl's SvIV/SvUV/SvNV/SvTRUE macro. This would ensure that get magic is not processed on original input scalar argument and also that correct value is returned.
tie my $scalar, 'TieScalarCounter', 10; | ||
my $fetch = $scalar; | ||
|
||
ok tied($scalar)->{fetch}, 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should not these tests use is
instead of ok
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Devel::PPPort does not use Test::Simple
, but rather Test
module which has different API. See:
https://github.com/Dual-Life/Devel-PPPort/pull/128/files#diff-e998a77b1ca4b0163f81709c60da878fR29
And it has only 3 argument ok
function, see:
https://github.com/Dual-Life/Devel-PPPort/blob/master/t/testutil.pl#L20
It does not support is
function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is in order to maintain compatibility with perls < 5.6. However, we could write our own is
, isnt
, like
functions in a local library (wrapping Test::ok) that provide the same APIs as Test::More's functions, to make it easier to write (and read) the tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not the first time that I haven't received a notification from github. How can I track the cause of this down. Is it github, is it cpan.org?.
Having stumbled upon this, I agree with ether's sentiment. Who is going to write this wrapper?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
notifications are coming from GitHub itself, you should check your subscription status to the repo but also to the issue itself
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've opened #130 for tracking this wish list, I would say the first that want to work on it should assign the task to himself
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, using new test wrapper would mean to rewrite all tests... I'm not planning to do it as it is a big work right now and we can leave without it.
@@ -118,3 +118,68 @@ my $foo = 'bar'; | |||
ok(Devel::PPPort::sv_magic_portable($foo)); | |||
ok($foo eq 'bar'); | |||
|
|||
if ( "$]" lt '5.007003' ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be < instead of lt, because of bugs in early perls, which I have discovered in testing them
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah agree then the '5.007003'
could simply become 5.007003
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note that "$]" <
is required to workaround that bug with older perl versions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
view #131
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems that this pattern needs to be fixed on more places in Devel::PPPort package.
Is there anything else which needs to be fixed in this pull request? I guess that both changes would be done globally for all Devel::PPPort code. |
On 7/17/19 8:17 AM, pali wrote:
Is there anything else which needs to be fixed in this pull request? I
guess that both changes would be done globally for all Devel::PPPort code.
—
My WIP does this for all other places.
|
can this issue be closed? |
@khwilliamson this PR #128 is merged and thus do not appear as open, we cannot close it, its status is Are you asking to close another issue? could you be more specific about the number? thanks |
I didn’t realize it was already closed
…Sent from my iPhone
On Oct 14, 2019, at 5:09 PM, Nicolas R. ***@***.***> wrote:
@khwilliamson this PR #128 is merged and thus do not appear as open, we cannot close it, its status is merged.
Are you asking to close another issue? could you be more specific about the number?
thanks
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Use sv_mortalcopy_flags() macro with SV_NOSTEAL flag to create non-magical
copy of input scalar. And on this non-magical copy call original Perl's
SvIV/SvUV/SvNV/SvTRUE macro.
This would ensure that get magic is not processed on original input scalar
argument and also that correct value is returned.