Re: [Python-3000] Single buffer implied in new buffer protocol?

2008-06-05 Thread Stefan Behnel
Greg Ewing wrote: > Stefan Behnel wrote: >> So you'd always have to release your own read buffer before acquiring a >> write buffer > > Yes, you really want to be able to upgrade your own lock > from a read lock to a write lock, which means the provider > has to keep track of who the lock holder i

Re: [Python-3000] Single buffer implied in new buffer protocol?

2008-06-05 Thread Nick Coghlan
Stefan Behnel wrote: One question: what does that mean for the mutable bytearray class? How would that handle locking? In a single-threaded app, or one where only a single thread at a time can access the object providing the buffer interface, no locking is needed (that's the main advantage of

Re: [Python-3000] Single buffer implied in new buffer protocol?

2008-06-05 Thread Stefan Behnel
Nick Coghlan wrote: > Stefan Behnel wrote: >> One question: what does that mean for the mutable bytearray class? How >> would that handle locking? > > No need to confuse the question of memory access with the question of > thread synchronisation. Fair enough. Single-threaded code is extremely com

[Python-3000] How to specify keyword-only arguments from C?

2008-06-05 Thread Alexandre Vassalotti
Hi, Is there a way to specify keyword-only arguments using the C API. I searched through the mailing list archive, read PEP 3102 and grep-ed the codebase, but I found nothing looking like a C API. So I am wondering, is this a Python-only feature? -- Alexandre _

Re: [Python-3000] How to specify keyword-only arguments from C?

2008-06-05 Thread Guido van Rossum
On Thu, Jun 5, 2008 at 7:02 PM, Nick Coghlan <[EMAIL PROTECTED]> wrote: > Alexandre Vassalotti wrote: >> Is there a way to specify keyword-only arguments using the C API. I >> searched through the mailing list archive, read PEP 3102 and grep-ed >> the codebase, but I found nothing looking like a C

Re: [Python-3000] How to specify keyword-only arguments from C?

2008-06-05 Thread Alexandre Vassalotti
On Thu, Jun 5, 2008 at 10:50 PM, Guido van Rossum <[EMAIL PROTECTED]> wrote: > I believe Alexandre is familiar with PyArg_ParseTupleAndKeywords(), > but its API doesn't let you specify keywords that have no positional > equivalent. He's after the C equivalent of > > def foo(*, a, b): ... > > where

Re: [Python-3000] Single buffer implied in new buffer protocol?

2008-06-05 Thread Greg Ewing
Stefan Behnel wrote: So that means it's fine to remove all locking related functionality from the new buffer protocol and leave everything to application space, right? Not quite all of it -- the buffer needs to be considered as locked against moving between calls to getbuffer and releasebuffer,

[Python-3000] wrt the beta deadline and freelist management

2008-06-05 Thread Andrew MacIntyre
There are 2 disparate approaches to clearing/compacting free lists for basic types: - APIs of the form Py_ClearFreeList() called from gc.collect() [class, frame, method, tuple & unicode types]; - APIs of the form Py_CompactFreeList() called from sys._compact_freelists() [int & float types];

Re: [Python-3000] How to specify keyword-only arguments from C?

2008-06-05 Thread Stefan Behnel
Alexandre Vassalotti wrote: > Is there a way to specify keyword-only arguments using the C API. I > searched through the mailing list archive, read PEP 3102 and grep-ed > the codebase, but I found nothing looking like a C API. So I am > wondering, is this a Python-only feature? Cython also has it.

Re: [Python-3000] Single buffer implied in new buffer protocol?

2008-06-05 Thread Stefan Behnel
Greg Ewing wrote: > Stefan Behnel wrote: >> So that means it's fine to remove all locking related functionality >> from the >> new buffer protocol and leave everything to application space, right? > > Not quite all of it -- the buffer needs to be considered > as locked against moving between calls

Re: [Python-3000] Single buffer implied in new buffer protocol?

2008-06-05 Thread Stefan Behnel
Stefan Behnel wrote: > So that means it's fine to remove all locking related functionality from the > new buffer protocol and leave everything to application space, right? > > Here is a patch for the PEP that reflects this. I filed this as bug #3046. http://bugs.python.org/issue3046 Stefan ___