Hi.

There is a surprisingly simple fix (attached) that makes polymake Perl
5.44 compatible.

Should I also report this upstream? I am coming here first because I am
the gap-polymaking maintainer.

This fix was found by Claude Opus 5.

Sincerely,
Joachm

-- 
Papier ist gebundenes CO2. Bitte drucken Sie diese EMail aus und
archivieren Sie sie.
Description: Fix compatibility with Perl 5.44
 Two independent problems:
 .
 1. support/configure.pl refuses to build with perl >= 5.44 at all.
 .
 2. Behind that refusal there is a real incompatibility. RefHash.xxs replaces
    the run-time handler for OP_CONST and marks bareword constants with
    SVf_IVisUV, which is polymake's marker for keyword constants (see
    keyword_constant_flags / is_keyword_constant() in the same file). It sets
    that flag on SVs of type SVt_PV, which have no IV slot at all. That was
    only ever safe because perl did not look at the flag on such SVs; since
    perl 5.44 it does, and the string value of every bareword in front of a
    fat comma reads back as undef. polymake then dies during startup:
 .
      unknown field type '' at .../Polymake/Pipe.pm line 31.
 .
    Minimal reproducer with a built polymake tree:
 .
      use Polymake::Namespaces;
      my $a = [ foo => "X" ];
      print "before: ", (defined $a->[0] ? $a->[0] : "UNDEF"), "\n";   # foo
      package Polymake::RefHash;
      use Polymake::Ext;
      my $b = [ foo => "X" ];
      print "after : ", (defined $b->[0] ? $b->[0] : "UNDEF"), "\n";   # UNDEF
 .
    The fix upgrades the SV to a body that actually owns an IV before setting
    the flag. polymake's own synthetic hash-key SV in the same file already
    uses SVt_PVIV | SVf_IVisUV | SVf_POK, so this only makes the two paths
    consistent.
 .
 Verified on Debian sid with perl 5.44.0-3: configure, full ninja build and
 "perl perl/polymake --script run_testcases" all succeed, the latter reporting
 "*** All tests successful ***".
 .
 Dropping only the version check is NOT sufficient: polymake then builds, but
 dies at startup. Dropping only the SvIsUV_on() marker is not sufficient
 either: polymake starts, but 25 testcases fail because keyword arguments are
 no longer recognised as such.
Author: Joachim Zobel <[email protected]>
Forwarded: no 
Last-Update: 2026-11-17
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/support/configure.pl
+++ b/support/configure.pl
@@ -27,13 +27,13 @@
 ./configure PERL=/path/to/my/new/perl [other options ...]
 .
       exit(1);
-   } elsif ($] >= 5.044) {
+   } elsif ($] >= 5.046) {
       print STDERR <<".";
 *************
 *** ERROR ***
 *************
 
-polymake has not been checked for compatibility with perl 5.44 or newer;
+polymake has not been checked for compatibility with perl 5.46 or newer;
 your perl interpreter says it is $].
 
 If you already have another (older) perl interpreter somewhere else, you can
--- a/lib/core/src/perl/RefHash.xxs
+++ b/lib/core/src/perl/RefHash.xxs
@@ -791,8 +791,16 @@
 OP* intercept_pp_const(pTHX)
 {
    SV* sv = cSVOP_sv;
-   if ((PL_op->op_private & OPpCONST_BARE)  &&  SvTYPE(sv) == SVt_PV)
+   if ((PL_op->op_private & OPpCONST_BARE)  &&  SvTYPE(sv) == SVt_PV) {
+      /* SVf_IVisUV is polymake's marker for keyword constants, see
+         is_keyword_constant() below.  SVt_PV has no IV slot, so setting the
+         flag there is only safe as long as perl never looks at it; since
+         perl 5.44 it does, and the string value reads back as undef.
+         Upgrade to a body that actually owns an IV, exactly as the synthetic
+         hash-key SV above already does (SVt_PVIV | SVf_IVisUV | SVf_POK).  */
+      SvUPGRADE(sv, SVt_PVIV);
       SvIsUV_on(sv);
+   }
    PL_op->op_ppaddr = def_pp_CONST;
    return def_pp_CONST(aTHX);
 }

Reply via email to