<?xml  version="1.0" ?><html>
<head>
<title></title>
</head>
<body>
<div align="left"><font face="Arial"><span style="font-size:10pt">On 29 Jan 2005 at 23:34, Yann Vernier wrote:</span></font></div>
<div align="left"><br/>
</div>
<div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">&gt; On Sun, Jan 30, 2005 at 09:28:03AM +1100, sjmachin@lexicon.net wrote:</span></font></div>
<div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">&gt; &gt; On 30 Jan 2005 at 9:58, Greg Ewing wrote:</span></font></div>
<div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">&gt; &gt; </span></font></div>
<div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">&gt; &gt; &gt; sjmachin@lexicon.net wrote:</span></font></div>
<div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">&gt; &gt; &gt; &gt; Where I'm coming from is (my belief/understanding) that a &quot;Python 
function&quot; hand </span></font></div>
<div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">&gt; &gt; &gt; &gt; coded in C _should_ return NULL in this circumstance, so that the precise 
exception set </span></font></div>
<div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">&gt; &gt; &gt; &gt; by the called function can be thrown, instead of a guess.</span></font></div>
<div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">&gt; &gt; &gt; </span></font></div>
<div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">&gt; &gt; &gt; Oh, I see what you mean. Yes, that's what you would do</span></font></div>
<div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">&gt; &gt; &gt; if you were writing an extension module in C by hand.</span></font></div>
<div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">&gt; &gt; &gt; But in Pyrex you just use a &quot;raise&quot; statement, and</span></font></div>
<div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">&gt; &gt; &gt; Pyrex takes care of returning the NULL.</span></font></div>
<div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">&gt; &gt; </span></font></div>
<div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">&gt; &gt; Apparently not: as one might expect, it generates code to do what Python does with 
a </span></font></div>
<div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">&gt; &gt; bare &quot;raise&quot; statement -- i.e. *RE*raise an already raised exception.</span></font></div>
<div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">&gt; &gt; </span></font></div>
<div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">&gt; &gt; In my scenario, PyString_AsStringAndSize has *set* an exception, but it has not yet </span></font></div>
<div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">&gt; &gt; been raised; we need to return NULL back down the call chain until the exception 
is </span></font></div>
<div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">&gt; &gt; raised.</span></font></div>
<div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">&gt; </span></font></div>
<div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">&gt; That's what the cdef function() except NULL form is for, isn't it? This</span></font></div>
<div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">&gt; makes Pyrex check for exceptions when the function returns the indicated</span></font></div>
<div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">&gt; value, if I understood the docs correctly.</span></font></div>
<div align="left"><br/></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">I see no cdef here.</span></font></div>
<div align="left"><br/></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">From my sample code:</span></font></div>
<div align="left"><br/>
</div>
<div align="left"><font face="Courier New"><span style="font-size:10pt">def tester(s):</span></font></div>
<div align="left"></div>
</body>
</html>