Use NotImplemented as the infer-default sentinel; free None as a literal value#10
Merged
Conversation
print_h referenced a nonexistent Function.linkage attribute and would raise AttributeError if ever called. Emit valid C prototypes for the public functions instead (private static helpers are skipped, as befits a header). It is not on any generated-code path, so no generated output changes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
default=None was repurposed in f0495bc to mean "infer the default from the boundary values", which collided with None as a legitimate *value*: HarfBuzz's decomposition table packs a dict with default=None and a mapping that sends None -> 0 ("no decomposition"), and that stopped working (ValueError: "default=None is only supported for list input"). Restore None as an ordinary value (mapped like any other) and move the inference request to the explicit sentinel NotImplemented: pack_table(list_data, default=NotImplemented) # infer from boundaries pack_table(dict_data, default=None, mapping=m) # None is a real value dict + NotImplemented still raises (inference needs list input). Verified by regenerating HarfBuzz's Unicode tables (make -f update-unicode-tables.make clean all): succeeds and hb-ucd-table.hh is byte-identical to the committed table. Co-Authored-By: Claude Opus 4.8 (1M context) <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.
Problem
f0495bc("Support inferred defaults from boundary values") repurposeddefault=Noneto mean "infer the default". That collided withNonebeing alegitimate value: HarfBuzz's decomposition (
dm) dataset packs a dictwith
default=Noneand a mapping that sendsNone -> 0("no decomposition").After that commit, regenerating HarfBuzz's tables fails:
This was a latent break since
f0495bc; it surfaces whenever HarfBuzz isregenerated against current packtab.
Fix
Move the inference request off
Noneand onto the explicit sentinelNotImplemented, restoringNoneas an ordinary value:Noneis now mapped like any other value (e.g.None -> 0).default=NotImplemented(list input only;dict + NotImplementedstill raises).0, so existing callers are unaffected.Option;NotImplementedis the Python equivalent now that
Noneis a real value.Also included
Code.print_h, which referenced a nonexistentFunction.linkageandwould raise
AttributeErrorif called. It now emits valid C prototypes forthe public functions. Not on any generated-code path — no output changes.
Verification
pytest: 231 passing (updated inference tests toNotImplemented; addedtests that
Noneis a literal value with a mapping, and thatdict + NotImplementedraises).make -f update-unicode-tables.make clean allin HarfBuzz nowsucceeds, and
hb-ucd-table.hhregenerates byte-identical to thecommitted table.
🤖 Generated with Claude Code