Re: [Python-Dev] io.BufferedReader.peek() Behaviour in python3.1

2009-06-16 Thread MRAB
Cameron Simpson wrote: On 16Jun2009 02:18, MRAB pyt...@mrabarnett.plus.com wrote: My itch is that peek() _feels_ like it should be look into the buffer but actually can block and/or change the buffer. Can block, but not if you don't want it too. You might just want to see what, if anything,

Re: [Python-Dev] Avoiding file descriptors leakage in subprocess.Popen()

2009-06-16 Thread Steven D'Aprano
On Tue, 16 Jun 2009 01:20:53 pm Cameron Simpson wrote: I don't think all pythons do immediate ref-counted GC. Jython and IronPython don't. I don't know about PyPy, CLPython, Unladen Swallow, etc. -- Steven D'Aprano ___ Python-Dev mailing list

Re: [Python-Dev] Avoiding file descriptors leakage in subprocess.Popen()

2009-06-16 Thread Michael Foord
Steven D'Aprano wrote: On Tue, 16 Jun 2009 01:20:53 pm Cameron Simpson wrote: I don't think all pythons do immediate ref-counted GC. Jython and IronPython don't. I don't know about PyPy, CLPython, Unladen Swallow, etc. PyPy doesn't, Unladen Swallow won't. Michael --

Re: [Python-Dev] io.BufferedReader.peek() Behaviour in python3.1

2009-06-16 Thread Lucas P Melo
Cameron Simpson wrote: Indeed, though arguably read1() is a lousy name too, on the same basis. My itch is that peek() _feels_ like it should be look into the buffer but actually can block and/or change the buffer. I guess all the buffer operations should be transparent to the user if he

Re: [Python-Dev] io.BufferedReader.peek() Behaviour in python3.1

2009-06-16 Thread Lucas P Melo
MRAB wrote: I was thinking along the lines of: def peek(self, size=None, block=True) I think this is fine too. :) If 'block' is True then return 'size' bytes, unless the end of the file/stream is reached; if 'block' is False then return up to 'size' bytes, without blocking. The blocking

Re: [Python-Dev] Avoiding file descriptors leakage in subprocess.Popen()

2009-06-16 Thread Willem Broekema
On Tue, Jun 16, 2009 at 1:21 PM, Michael Foordfuzzy...@voidspace.org.uk wrote: Steven D'Aprano wrote: On Tue, 16 Jun 2009 01:20:53 pm Cameron Simpson wrote: I don't think all pythons do immediate ref-counted GC. Jython and IronPython don't. I don't know about PyPy, CLPython, Unladen Swallow,

[Python-Dev] SSL Certificate Validation

2009-06-16 Thread Devin Cook
Hi all, I have a few questions about validating SSL certificates. From what I gather, this validation occurs in the OpenSSL code called from _ssl.c. Is this correct? Also, I have looked through the docs and code, but haven't been able to figure out exactly what is included in certificate

Re: [Python-Dev] Avoiding file descriptors leakage in subprocess.Popen()

