https://saxonica.plan.io/https://saxonica.plan.io/favicon.ico2022-05-26T21:59:53ZSaxonica Developer CommunitySaxonC - Bug #5542: Python example causes segmentation errorhttps://saxonica.plan.io/issues/5542?journal_id=208632022-05-26T21:59:53ZO'Neil Delprattoneil@saxonica.com
<ul></ul><p>The workaround is to replace the following code:</p>
<pre><code class="python syntaxhl" data-language="python"> <span class="n">executable</span><span class="p">.</span><span class="n">set_parameter</span><span class="p">(</span><span class="s">"param"</span><span class="p">,</span><span class="n">proc</span><span class="p">.</span><span class="n">make_string_value</span><span class="p">(</span><span class="s">"text"</span><span class="p">))</span>
</code></pre>
<p>With the below code which creates a variable for the XdmAtomicValue:</p>
<pre><code class="python syntaxhl" data-language="python"> <span class="n">value1</span><span class="o">=</span> <span class="n">proc</span><span class="p">.</span><span class="n">make_string_value</span><span class="p">(</span><span class="s">"text"</span><span class="p">)</span>
<span class="n">executable</span><span class="p">.</span><span class="n">set_parameter</span><span class="p">(</span><span class="s">"param"</span><span class="p">,</span><span class="n">value1</span><span class="p">)</span>
</code></pre> SaxonC - Bug #5542: Python example causes segmentation errorhttps://saxonica.plan.io/issues/5542?journal_id=208642022-05-26T22:01:55ZO'Neil Delprattoneil@saxonica.com
<ul></ul><p>This bug issue looks the same as the following: <a class="issue tracker-1 status-3 priority-2 priority-default closed" title="Bug: segfault when setting xslt parameter in a loop (Closed)" href="https://saxonica.plan.io/issues/5533">#5533</a></p> SaxonC - Bug #5542: Python example causes segmentation errorhttps://saxonica.plan.io/issues/5542?journal_id=208662022-05-26T22:02:05ZO'Neil Delprattoneil@saxonica.com
<ul><li><strong>Related to</strong> <i><a class="issue tracker-1 status-3 priority-2 priority-default closed" href="/issues/5533">Bug #5533</a>: segfault when setting xslt parameter in a loop</i> added</li></ul> SaxonC - Bug #5542: Python example causes segmentation errorhttps://saxonica.plan.io/issues/5542?journal_id=208692022-05-27T06:39:37ZO'Neil Delprattoneil@saxonica.com
<ul><li><strong>Related to</strong> <i><a class="issue tracker-1 status-3 priority-1 priority-lowest closed" href="/issues/5452">Bug #5452</a>: set_source and set_output_file functions don't exists but are in examples</i> added</li></ul> SaxonC - Bug #5542: Python example causes segmentation errorhttps://saxonica.plan.io/issues/5542?journal_id=208932022-05-30T13:28:25ZO'Neil Delprattoneil@saxonica.com
<ul><li><strong>Status</strong> changed from <i>New</i> to <i>Resolved</i></li><li><strong>% Done</strong> changed from <i>0</i> to <i>100</i></li></ul><p>During the debugging phase the Python <code>sys.getrefcount(object)</code> was useful to check for objects not used anywhere else.</p>
<p>The fix was to add the C++ <code>XdmValue.incrementRefCount()</code> method call in the <code>PyXsltExecutable.set_parameter</code>.
This prevents the Python garbage collection mechanism from deleting the PyXdmValue before it is used in the internal processor.</p>
<p>Bug fix committed on the saxon11 and main branches.</p> SaxonC - Bug #5542: Python example causes segmentation errorhttps://saxonica.plan.io/issues/5542?journal_id=214962022-07-28T17:00:31ZO'Neil Delprattoneil@saxonica.com
<ul><li><strong>Status</strong> changed from <i>Resolved</i> to <i>Closed</i></li><li><strong>Fixed in version</strong> set to <i>11.4</i></li></ul><p>Bug fix applied in the SaxonC 11.4 maintenance release.</p>