<br><br><div class="gmail_quote">On Fri, Mar 2, 2012 at 05:22, Nick Coghlan <span dir="ltr">&lt;<a href="mailto:ncoghlan@gmail.com">ncoghlan@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Fri, Mar 2, 2012 at 10:55 PM, Stefan Krah &lt;<a href="mailto:stefan@bytereef.org">stefan@bytereef.org</a>&gt; wrote:<br>
&gt; Nick Coghlan &lt;<a href="mailto:ncoghlan@gmail.com">ncoghlan@gmail.com</a>&gt; wrote:<br>
&gt;&gt; However, given the lack of control, an assert() isn&#39;t the appropriate<br>
&gt;&gt; tool here - PyObject_GetBuffer itself should be *checking* the<br>
&gt;&gt; constraint and then reporting an error if the check fails. Otherwise a<br>
&gt;&gt; misbehaving extension module could trivially crash the Python<br>
&gt;&gt; interpreter by returning a bad Py_buffer.<br>
&gt;<br>
&gt; I&#39;m not so sure. Extension modules that use the C-API in wrong or<br>
&gt; undocumented ways can always crash the interpreter. This assert()<br>
&gt; should be triggered in the first unit test of the module. Now, if<br>
&gt; the module does not have unit tests or they don&#39;t test against a<br>
&gt; new Python version is that really our problem?<br>
<br>
</div>Crashing out with a C assert when we can easily give them a nice<br>
Python traceback instead is unnecessarily unfriendly.</blockquote><div><br></div><div>But you should keep in mind that for non-debug builds, asserts are generally off. So the behaviour most people see isn&#39;t actually a crash, but silent acceptance.</div>
<div><br></div></div>-- <br>Thomas Wouters &lt;<a href="mailto:thomas@python.org">thomas@python.org</a>&gt;<br><br>Hi! I&#39;m a .signature virus! copy me into your .signature file to help me spread!<br>