fix: renderpath for type-extensions - #1499
Conversation
The `child_path` variable can still be set from the attribute loop above, but then it has the wrong value. Without any attributes it is unset and causes an UnboundLocalError. Set it always to a proper value. Fixes: 0c8a3fc ("Add support to pass base-types to type extensions")
victorwon2001
left a comment
There was a problem hiding this comment.
Confirmed the fix against 1b7072c: rendering a raw string through an attribute-free simpleContent extension raises UnboundLocalError, while 907f6c8 renders it correctly. The full suite passes locally (475 passed, 18 skipped), and Ruff is clean.
Could you add a regression test for that attribute-free path? A minimal schema with <xsd:simpleContent><xsd:extension base="xsd:string"/></xsd:simpleContent> and element.render(..., "hello") reproduces the failure on main. That would keep this one-line fix covered.
The side-effect free function `render_node(…)` is called twice, remove the second call. Fixes: d88d427 ("When Nil is set on an element which is built …")
907f6c8 to
71761c8
Compare
|
I added a test like requested, making sure it fails without the fix and passes with the fix. While looking at the other tests to get an idea how to add my own, I noticed one of the tests in that file called |
The
child_pathvariable can still be set from the attribute loop above, but then it has the wrong value. Without any attributes it is unset and causes an UnboundLocalError. Set it always to a proper value.Fixes: 0c8a3fc ("Add support to pass base-types to type extensions")