Re: [Python-Dev] Memory Allocator Part 2: Did I get it right?

2005-03-05 Thread Martin v. Löwis
Brett C. wrote:
Assuming a code review says the patch is sane, do we want to go with 
this garbage collection change?  From past discussions I don't remember 
a consensus on acceptance or rejection, just lots of discussion about 
ripping out the hacks to allow freeing memory w/o holding the GIL (I 
assume Evan's patch rips that code out).
I think the consensus is that the feature is desirable. So if the code
is correct, it should be checked in.
Regards,
Martin
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Documentation for __new__

2005-03-05 Thread Greg Ward
On 05 March 2005, Nick Coghlan said:
> Steven Bethard has put together some text to add __new__ to the list of 
> Basic Customisation methods in the language reference. Would one of the 
> documentation folks care to take a look at it?

I've tried to tighten up the text there and hopefully make it a smidgeon
clearer and more accurate.  Here's my best effort:

  __new__(cls[, ...])

  Called to create a new instance of class 'cls'.  __new__()
  is a static method (special-cased so you need not declare it
  as such) that takes the class to create an instance of as
  the first argument.  The remaining arguments are those
  passed to the object constructor expression.  The return
  value of __new__() should be the new object instance.

  Typical usage is to create a new instance of the class by
  invoking the superclass's __new__() method using
  "super(currentclass, cls).__new__([...])" with appropriate
  arguments, modifying the returned instance if necessary, and
  then returning it.  If the returned value is an instance of
  'cls', its __init__() will be invoked like
  "__init__(self[, ...])", where the extra arguments are the
  same as were passed to __new__().

  You do need not to return an instance of 'cls', but if you
  do not, the new instance's __init__() method will not be
  invoked.

  __new__() is intended mainly to allow subclasses of
  immutable types (like int, str, or tuple) to customize
  instance creation.

Feedback welcome.  Has anyone volunteered to render this in LaTeX yet?
If not, I might.

Greg
-- 
Greg Ward <[EMAIL PROTECTED]> http://www.gerg.ca/
I hope something GOOD came in the mail today so I have a REASON to live!!
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] ossaudiodev test failure

2005-03-05 Thread Greg Ward
I just discovered that the ossaudiodev test fails on Linux 2.6 with
ALSA's OSS emulation layer.  I'm pretty sure this can be blamed on ALSA
(The difference is this: if you pass bogus sampling parameters to
setparameters(), OSS will accept the request and set the hardware to
something reasonable, while ALSA will reject the request by returning -1
and setting errno, which becomes IOException.)  (IMHO,
test_ossaudiodev.py should not test this feature if it's not reliably
emulated by ALSA.)

Anyways, if you're running Linux or FreeBSD, or any other OS that
contains OSS drivers or OSS emulation, can you please run

  ./python ./Lib/test/test_ossaudiodev.py

from your CVS tree and email me the following info:

  * whether the test passed or not
  * what version of what OS you're running
  * what sound hardware you have
  * (Linux only) are you using ALSA or OSS?
  * whether other audio software (eg. xmms, xine, mpg123, audacity)
works for you 

A passing test looks like this:

  playing test sound file...
  elapsed time: 3.1 sec

and has a uniquely Pythonesque sound.  ;-)  The failure I've been seeing
is this (you'll see a slightly different traceback, because I've
refactored the code a bit in my working dir):

  playing test sound file...
  elapsed time: 3.1 sec
  Traceback (most recent call last):
File "Lib/test/test_ossaudiodev.py", line 147, in ?
  test()
File "Lib/test/test_ossaudiodev.py", line 142, in test
  test_bad_setparameters(dsp)
File "Lib/test/test_ossaudiodev.py", line 125, in test_bad_setparameters
  result = dsp.setparameters(fmt, channels, rate, False)
  IOError: [Errno 22] Invalid argument

Oh, to find out if you're using ALSA or OSS:

  * run "lsmod" and look for a bunch of modules starting with "snd_" --
this is ALSA

  * look for device files like /dev/snd/pcmC0D* -- ALSA again

If you're using ALSA and /dev/dsp doesn't work, try
"modprobe snd_pcm_oss" -- that's the OSS emulation layer.

Thanks!

Greg
-- 
Greg Ward <[EMAIL PROTECTED]> http://www.gerg.ca/
I used to be a FUNDAMENTALIST, but then I heard about the HIGH
RADIATION LEVELS and bought an ENCYCLOPEDIA!!
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Documentation for __new__

2005-03-05 Thread Steven Bethard
On Sat, 5 Mar 2005 11:39:42 -0500, Greg Ward <[EMAIL PROTECTED]> wrote:
> On 05 March 2005, Nick Coghlan said:
> > Steven Bethard has put together some text to add __new__ to the list of
> > Basic Customisation methods in the language reference. Would one of the
> > documentation folks care to take a look at it?
[snip]
>   Typical usage is to create a new instance of the class by
>   invoking the superclass's __new__() method using
>   "super(currentclass, cls).__new__([...])"

Sorry I didn't catch this originally, but this should be
"super(currentclass, cls).__new__(cls[, ...])"
since __new__ is a staticmethod.

Steve Bethard
-- 
You can wordify anything if you just verb it.
--- Bucky Katt, Get Fuzzy
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com