Refactor pyconvert rule storage and API to scoped rules with explicit ordering and update conversions#802
Open
cjdoris wants to merge 4 commits into
Open
Refactor pyconvert rule storage and API to scoped rules with explicit ordering and update conversions#802cjdoris wants to merge 4 commits into
cjdoris wants to merge 4 commits into
Conversation
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.
Motivation
scopeand a deterministic ordering instead of a multipriority enum, enabling clearer matching semantics and easier high-priority insertion.Description
PyConvertRulenow storestype,scope,func, and anorderinteger, andPYCONVERT_RULESis now an orderedPair{String,PyConvertRule}[]instead of aDictof vectors.pyconvert_add_rule(tname, T, func, priority)withpyconvert_add_rule(tname, T, S, func)which requires ascopeSthat must be a supertype ofT, and addedpyconvert_add_rule_high_priorityfor inserting higher-priority rules.scopeand to try rules in insertion order (newer rules first) via theorderfield, and simplified the type/typename extraction and interface markers for arrays/buffers.Convert,Wrap,JlWrap,NumpyDates/numpy.jl,ctypes.jl, andpandas.jlto pass explicit scopes and to register certain rules via new high-priority helpers; removed the oldPyConvertPriorityenum and related exports.__init__to register high-priority and canonical rules by callingJlWrap.init_base_rule_high_priority(),Wrap.init_wrap_rules_high_priority(),Convert.init_numpy_high_priority(), andConvert.init_pyconvert_canonical().test/Convert.jlto assert new behavior: rule insertion ordering, correct conversion results, and anArgumentErrorif a rule is registered with atypenot a subtype of itsscope.Testing
test/Convert.jlunit tests which exercise added and modified conversion rules and ordering, and they passed.] testfor the changed modules to ensure initialization and conversion registrations succeed, and all tests passed.Codex Task