This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Use SvUPGRADE, not sv_upgrade, in sv_sethek
This was causing some interesting HTML::Element failures, which were
only triggered by HTML::DOM’s test suite.
ref’s TARG can become tainted if another op in the same statement
turns on tainting for the rest of the statement, so it becomes a PVMG.
The next call to the same ref will try to sv_upgrade it to a PV (which
is lower). Only the macro version, SvUPGRADE, checks whether the
upgrade is needed.
ref only calls sv_sethek when it has a blessed object for its argu-
ment, hence the strange-looking test.