2009-06-16 Thread Mark Seaborn
Cameron Simpson c...@zip.com.au wrote: On 14Jun2009 16:42, Mark Seaborn m...@mythic-beasts.com wrote: | I use a convenience function like this, so that GC takes care of the FDs: | | def make_pipe(): | read_fd, write_fd = os.pipe() | return os.fdopen(read_fd, r), os.fdopen(write_fd,

Re: [Python-Dev] io.BufferedReader.peek() Behaviour in python3.1

2009-06-16 Thread Glenn Linderman
On approximately 6/16/2009 11:20 AM, came the following characters from the keyboard of Scott David Daniels: MRAB wrote: I was thinking along the lines of: def peek(self, size=None, block=True) If 'block' is True then return 'size' bytes, unless the end of the file/stream is reached; if

Re: [Python-Dev] io.BufferedReader.peek() Behaviour in python3.1

2009-06-16 Thread Antoine Pitrou
Scott David Daniels Scott.Daniels at Acm.Org writes: MRAB wrote: I was thinking along the lines of: def peek(self, size=None, block=True) If 'block' is True then return 'size' bytes, unless the end of the file/stream is reached; if 'block' is False then return up to 'size' bytes,

Re: [Python-Dev] SSL Certificate Validation

2009-06-16 Thread Martin v. Löwis
I have a few questions about validating SSL certificates. From what I gather, this validation occurs in the OpenSSL code called from _ssl.c. Is this correct? This question is really off-topic for python-dev. As a python-dev poster, you should do research upfront, and only post on what you

Re: [Python-Dev] SSL Certificate Validation

2009-06-16 Thread Jesse Noller
On Tue, Jun 16, 2009 at 3:23 PM, Martin v. Löwismar...@v.loewis.de wrote: I have a few questions about validating SSL certificates. From what I gather, this validation occurs in the OpenSSL code called from _ssl.c. Is this correct? This question is really off-topic for python-dev. As a

Re: [Python-Dev] SSL Certificate Validation

2009-06-16 Thread Martin v. Löwis
This question is really off-topic for python-dev. As a python-dev poster, you should do research upfront, and only post on what you consider facts. Martin, I told him to ask his question about _ssl internals on python-dev as he is new, and looking to work on some of the internals/make a

Re: [Python-Dev] SSL Certificate Validation

2009-06-16 Thread Devin Cook
But I really do believe that this is what he need to do next: familiarize himself with OpenSSL. There is a lot of APIs in that library, and it takes a while (i.e.: several months) to get productive, in particular since OpenSSL doesn't have the most intuitive API. Well, I realized this as

Re: [Python-Dev] SSL Certificate Validation

2009-06-16 Thread Bill Janssen
Devin Cook devin.c.c...@gmail.com wrote: Also, I have looked through the docs and code, but haven't been able to figure out exactly what is included in certificate validation. Is it just validating the chain? Does it check the NotBefore and NotAfter dates? I believe so, but you'll have to

Re: [Python-Dev] SSL Certificate Validation

2009-06-16 Thread Jesse Noller
On Tue, Jun 16, 2009 at 5:31 PM, Devin Cookdevin.c.c...@gmail.com wrote: But I really do believe that this is what he need to do next: familiarize himself with OpenSSL. There is a lot of APIs in that library, and it takes a while (i.e.: several months) to get productive, in particular since

Re: [Python-Dev] SSL Certificate Validation

2009-06-16 Thread Martin v. Löwis
If this isn't the place to ask these kinds of questions, I apologise. I can take the discussion elsewhere if I need to. It really depends on what these questions are. If your question is I have this patch, is it correct?, then the question is entirely appropriate. If it is I just have barely

Re: [Python-Dev] io.BufferedReader.peek() Behaviour in python3.1

2009-06-16 Thread Greg Ewing
Cameron Simpson wrote: I normally avoid non-blocking requirements by using threads, so that the thread gathering from the stream can block. If you have a thread dedicated to reading from that stream, then I don't see why you need to peek into the buffer. Just have it loop reading a packet at a

[Python-Dev] Functions that steal references (Re: [pygame] [patch] minor memory leaks...)

2009-06-16 Thread Greg Ewing
Lenard Lindstrom wrote: I assumed that since PyModule_AddObject is documented as stealing a reference, it always stole a reference. But in reality it only does so conditionally, when it succeeds. As an aside, is this a general feature of functions that steal references, or is

Re: [Python-Dev] Functions that steal references (Re: [pygame] [patch] minor memory leaks...)

2009-06-16 Thread Christian Heimes
Benjamin Peterson schrieb: 2009/6/16 Greg Ewing greg.ew...@canterbury.ac.nz: Lenard Lindstrom wrote: I assumed that since PyModule_AddObject is documented as stealing a reference, it always stole a reference. But in reality it only does so conditionally, when it succeeds. As an aside, is

Re: [Python-Dev] io.BufferedReader.peek() Behaviour in python3.1

2009-06-16 Thread Antoine Pitrou
Greg Ewing greg.ewing at canterbury.ac.nz writes: Anything else such as peek() that doesn't explicitly mention the buffer should fit into the abstraction properly. peek() doesn't fit into the abstraction since it doesn't even exist on raw streams. While buffered and non-buffered streams

Re: [Python-Dev] Functions that steal references (Re: [pygame] [patch] minor memory leaks...)

2009-06-16 Thread Greg Ewing
Christian Heimes wrote: But it is a convenient oddity nonetheless. What's convenient about it? Seems to me it's the opposite, since you can't just bail out if it fails, but have to decref the reference you thought it was going to take care of for you. -- Greg

Re: [Python-Dev] io.BufferedReader.peek() Behaviour in python3.1

2009-06-16 Thread Cameron Simpson
On 17Jun2009 10:55, Greg Ewing greg.ew...@canterbury.ac.nz wrote: Cameron Simpson wrote: I normally avoid non-blocking requirements by using threads, so that the thread gathering from the stream can block. If you have a thread dedicated to reading from that stream, then I don't see why you

Re: [Python-Dev] io.BufferedReader.peek() Behaviour in python3.1

2009-06-16 Thread Frederick Reeve
On Sat, 13 Jun 2009 12:33:46 + (UTC) Antoine Pitrou solip...@pitrou.net wrote: This proposal looks reasonable to me. Please note that it's too late for 3.1 anyway - we're in release candidate phase. Once you have a patch, you can post it on the bug tracker. Thanks I will do that.