Bugs in CPython 3.1.1 [wave.py]

Alf P. Steinbach alfps at start.no
Wed Jan 13 09:56:01 CET 2010


* Steven D'Aprano:
> On Wed, 13 Jan 2010 06:55:27 +0100, Alf P. Steinbach wrote:
> 
>> * Steven D'Aprano:
>>> On Tue, 12 Jan 2010 23:47:31 +0100, Alf P. Steinbach wrote:
>>>
>>>>> PS: Next time it would have helped to include a URL to the issue.
>>>>>
>>>>>     http://bugs.python.org/issue7681
>>>>>
>>>>>     FYI there is already some feedback in the tracker.
>>>> Yeah, someone who had the bright idea that maybe there isn't a bug,
>>>> thinking instead that maybe a "wrong" name in *a comment* might be the
>>>> culprit  --  of all things!
>>>>
>>>> He was probably just trying to be helpful.
>>>>
>>>> But what do you say to someone who tries to help but is really just
>>>> making a mess of things?
>>> Before pointing out the mote in another person's eye, you should
>>> consider the enormous beam in yours. You initially reported a
>>> completely bogus error (NameError: name 'framerate' is not defined) and
>>> Brian responded to that.
>>>
>>> I don't know why you're claiming he was responding to a name that was
>>> commented out, when you included a traceback clearly showing that the
>>> line was executed.
>> No, the out-commented line was not executed and was not shown in any
>> traceback.
> 
> I have no idea what commented lines NOT shown you are talking about, but 
> you attacked Brian for referring to the NameError relating to framerate. 

Well, first, let me state that this is debating details of something irrelevant 
to anything.


Now, that said, Brian responded (first response, Brian subsequently made a patch 
which fixed not just the bugs but also the unit test, so very good everything!),


<quote>
   In your example, the "n_frames" name does not exist, which is causing the
   problem. In your first comment, "framerate" also did not exist.

   I don't know what a proper frame rate value is, but I just put 10 in there
   and it worked fine. Can you confirm?
</quote>


Note that the "n_frames" that Brian here thinks "is causing the problem" is a 
name only used in a comment in the demo code.


> You claimed that he was:
> 
>     thinking instead that maybe a "wrong" name in *a comment* 
>     might be the culprit
> 
> But in fact your initial error report included this traceback, which 
> displays a very much uncommented line of code:
> 
> Traceback (most recent call last):
>   File "C:\Documents and Settings\Alf\sound\error.py", line 6, in <module>
>     writer.setframerate( framerate )
> NameError: name 'framerate' is not defined

Note (1) that "n_frames" does *not* occur here  --  or anywhere.

And that (2) the error report included this correction:

<quote>
   Sorry, here's correct error message:

Traceback (most recent call last):
   File "C:\Documents and Settings\Alf\sound\error.py", line 8, in <module>
     writer.writeframes( b"\0"*2*4 )
   File "C:\Program Files\cpython\python31\lib\wave.py", line 432, in writeframes
     self.writeframesraw(data)
   File "C:\Program Files\cpython\python31\lib\wave.py", line 416, in writeframesraw
     self._ensure_header_written(len(data))
   File "C:\Program Files\cpython\python31\lib\wave.py", line 459, in 
_ensure_header_written
     self._write_header(datasize)
   File "C:\Program Files\cpython\python31\lib\wave.py", line 472, in _write_header
     self._sampwidth * 8, 'data'))
struct.error: required argument is not an integer
Exception struct.error: 'required argument is not an integer' in <bound method 
Wave_write.__del__ of <wave.Wave_write ob
ject at 0x00FE87F0>> ignored
</quote>

Which you can see that Brian was very well aware of, since he referred to <q>In 
your first comment, "framerate" also did not exist.</q>, as opposed to this 
corrected output.

But again, even though he did get off on the wrong foot, probably assuming that 
it was a novice posting (and regarding Python I'm still a novice!), after that 
he did superb job. So very much thanks to him, people will not have to struggle 
with this bug. And perhaps the [wave] module will start getting more used! :-)


> Alf, I know you are able to read tracebacks, because you've demonstrated 
> the ability in the past. And I'm pretty sure that you're aware that can 
> too, because you're not an idiot.
> 
> So what puzzles me is, given that you can read the traceback you posted, 
> and we can too, why on earth do you claim that the reference to framerate 
> was commented out? The line that was executed is right there.

I don't claim and haven't claimed that framerate was commented out.

I referred to the fact that Brian (at first) thought that "n_frames" was, quote, 
"causing the problem", and that that name only occurred in a comment.


>> Comments are not executed.
> 
> Really? Well, that explains why none of my programs do anything!
> 
> *wink*
> 
> 
> 
>> The error report included the line numbers of the buggy lines, plus a
>> correction of the output: I first pasted incorrect error message, then
>> corrected that *immediately*. But I just found no way to edit the
>> original message, so both that and the correction ended up present. The
>> correction with "Sorry, here's the correct message", or words to that
>> effect. In the one and only original submission.
> 
> Right. A simple, silly error that anyone could have made. We've all made 
> similarly embarrassing mistakes.
> 
> But you then responded with a public put-down on Brian all out of 
> proportion for his sin of *answering your initial post*. And that just 
> makes you look obnoxious.

Nah, I didn't mention his name nor link to the error report.

Because I've made similar mistakes based on too low intake of coffee.

And after that, as mentioned, he did a superb job! :-)



>> it is not the case
>> that I have strong feelings or any feelings at all about that bug report
>> or any other.
> 
> Reading back over this thread, it's obvious how cool, calm and collected 
> you are. I can't imagine what I was thinking, that somebody who would say
> 
> "Well how f*****g darn patient do they expect me to be?"
> 
> has strong feelings over the issue? 

Of course I had strong feelings about the time wasted on the bug, and I'm not 
one to hold my tongue, in general...

But no strong feelings about the bug report or handling of it.

I'm sure that you can understand that distinction, the two very different issues 
(time wasted versus a puzzling Thorbjørning) now that I point it out, yes?

Just for good measure, let me once again point out that Brian, whom I didn't 
name or refer to then, turned out to then do a superb job.

And in about no time at all.


Cheers,

- Alf



More information about the Python-list mailing list