| From: | Andrey Rachitskiy <pl0h0yp1(at)gmail(dot)com> |
|---|---|
| To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
| Cc: | andrew(at)dunslane(dot)net, pgsql-hackers(at)lists(dot)postgresql(dot)org |
| Subject: | Re: Residual cleanups for tied objects in PL/Perl |
| Date: | 2026-08-17 17:21:24 |
| Message-ID: | CAB8bMit2sRiVWfgW-ms1KciwofjHnDi4T=_xK4Zk2KFm7YBG0w@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
пн, 17 авг. 2026 г. в 21:49, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
> I spent some time digging through the Perl documentation and source
> code, and I'm starting to have doubts about this idea of "fix it
> by applying SvGETMAGIC to array/hash entries". I can't see anything
> in the documentation recommending such an approach, and I don't see
> any of their own code doing so either. Pretty much all their calls
> to SvGETMAGIC are in functions that have been passed a scalar value
> from elsewhere. So while this may work today, I'm unconvinced that
> it's idiomatic or future-proof. Can you point at any production code
> that is doing it this way?
>
> https://perldoc.perl.org/perlguts - generic C code must call the
SvGETMAGIC() macro to invoke any 'get' magic if they use an SV obtained
from external sources in functions that don't handle magic. See perlapi for
a description of these functions.
https://perldoc.perl.org/perlapi#SvGETMAGIC - This is an idiomatic way.
I can search for the production code, but there are many xs modules on
metacpan and everyone uses this approach, as it is described in the
documentation. As an example, let's use the Encode module
https://github.com/Perl/perl5/blob/c31ca2013f287840fcddf498ead9602666569966/cpan/Encode/Encode
.xs#L349
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Andrey Rachitskiy | 2026-08-17 17:26:23 | Re: Residual cleanups for tied objects in PL/Perl |
| Previous Message | Bharath Rupireddy | 2026-08-17 17:13:58 | Re: Tighten ACL check in repack_is_permitted_for_relation() |