[issue6518] Enable 'with' statement in ossaudiodev module

2010-10-23 Thread Georg Brandl
Georg Brandl added the comment: Applied (with new test, and docs) in r85807. I also removed the AttributeError catch. -- nosy: +georg.brandl resolution: -> fixed status: open -> closed ___ Python tracker ___

[issue6518] Enable 'with' statement in ossaudiodev module

2010-02-23 Thread Jack Diederich
Jack Diederich added the comment: +1, the C patch looks good to me. The test file needs a new test that checks the 'with' behavior. Also, what changed so that the test now needs to ignore AttributeErrors in play_sound_file()? -- nosy: +jackdied _

[issue6518] Enable 'with' statement in ossaudiodev module

2009-08-26 Thread Art Gillespie
Art Gillespie added the comment: Hi Victor, I copied both the return NULL behavior in oss_exit and the oss_self naming from Objects/fileobject.c: http://paste.pocoo.org/show/136451/ Should they be changed there as well? -- ___ Python tracker

[issue6518] Enable 'with' statement in ossaudiodev module

2009-08-26 Thread STINNER Victor
STINNER Victor added the comment: @agillesp: a Python function should never return NULL without setting an error. oss_self() have to call a PyErr_(...) function to set an error. And I would prefer the name "oss_enter" than the unusual name "oss_self". -- nosy: +haypo __

[issue6518] Enable 'with' statement in ossaudiodev module

2009-08-21 Thread Art Gillespie
Art Gillespie added the comment: Diff attached * Added the __enter__ and __exit__ methods to the ossaudio object. * Updated tests so they pass (attempt to access ossaudio.closed throws AttributeError instead of TypeError) My first patch. Please let me know if I did anything terrifically stupi

[issue6518] Enable 'with' statement in ossaudiodev module

2009-07-25 Thread Benjamin Peterson
Changes by Benjamin Peterson : -- versions: -Python 2.6, Python 3.1 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscri

[issue6518] Enable 'with' statement in ossaudiodev module

2009-07-24 Thread Terry J. Reedy
Terry J. Reedy added the comment: Seems like a sensible idea. Note: 3.0 is no longer maintained. Marking 'easy' because I expect that copying and adapting __exit__ from regular open should be. -- keywords: +easy nosy: +tjreedy versions: -Python 3.0

[issue6518] Enable 'with' statement in ossaudiodev module

2009-07-18 Thread Jerzy Jalocha N
New submission from Jerzy Jalocha N : Actually, it is not possible to use the 'with' statement in the ossaudiodev module: >>> import ossaudiodev >>> with ossaudiodev.open('/dev/dsp', 'r') as device: ... pass ... Traceback (most recent call last): File "", line 1 in AttributeError: 'ossaud