Re: Twisted on Windows

2010-11-18 Thread Jean-Paul Calderone
On Nov 18, 9:58 am, Bryan Richardson btri...@gmail.com wrote:
 Hello All,

 First off I must say that Twisted is a very nice event driven I/O
 package indeed. Thanks to all the developers who have contributed to
 it, as it's made my life much easier.

 Now for my question...

 I have a custom server application, and I have it structured as such:

 MyServerApp/ -- root directory
    server.py
    foo/
       __init__.py
       factory.py

 In my server.py file, which is a Twistd config file that can be
 executed with twistd -ny server.py, I have the following import line:

 from foo.factory import MyServerFactory

 When I run 'twistd -ny server.py' on my Linux machine from within the
 root MyServerApp directory, all works as expected. However, when I try
 to do the same thing on a Windows machine using the twistd script that
 gets installed, I get an error saying that foo.factory cannot be
 found. However, if I modify my server.py file on Windows to just
 create the factory and start the reactor, I can run it just fine with
 'python server.py' even though it still has the import line for
 MyServerFactory.

 Bottom line is, on Windows, the python executable can find my custom
 module in a sub directory but the twistd script cannot. Any ideas why
 this is?


When you run a .py file, python adds the directory containing that .py
file to the front of sys.path.  So when you run server.py,
MyServerApp/
is added to sys.path and the foo package can be found.  This happens
on
Linux and Windows.

When you run twistd, the .py file you're running is /usr/bin/twistd
or C:\Python26\Scripts\twistd or something else along those lines.  So
Python adds /usr/bin or C:\Python26\Scripts to sys.path.  This doesn't
help you find the foo package at all.

On Linux, when not running as root, twistd adds the current working
directory to sys.path.  So if your working directory is MyServerApp,
then the foo package can be found.

When running as root, or when running on Windows, twistd does not add
the working directory to sys.path.

So with all that in mind, the solution should be pretty clear - just
set PYTHONPATH to include MyServerApp.

This variation of twistd behavior is pretty confusing, and I think a
future version may drop the sys.path manipulation entirely, so that
it behaves consistently in all configurations.

Jean-Paul
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is Unladen Swallow dead?

2010-11-18 Thread Jean-Paul Calderone
On Nov 18, 1:31 pm, John Nagle na...@animats.com wrote:
 On 11/18/2010 4:24 AM, BartC wrote:









  John Nagle na...@animats.com wrote in message
 news:4ce37e01$0$1666$742ec...@news.sonic.net...
  On 11/16/2010 10:24 PM, swapnil wrote:

  AFAIK, the merging plan was approved by Guido early this year. I
  guess Google is expecting the community to drive the project
  from here on. That was the whole idea for merging it to mainline.
  From my last conversation with Collin, they are targeting Python
  3.3

  I think it's dead. They're a year behind on quarterly releases.
  The last release was Q3 2009. The project failed to achieve its
  stated goal of a 5x speedup. Not even close. More like 1.5x
  (http://www.python.org/dev/peps/pep-3146)

  There must have been good reasons to predict a 5x increase.

      For Java, adding a JIT improved performance by much more than that.
 Hard-code compilers for LISP have done much better than 5x.  The
 best Java and LISP compilers approach the speed of C, while CPython
 is generally considered to be roughly 60 times slower than C.  So
 5x probably looked like a conservative goal.  For Google, a company
 which buys servers by the acre, a 5x speedup would have a big payoff.

  Assuming the 5x speedup was shown to be viable (ie. performing the
  same benchmarks, on the same data, can be done that quickly in any
  other language, and allowing for the overheads associated with
  Python's dynamic nature), then what went wrong?

       Python is defined by what a naive interpreter with late binding
 and dynamic name lookups, like CPython, can easily implement.  Simply
 emulating the semantics of CPython with generated code doesn't help
 all that much.

       Because you can monkey patch Python objects from outside the
 class, a local compiler, like a JIT, can't turn name lookups into hard
 bindings.  Nor can it make reliable decisions about the types of
 objects.  That adds a sizable performance penalty. Short of global
 program analysis, the compiler can't tell when code for the hard cases
 needs to be generated.  So the hard-case code, where you figure out at
 run-time, for ever use of +, whether + is addition or concatenation,
 has to be generated every time.  Making that decision is far slower
 than doing an add.


This isn't completely accurate.  It *is* possible to write a JIT
compiler
for a Python runtime which has fast path code for the common case, the
case
where the meaning of + doesn't change between every opcode.  PyPy
has
produced some pretty good results with this approach.

For those who haven't seen it yet, http://speed.pypy.org/ has some
graphs
which reflect fairly well on PyPy's performance for benchmarks that
are not
entirely dissimilar to real world code.

Jean-Paul
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Getting references to objects without incrementing reference counters

2010-11-15 Thread Jean-Paul Calderone
On Nov 15, 10:42 am, de...@web.de (Diez B. Roggisch) wrote:
 And circumvene a great deal of the dynamic features in python
 (which you don't need for this usecase, but still are there)


Great as the features might be, when you don't need them, it's clearly
a bad thing to have them drag you down.  Fortunately the PyPy team is
making great progress in implementing a runtime that transparently
sheds
those dynamic features when running a program that doesn't take
advantage
of them.

Jean-Paul
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Getting references to objects without incrementing reference counters

2010-11-14 Thread Jean-Paul Calderone
On Nov 14, 11:08 am, Artur Siekielski artur.siekiel...@gmail.com
wrote:
 Hi.
 I'm using CPython 2.7 and Linux. In order to make parallel
 computations on a large list of objects I want to use multiple
 processes (by using multiprocessing module). In the first step I fill
 the list with objects and then I fork() my worker processes that do
 the job.

 This should work optimally in the aspect of memory usage because Linux
 implements copy-on-write in forked processes. So I should have only
 one physical list of objects (the worker processes don't change the
 objects on the list). The problem is that after a short time children
 processes are using more and more memory (they don't create new
 objects - they only read objects from the list and write computation
 result to the database).

 After investigation I concluded the source of this must be
 incrementing of a reference counter when getting an object from the
 list. It changes only one int but OS must copy the whole memory page
 to the child process. I reimplemented the function for getting the
 element (from the file listobject.c) but omitting the PY_INCREF call
 and it solved my problems with increasing memory.

 The questions is: are there any better ways to have a real read-only
 list (in terms of memory representation of objects)? My solution is of
 course not safe. I thought about weakrefs but it seems they cannot be
 used here because getting a real reference from a weakref increases a
 reference counter. Maybe another option would be to store reference
 counters not in objects, but in a separate array to minimize number of
 memory pages they occupy...

It might be interesting to try with Jython or PyPy.  Neither of these
Python runtimes uses reference counting at all.

Jean-Paul
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: udp sockets with python

2010-11-11 Thread Jean-Paul Calderone
On Nov 10, 9:23 pm, Tim Roberts t...@probo.com wrote:
 Mag Gam magaw...@gmail.com wrote:

 I am measuring the round trip time using tcpdump. The C version is
 giving me around 80 microseconds (average) and the python is giving me
 close to 300 microseconds (average).

 If you need the performance of a compiled language, then it's probably not
 appropriate to use an interpreter.

Ridiculous.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: udp sockets with python

2010-11-09 Thread Jean-Paul Calderone
On Nov 9, 5:20 am, Mag Gam magaw...@gmail.com wrote:
 Hello,

 When measuring round trip time for the UDP echo client/server the C
 version is much faster. I was wondering if there is anything I can do
 to speed up.

 My current code for client looks like this

 sock=socket(AF_INET,SOCK_DGRAM)
 for x in range (1000):
   sock.sendto(foo,(server,port))
   a=sock.recv(256)

 sock.close()

 The server code looks like this:
 UDPsock=socket(AF_INET,SOCK_DGRAM)
 UDPSock.bind(addr)
 while 1:
   m,c=UDPsock,recvfrom(1024)
   UDPsock.sendto('bar',c)

 UDPsock.close()

 I am measuring the round trip time using tcpdump. The C version is
 giving me around 80 microseconds (average) and the python is giving me
 close to 300 microseconds (average).

Try replacing the hostname in your send calls with an IP address.  If
you're not passing an IP address here, then the Python version has to
do a name lookup for each send, I bet your C version is not.

Jean-Paul
-- 
http://mail.python.org/mailman/listinfo/python-list


[issue10377] cProfile incorrectly labels its output

2010-11-09 Thread Jean-Paul Calderone

New submission from Jean-Paul Calderone inva...@example.invalid:

Consider this transcript:

 cProfile.run(import time; time.sleep(1))
 4 function calls in 1.012 CPU seconds

   Ordered by: standard name

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
10.0110.0111.0121.012 string:1(module)
10.0000.0001.0121.012 {built-in method exec}
11.0011.0011.0011.001 {built-in method sleep}
10.0000.0000.0000.000 {method 'disable' of 
'_lsprof.Profiler' objects}


 

It is not the case that the profiled code uses 1 CPU seconds.  It spends the 
entire time sleeping.  The default timer for cProfile is a wallclock timer.  
The output should reflect this.

--
messages: 120890
nosy: exarkun
priority: normal
severity: normal
status: open
title: cProfile incorrectly labels its output
type: behavior
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10377
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: pyOpenSSL 0.11 released

2010-11-03 Thread Jean-Paul Calderone
On Nov 1, 6:43 pm, exar...@twistedmatrix.com wrote:
 Hello all,

 I'm happy to announce the release of pyOpenSSL 0.11.  The primary change
 from the last release is that Python 3.2 is now supported.  Python 2.4
 through Python 2.7 are still supported as well.  This release also fixes
 a handful of bugs in error handling code.  It also adds APIs for
 generating and verifying cryptographic signatures and it improves the
 test suite to cover nearly 80% of the implementation.

 Downloads and more details about the release can be found on the release
 page:

    https://launchpad.net/pyopenssl/main/0.11



It was helpfully pointed out to me that I forgot to mention that the
Python 3.2
support in this release of pyOpenSSL was made possible by a grant from
the Python
Software Foundation.

 Enjoy,
 Jean-Paul
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: multiprocessing signal defect

2010-10-29 Thread Jean-Paul Calderone
On Oct 29, 10:08 am, Adam Tauno Williams awill...@whitemice.org
wrote:
 signal handler to do something smart in the case of a -15 [for which
 there isn't really a thread equivalent - can you sent a SystemV style
 signal to an individual thread in a process?  I don't think so.]

Yes.  pthread_kill(P)

Jean-Paul
-- 
http://mail.python.org/mailman/listinfo/python-list


[issue10169] socket.sendto raises incorrect exception when passed incorrect types

2010-10-21 Thread Jean-Paul Calderone

New submission from Jean-Paul Calderone inva...@example.invalid:

 s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
 s.bind(('', 0))
 s.sendto(u'hellé', s.getsockname())
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: sendto() takes exactly 3 arguments (2 given)
 s.sendto(3, s.getsockname())
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: sendto() takes exactly 3 arguments (2 given)
 s.sendto('hello', s.getsockname())
5

The TypeError gives the wrong explanation for what's wrong.

--
components: Library (Lib)
messages: 119320
nosy: exarkun
priority: normal
severity: normal
status: open
title: socket.sendto raises incorrect exception when passed incorrect types
type: behavior
versions: Python 2.6, Python 2.7, Python 3.2

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10169
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10093] Warn when files are not explicitly closed

2010-10-13 Thread Jean-Paul Calderone

Jean-Paul Calderone inva...@example.invalid added the comment:

If the warnings are emitted as usual with the warnings module, you can use -W 
to control this.  -X isn't necessary.

--
nosy: +exarkun

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10093
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Python becoming orphaned over ssh

2010-10-01 Thread Jean-Paul Calderone
On Oct 1, 10:35 am, Antoine Pitrou solip...@pitrou.net wrote:
 On Thu, 30 Sep 2010 07:01:09 -0700 (PDT)

 Jean-Paul Calderone exar...@twistedmatrix.com wrote:

  But signal dispositions are inherited by child processes.  So you run
  ping from your short Python program, and it inherits SIGPIPE being
  ignored.  And it's written in C, not Python, so when it writes to the
  pipe, there's no exception.  So ping never gets any indication that it
  should exit.

 But doesn't write() fail with EPIPE in that situation?
 That would mean `ping` ignores any error return from write().


Quite so.  A quick look at ping.c from iputils confirms this - there
are many write() and fprintf() calls with no error handling.

Jean-Paul
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python becoming orphaned over ssh

2010-09-30 Thread Jean-Paul Calderone
On Sep 30, 9:08 am, David wizza...@gmail.com wrote:
 On Wed, Sep 29, 2010 at 6:49 PM, John Nagle na...@animats.com wrote:
    Python's signal handling for multithread and multiprocess programs
  leaves something to be desired.

 Thanks for the confirmation (that I'm not missing something obvious).

 I've reported a bug for this behavior in the Python issue tracker.

 In the meanwhile, I've made a workaround function called
 check_call_and_monitor_ppids, that behaves like
 subprocess.check_call, except that it regularly checks if the parent
 pid chain (up to init process) changes during execution, and then
 terminates the subprocess and raises an exception.

 Actually I tried this before, and it didn't work. But strangely, it
 seems to work fine so long as I don't try to print any warning
 messages to stderr or stdout from the Python script (though, the
 called tool itself may print to stdout or stderr without problems).
 Quite peculiar...

 Anyway, I hope that one of the Python developers will fix this sometime.

 David.

Python ignores SIGPIPE by default.  The default SIGPIPE behavior is to
exit.  This is sort of what people on POSIX expect.  If you're talking
to another process over a pipe and that process goes away, and then
you write to the pipe, you get a SIGPIPE and you exit (of course, if
it takes you 20 minutes before you do another write, then it's 20
minutes before you exit).

But with SIGPIPE ignored, a Python process won't do exactly this.
Instead, you'll get an exception from the write.  If you don't handle
the exception, then it'll propagate to the top-level and you'll exit.
Just like with a normal process.  Except you also get the option to
doing something other than exiting.  Pretty nice.

But signal dispositions are inherited by child processes.  So you run
ping from your short Python program, and it inherits SIGPIPE being
ignored.  And it's written in C, not Python, so when it writes to the
pipe, there's no exception.  So ping never gets any indication that it
should exit.  No Python writes ever happen in this scenario.  The SSH
supplied stdout is shared with the ping process, which writes to it
directly.

You can fix this by resetting the signal disposition of SIGPIPE for
the ping process:

#!/usr/bin/python
import signal

def reset():
signal.signal(signal.SIGPIPE, signal.SIG_DFL)

from subprocess import check_call
check_call(['ping', 'www.google.com'], preexec_fn=reset)

Very likely the subprocess module should be resetting the disposition
of signals that Python itself has fiddled with (and resetting any
other unusual state that the child is going to inherit, but nothing
else comes immediately to mind).
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Determine sockets in use by python

2010-09-30 Thread Jean-Paul Calderone
On Sep 29, 4:08 pm, Jim Mellander jmellan...@lbl.gov wrote:

 On Wed, Sep 29, 2010 at 11:05 AM, Gary Herron gher...@digipen.edu wrote:
  On 09/29/2010 09:50 AM, Jim Mellander wrote:

  Hi:

  I'm a newbie to python, although not to programming.  Briefly, I am
  using a binding to an external library used for communication in a
  client-server context, with the server in python.  Typically, I would
  set this up with event callbacks, and then enter a select loop, which,
  most the time idles and processes input events when the socket shows
  activity, kinda like:

  while True:
      socket.select((my_socket),(),())
      process_event()

  Unfortunately, the API does not expose the socket to the script level,
  and the developer recommends a busy loop:

  while True:
      sleep(1)
      process_event()

  which I hope to avoid, for many reasons.  If the socket can be exposed
  to the script level, then the problem would be solved.

  Failing that, it would be nice to be able to pythonically determine
  the sockets in use and select on those.  Does anyone have any
  suggestions on how to proceed?

  Thanks in advance

  It's certain that any answer to this will depend on which operating system
  you are using.  So do tell: What OS?

 Hi Gary:

 Certainly not windows  I'm developing on OS/X but for production
 probably Linux and FreeBSD

 (I'm hoping for something a bit more portable than running 'lsof' and
 parsing the output, but appreciate any/all advice)


Linux has /proc/self/fd and OS X has /dev/fd.  Those both suppose you
have some way of determining which file descriptor corresponds to the
socket or sockets that the library is using, of course.  Vastly better
would be to convince the author to expose that information via a real
API.

Jean-Paul
-- 
http://mail.python.org/mailman/listinfo/python-list


[issue9994] Python becoming orphaned over ssh

2010-09-30 Thread Jean-Paul Calderone

Jean-Paul Calderone inva...@example.invalid added the comment:

fwiw http://mail.python.org/pipermail/python-list/2010-September/1256545.html

--
nosy: +exarkun

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9994
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9961] Identity Crisis! variable assignment using strftime fails comparison test.

2010-09-27 Thread Jean-Paul Calderone

Jean-Paul Calderone inva...@example.invalid added the comment:

You mistakenly used is for these comparisons, rather than ==.  The strftime 
involvement is a red herring.  The real problem is the use of an /identity/ 
comparison rather than an /equality/ comparison.

--
nosy: +exarkun
resolution:  - invalid
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9961
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9966] platform : a boolean to know easily when a system is posix

2010-09-27 Thread Jean-Paul Calderone

Jean-Paul Calderone inva...@example.invalid added the comment:

It could, but why introduce this redundancy with `os.name`?

--
nosy: +exarkun

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9966
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9953] 2 scripts running from crontab simultaneously reference the same instance of a variable

2010-09-26 Thread Jean-Paul Calderone

Jean-Paul Calderone inva...@example.invalid added the comment:

You can't rely on id() to return distinct values across different processes.  
It guarantees uniqueness *within a single process* (at any particular moment).

In other words, you're misusing id() here.  This is not a Python bug.

--
nosy: +exarkun
resolution:  - invalid
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9953
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9090] Error code 10035 calling socket.recv() on a socket with a timeout (WSAEWOULDBLOCK - A non-blocking socket operation could not be completed immediately)

2010-09-18 Thread Jean-Paul Calderone

Jean-Paul Calderone inva...@example.invalid added the comment:

 Unfortunately, select doesn't necessarily update the timeout variable with 
 the remaining time, so we can't rely on this. This would mean having the 
 select enclosed within gettimeofday and friends, which seems a bit overkill...

How is it overkill to be correct?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9090
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8998] add crypto routines to stdlib

2010-09-17 Thread Jean-Paul Calderone

Jean-Paul Calderone inva...@example.invalid added the comment:

How about nss?  As a bonus, this would also avoid making more work for Fedora 
(http://fedoraproject.org/wiki/FedoraCryptoConsolidation).

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8998
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8998] add crypto routines to stdlib

2010-09-17 Thread Jean-Paul Calderone

Jean-Paul Calderone inva...@example.invalid added the comment:

What it will bring: APIs which aren't absolutely insane; full SSL support; RSA, 
DSA, ECDSA, Diffie-Hellman, EC Diffie-Hellman, AES, Triple DES, DES, RC2, RC4, 
SHA-1, SHA-256, SHA-384, SHA-512, MD2, MD5, HMAC: Common cryptographic 
algorithms used in public-key and symmetric-key cryptography; simplified FIPS 
140 validation; better licensing (MPL).

I'm interested in stuff based on nss, but I definitely won't promise to do the 
work.  Fortunately dmalcolm seems to be on top of that. :)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8998
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8998] add crypto routines to stdlib

2010-09-17 Thread Jean-Paul Calderone

Jean-Paul Calderone inva...@example.invalid added the comment:

 I should note that I can't touch anything to do with Elliptic Curve crypto.  
 I don't know if I can comment on the reasons for that.

Hopefully anything ECC related can be done separately.  There's certainly no 
ECC APIs in Python now, so there would be no loss of functionality if any new 
crypto-related APIs didn't include ECC.  Later if someone is sufficiently 
interesting, they could add it to the base library.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8998
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9875] Garbage output when running setup.py on Windows

2010-09-16 Thread Jean-Paul Calderone

New submission from Jean-Paul Calderone inva...@example.invalid:

The output of setup.py is polluted with this log message:

  Importing new compiler from distutils.msvc9compiler

on Windows.  For example, using pyOpenSSL's setup.py, running setup.py 
--version produces this output:

  Importing new compiler from distutils.msvc9compiler
  0.10

But the version number of pyOpenSSL is 0.10, not Importing new compiler from 
distutils.msvc9compiler\n0.10.

The --quiet flag does not solve this problem, apparently because this log 
message is done at the top-level of msvccompiler.py, perhaps before --quiet is 
interpreted.

This interferes with my build automation which depends on setup.py --version 
producing the version number of the project in order to properly compute 
certain filenames.

--
assignee: tarek
components: Distutils
messages: 116552
nosy: eric.araujo, exarkun, tarek
priority: normal
severity: normal
status: open
title: Garbage output when running setup.py on Windows
type: behavior
versions: Python 2.7

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9875
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9881] PySSL_SSLRead loops until data is available, even in non-blocking mode

2010-09-16 Thread Jean-Paul Calderone

New submission from Jean-Paul Calderone inva...@example.invalid:

Here's a transcript which demonstrates the blocking behavior:

 import socket
 import time
 import ssl
 s = ssl.wrap_socket(socket.socket())
 s.connect(('localhost', 8443))
 s.send('GET /async.rpy HTTP/1.1\r\n\r\n')
27
 s.setblocking(False)
 a = time.time(); s.recv(1024); b = time.time()
'HTTP/1.1 200 OK\r\nTransfer-Encoding: chunked\r\nDate: Thu, 02 Sep 2010 
11:51:03 GMT\r\nContent-Type: text/html\r\nServer: 
TwistedWeb/10.1.0+r29954\r\n\r\n4c\r\nhtmlbodySorry to keep you 
waiting./body/html\r\n0\r\n\r\n'
 print b - a
4.13403391838


(This can be reproduced using any web server which is a bit slow in responding; 
it's very obvious here because I used a server that intentionally waits several 
seconds before generating a response).

--
components: Library (Lib)
messages: 116629
nosy: exarkun
priority: normal
severity: normal
status: open
title: PySSL_SSLRead loops until data is available, even in non-blocking mode
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9881
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9881] PySSL_SSLread loops until data is available, even in non-blocking mode

2010-09-16 Thread Jean-Paul Calderone

Changes by Jean-Paul Calderone inva...@example.invalid:


--
title: PySSL_SSLRead loops until data is available, even in non-blocking mode 
- PySSL_SSLread loops until data is available, even in non-blocking mode

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9881
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9881] PySSL_SSLread loops until data is available, even in non-blocking mode

2010-09-16 Thread Jean-Paul Calderone

Jean-Paul Calderone inva...@example.invalid added the comment:

Hm.  I must have been testing with old versions, since I can't reproduce this 
now.  Sorry for the noise.

--
resolution: out of date - duplicate
status: pending - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9881
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9875] Garbage output when running setup.py on Windows

2010-09-16 Thread Jean-Paul Calderone

Jean-Paul Calderone inva...@example.invalid added the comment:

This seems to have been caused by an ill-placed distutils.log.set_verbosity(3) 
call.  With that removed, this output isn't generated by default.  So perhaps 
this is invalid, feel free to close it as so if you agree.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9875
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8685] set(range(100000)).difference(set()) is slow

2010-09-01 Thread Jean-Paul Calderone

Jean-Paul Calderone inva...@example.invalid added the comment:

 I'll be looking at it shortly.  Py3.2 is still aways from release so there is 
 no hurry.

I would consider reviewing and possibly apply this change, but I don't want to 
invade anyone's territory.

--
nosy: +exarkun

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8685
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8685] set(range(100000)).difference(set()) is slow

2010-09-01 Thread Jean-Paul Calderone

Changes by Jean-Paul Calderone inva...@example.invalid:


--
nosy:  -exarkun

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8685
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9053] distutils compiles extensions so that Python.h cannot be found

2010-08-27 Thread Jean-Paul Calderone

Jean-Paul Calderone inva...@example.invalid added the comment:

exar...@boson:~/Projects/python-signalfd/trunk$ PYTHONPATH= 
~/Projects/python/branches/py3k/python setup.py build_ext -i
running build_ext
building 'signalfd._signalfd' extension
creating build
creating build/temp.linux-i686-3.2
creating build/temp.linux-i686-3.2/signalfd
gcc -pthread -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC 
-I/home/exarkun/Projects/python/branches/py3k/Include 
-I/home/exarkun/Projects/python/branches/py3k -c signalfd/_signalfd.c -o 
build/temp.linux-i686-3.2/signalfd/_signalfd.o
gcc -pthread -shared build/temp.linux-i686-3.2/signalfd/_signalfd.o -o 
/home/exarkun/Projects/python-signalfd/trunk/signalfd/_signalfd.so
exar...@boson:~/Projects/python-signalfd/trunk$

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9053
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9053] distutils compiles extensions so that Python.h cannot be found

2010-08-27 Thread Jean-Paul Calderone

Changes by Jean-Paul Calderone inva...@example.invalid:


--
resolution:  - fixed
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9053
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: How to see intermediate fail results from unittest as tests are running?

2010-08-25 Thread Jean-Paul Calderone
On Aug 18, 9:20 pm, Margie Roginski margierogin...@gmail.com wrote:
 Hi,

 I am using unittest in a fairly basic way, where I have a single file
 that simply defines a class that inherits from unittest.TestCase and
 then within that class I have a bunch of methods that start with
 test.  Within that file, at the bottom I have:

 if __name__ == __main__:
     unittest.main()

 This works fine and it runs all of the testxx() methods in my file.
 As it runs it prints if the tests passed or failed, but if they fail,
 it does not print the details of the assert that made them fail.  It
 collects this info up and prints it all at the end.

 Ok - my question: Is there any way to get unittest to print the
 details of the assert that made a test fail, as the tests are
 running?  IE, after a test fails, I would like to see why, rather than
 waiting until all the tests are done.

 I've searched the doc and even looked at the code, and it seems the
 answer is no, but I'm just wondering if I'm missing something.

 Thanks!

 Margie

trial (Twisted's test runner) has a `--rterrors` option which causes
it to display errors as soon as they happen.

Jean-Paul
-- 
http://mail.python.org/mailman/listinfo/python-list


[issue9276] pickle should support methods

2010-08-02 Thread Jean-Paul Calderone

Jean-Paul Calderone exar...@twistedmatrix.com added the comment:

 This is a security feature and should not be broken !

Can you explain this?

I don't think I agree, since an attacker can always serialize whatever they 
feel like.  It's the person doing the deserialization that has to be careful.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9276
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9276] pickle should support methods

2010-08-02 Thread Jean-Paul Calderone

Jean-Paul Calderone exar...@twistedmatrix.com added the comment:

 By adding default support for unpickling code objects, you can trick
the unpickling code into executing serialized code:

This doesn't sound correct to me.

You can *already* trick unpickling code into executing serialized code.  You 
don't need this feature in order to be able to do it.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9276
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9276] pickle should support methods

2010-08-02 Thread Jean-Paul Calderone

Jean-Paul Calderone exar...@twistedmatrix.com added the comment:

For example:

exar...@boson:~$ python
Python 2.6.4 (r264:75706, Dec  7 2009, 18:45:15) 
[GCC 4.4.1] on linux2
Type help, copyright, credits or license for more information.
 class x(object):
... def __reduce__(self):
... import os
... return os.system, ('echo Hello from sploitland',)
... 
 import pickle
 pickle.loads(pickle.dumps(x()))
Hello from sploitland
0


--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9276
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9276] pickle should support methods

2010-08-02 Thread Jean-Paul Calderone

Jean-Paul Calderone exar...@twistedmatrix.com added the comment:

 I also like Antoine's idea of pickling the function/method name instead of 
 the whole code object.

I like it too.  That's why I suggested it in the first comment on the ticket 
(read the linked code).  I guess Alexander likes it too, since he basically 
said as much in the second comment. ;)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9276
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9276] pickle should support methods

2010-08-02 Thread Jean-Paul Calderone

Jean-Paul Calderone exar...@twistedmatrix.com added the comment:

 Note, however that since unbound methods have been removed in 3.x, it is not 
 trivial to find a fully qualified name of a method anymore.

This is a rather sad loss of functionality.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9276
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2124] xml.sax and xml.dom fetch DTDs by default

2010-07-20 Thread Jean-Paul Calderone

Jean-Paul Calderone exar...@twistedmatrix.com added the comment:

Yes.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue2124
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1218234] inspect.getsource doesn't update when a module is reloaded

2010-07-16 Thread Jean-Paul Calderone

Jean-Paul Calderone exar...@twistedmatrix.com added the comment:

Calling linecache.checkcache for every inspect.getsource call sounds like a 
fairly bad idea to me.

linecache.checkcache does a stat() of every single cached file.

--
nosy: +exarkun

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1218234
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1218234] inspect.getsource doesn't update when a module is reloaded

2010-07-16 Thread Jean-Paul Calderone

Jean-Paul Calderone exar...@twistedmatrix.com added the comment:

 linecache.checkcache does a stat() of every single cached file.

Ah, sorry.  I didn't read carefully enough.  I see that the patch passes in the 
filename and checkcache restricts the work it does in that case.

Something else to consider, though, is that this change means you'll also get 
the new source if you *don't* reload the module, too.  So, what exactly is 
inspect.getsource() supposed to be doing?  Giving you the current on-disk 
contents of the relevant source file?  Or giving you the actual source 
corresponding to the object passed to it?

If the latter, then this actually needs to be more tightly integrated with 
module reloading somehow.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1218234
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9276] pickle should support methods

2010-07-16 Thread Jean-Paul Calderone

New submission from Jean-Paul Calderone exar...@twistedmatrix.com:

pickle doesn't support methods:


 class x:
... def y(self):
... pass
... 
 import pickle
 pickle.dumps(x.y)
Traceback (most recent call last):
  File stdin, line 1, in module
  File /home/exarkun/Projects/python/branches/py3k/Lib/pickle.py, line 1314, 
in dumps
Pickler(f, protocol, fix_imports=fix_imports).dump(obj)
_pickle.PicklingError: Can't pickle class 'function': attribute lookup 
builtins.function failed

It would be easy to fix this, though.  Here's a link to some code that 
implements it: 
http://twistedmatrix.com/trac/browser/trunk/twisted/persisted/styles.py?rev=1

--
components: Library (Lib)
messages: 110473
nosy: exarkun
priority: normal
severity: normal
status: open
title: pickle should support methods
type: feature request

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9276
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: simples setup for an wsgi https server in python

2010-07-10 Thread Jean-Paul Calderone
On Jul 10, 2:42 pm, Gelonida gelon...@gmail.com wrote:
 Hi,

 I'd like to debug a small wsgi module.

 I run it either on an apache web server

 or locally via wsgiref.simple_server.make_server
 and following code snippet:

 from wsgiref.simple_server import make_server
 httpd = make_server('localhost',8012,application)
 while True:
    httpd.handle_request()
    print_some_debug_info()

 It seems, that wsgiref.simple_server.make_server can only create an http
 server.

 What I wondered would be how to easiest create an https server, that
 supports wsgi modules

 TIA

You could do this with Twisted:

twistd -n web --https 443 --certificate server.pem --privkey
server.key --wsgi your.application

Jean-Paul
-- 
http://mail.python.org/mailman/listinfo/python-list


[issue5286] urrlib2 digest authentication problems

2010-07-10 Thread Jean-Paul Calderone

Jean-Paul Calderone exar...@twistedmatrix.com added the comment:

Some unit tests which demonstrate the present non-working behavior and the 
correctness of the fix would help a lot.

--
nosy: +exarkun

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5286
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4928] Problem with tempfile.NamedTemporaryFile

2010-07-07 Thread Jean-Paul Calderone

Jean-Paul Calderone exar...@twistedmatrix.com added the comment:

I can't think of any way that you might be able to implement the behavior being 
requested here.

Instead, if you don't want to leave files lying around, use TemporaryFile 
instead of NamedTemporaryFile.

Perhaps the documentation for NamedTemporary file could be updated to explain 
this limitation, though.

--
nosy: +exarkun

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4928
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9127] subprocess.Popen.communicate() and SIGCHLD handlers

2010-06-30 Thread Jean-Paul Calderone

Jean-Paul Calderone exar...@twistedmatrix.com added the comment:

You should include all relevant issue materials here, in the Python issue 
tracker.  This ticket will be useless as soon as pastie.org decides to forget 
about your paste.

--
nosy: +exarkun

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9127
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9080] Provide list prepend method (even though it's not efficient)

2010-06-25 Thread Jean-Paul Calderone

Jean-Paul Calderone exar...@twistedmatrix.com added the comment:

Thanks for bringing this up.

I think you have more work to do to successfully make the case that L.insert(0, 
x) is difficult enough to merit the addition of a new list method.  There are 
already at least two in-place insert-at-front list APIs (the second being L[:0] 
= [x]).  There should be a very compelling reason for adding a third, and I 
don't think that being able to skip the extra 0 in the L.insert version is 
going to suffice.

--
nosy: +exarkun
resolution:  - wont fix
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9080
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9080] Provide list prepend method (even though it's not efficient)

2010-06-25 Thread Jean-Paul Calderone

Jean-Paul Calderone exar...@twistedmatrix.com added the comment:

 The argument that there are already two ways to do it, so why add a third?, 
 is not bad, but if applied to appending, it would ban the append() method... 
 except that it's already there.

Not quite.  First let's consider the insert approach.  Unlike with prepending, 
you first have to find the length of the list: L.insert(len(L), x).  So it's no 
longer just a matter of an extra constant (although it /is/ still pretty 
simple).  Next, the slice assignment solution: L[-1:] = [x] doesn't work, 
because it actually includes the last element of L in the slice, so it replaces 
the last value instead of appending the new element.

So there's really just two ways, L.insert(len(L), x) and L.append(x).  To me, 
it seems like the extra cognitive load of figuring out whether the parameter to 
L.insert should be len(L) or len(L) - 1 or len(L) + 1 makes L.append 
worthwhile.  Maybe the same argument could be applied to L.insert(0, x), but it 
seems like a simpler case (of _course_ inserting at 0 prepends) to me.

The other cost of adding a new list method is updating all of the list-like 
interfaces out there to also provide this, although that would probably be a 
cost worth accepting for a really compelling new method.

 Sorry to bring up this issue that I guess has been raised (many times?) 
 before, but I thought I'd have a stab at a convincing case!

No need to apologize!  Thanks for the reasoned argument.  At least this can 
serve as a reference when the issue comes up again in the future, and perhaps 
someone else will be more convinced than overrule me. :)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9080
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9053] distutils compiles extensions so that Python.h cannot be found

2010-06-21 Thread Jean-Paul Calderone

New submission from Jean-Paul Calderone exar...@twistedmatrix.com:

With a checkout of the py3k branch, building an extension module using 
distutils fails:

  error: Python.h: No such file or directory

This is clearly because the wrong -I option is being supplied:

  gcc -pthread -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC 
-I/home/exarkun/Projects/python-signalfd/trunk/Include 
-I/home/exarkun/Projects/python/branches/py3k -c signalfd/_signalfd.c -o 
build/temp.linux-i686-3.2/signalfd/_signalfd.o

Building the extension with Python 3.1 all the way back through Python 2.3 does 
work, though.

--
assignee: tarek
components: Distutils
messages: 108321
nosy: exarkun, tarek
priority: critical
severity: normal
status: open
title: distutils compiles extensions so that Python.h cannot be found
versions: Python 3.1

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9053
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1573931] WSGI, cgi.FieldStorage incompatibility

2010-06-19 Thread Jean-Paul Calderone

Jean-Paul Calderone exar...@twistedmatrix.com added the comment:

It's not terribly productive to block a fix for this specific issue in the WSGI 
specification on the big pile of contentious unrelated issues.

It would make sense to issue a new WSGI specification with a correction for 
only this issue.  The rest of the WSGI 1.1 issues can wait for a subsequent 
revision.

Of course, actually getting this done involves either getting web-sig behind it 
or deciding to ignore web-sig and just do it.

--
nosy: +exarkun

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1573931
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1300] subprocess.list2cmdline doesn't do pipe symbols

2010-06-19 Thread Jean-Paul Calderone

Jean-Paul Calderone exar...@twistedmatrix.com added the comment:

See the commit message for r82075 and the discussion on issue8972 and issue7839.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1300
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1300] subprocess.list2cmdline doesn't do pipe symbols

2010-06-19 Thread Jean-Paul Calderone

Jean-Paul Calderone exar...@twistedmatrix.com added the comment:

It will return the former.

To clarify, it's true that there appears to be a problem with Popen(['echo', 
'foo|bar'], shell=True).  That is being tracked in issue7839.

What's invalid is the report that list2cmdline() should be quoting strings with 
| in them.  list2cmdline() is documented as being an implementation of the 
quoting convention implemented by the MS C runtime.  That quoting convention 
does not require | to be quoted.

It's cmd.exe which requires | to be quoted (if it is to be part of an argument 
value, rather than to indicate a command pipeline of some sort).  cmd.exe 
quoting rules need to be addressed separately from the MS C quoting rules used 
even if cmd.exe isn't involved.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1300
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8524] SSL sockets do not retain the parent socket's attributes

2010-06-19 Thread Jean-Paul Calderone

Jean-Paul Calderone exar...@twistedmatrix.com added the comment:

It might be nice to see the version that avoids the dup() and has the duplicate 
code instead (interesting trade-off ;).  Just for the sake of comparison 
against the forget() proposal.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8524
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9028] test_support.run_unittest cmdline options and arguments

2010-06-18 Thread Jean-Paul Calderone

Jean-Paul Calderone exar...@twistedmatrix.com added the comment:

These sound more like features for the unittest runner (one of which is 
implemented already).  Also, please don't propagate :: as a namespace 
separator in Python.  That's what . is for.

--
nosy: +exarkun

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9028
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1300] subprocess.list2cmdline doesn't do pipe symbols

2010-06-18 Thread Jean-Paul Calderone

Jean-Paul Calderone exar...@twistedmatrix.com added the comment:

I reverted r60115 from trunk (2.7) in r82075 and from py3k in r82076.

--
nosy: +exarkun
resolution: fixed - invalid

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1300
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8972] subprocess.list2cmdline doesn't quote the character

2010-06-18 Thread Jean-Paul Calderone

Jean-Paul Calderone exar...@twistedmatrix.com added the comment:

I've reverted the issue1300 revision from 2.6, 2.7, 3.1, and 3.2.  I hope 
7839 is resolved soon.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8972
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8972] subprocess.list2cmdline doesn't quote the character

2010-06-13 Thread Jean-Paul Calderone

Jean-Paul Calderone exar...@twistedmatrix.com added the comment:

 That remark is not relevant, because the actual problem is different.

Maybe you can expand the test case to demonstrate the actual problem?  The 
tests in the latest patch are for list2cmdline directly.  But you can't observe 
the problem a bug in list2cmdline causes until you actually try to launch a 
child process.  So perhaps the test should do that?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8972
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8972] subprocess.list2cmdline doesn't quote the character

2010-06-12 Thread Jean-Paul Calderone

Jean-Paul Calderone exar...@twistedmatrix.com added the comment:

Thanks for reporting this issue.  Can you attach a patch which adds a unit test 
covering this behavior and fixing the quoting rules?  It would be very helpful 
in resolving this ticket.  If implementing the whole thing is too much work, if 
you could just provide a failing unit test that would still be greatly helpful.

Thanks again.

--
nosy: +exarkun

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8972
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8972] subprocess.list2cmdline doesn't quote the character

2010-06-12 Thread Jean-Paul Calderone

Jean-Paul Calderone exar...@twistedmatrix.com added the comment:

Thanks.

I'm not sure this is a correct change.  And in fact, I would say that the 
current quoting of | is also incorrect.

 and | (and ^ and perhaps several others) have special meaning to cmd.exe.  
list2cmdline is documented as applying the quoting rules which the MS C 
runtime uses: cmd.exe and the C runtime are different and have different rules.

It seems to me that whoever added the | handling to list2cmdline was confused 
about the purpose of this function, or failed to properly document the function.

It would make more sense to document list2cmdline as applying cmd.exe-style 
quoting rules, if those are the rules it is actually going to implement.

A better option, though, would probably be to implement the cmd.exe quoting 
rules in a different function from the MS C runtime rules.

This all might benefit from a sanity check from someone who's actually worked 
with the subprocess module before, though (ie, not me).

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8972
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8972] subprocess.list2cmdline doesn't quote the character

2010-06-12 Thread Jean-Paul Calderone

Changes by Jean-Paul Calderone exar...@twistedmatrix.com:


--
components: +Library (Lib)
stage: unit test needed - 

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8972
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8972] subprocess.list2cmdline doesn't quote the character

2010-06-12 Thread Jean-Paul Calderone

Jean-Paul Calderone exar...@twistedmatrix.com added the comment:

http://www.autohotkey.net/~deleyd/parameters/parameters.htm#WINCRULES is a 
helpful reference, by the way.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8972
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8942] __path__ attribute of modules loaded by zipimporter is untested

2010-06-08 Thread Jean-Paul Calderone

New submission from Jean-Paul Calderone exar...@twistedmatrix.com:

Packages loaded from zip files have a __path__ sort of like any other package.  
The zipimport tests don't verify that this attribute has the correct value, 
though.

--
components: Tests
messages: 107327
nosy: exarkun
priority: normal
severity: normal
status: open
title: __path__ attribute of modules loaded by zipimporter is untested

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8942
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8857] socket.getaddrinfo needs tests

2010-05-31 Thread Jean-Paul Calderone

Jean-Paul Calderone exar...@twistedmatrix.com added the comment:

About the doc patch: I like the word Resolves more than Translate.  
Resolves implies possible network activity to me.  Translate sounds like 
it's just a change in representation.  Of course, things like `AI_NUMERICHOST` 
complicate things, since there may not actually be any network activity.

The rest seems fine.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8857
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8845] Expose sqlite3 connection inTransaction as read-only in_transaction attribute

2010-05-28 Thread Jean-Paul Calderone

Jean-Paul Calderone exar...@twistedmatrix.com added the comment:

 If the user issues the 'save' command a commit is done.  When they quit the 
 application, I'd like to be able to prompt them with a 'save or discard' if 
 and only if they have made changes since the last save.

Isn't this the same as if they have issued any non-SELECT statements?  And 
isn't that pretty easy to track?

(Not that I'm opposed to making the SQLite3 wrapper more complete.)

--
nosy: +exarkun

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1628205] socket.readline() interface doesn't handle EINTR properly

2010-05-23 Thread Jean-Paul Calderone

Jean-Paul Calderone exar...@twistedmatrix.com added the comment:

Backported to release26-maint in r81488.

--
nosy: +exarkun

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1628205
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5639] Support TLS SNI extension in ssl module

2010-05-23 Thread Jean-Paul Calderone

Jean-Paul Calderone exar...@twistedmatrix.com added the comment:

 Sorry I don't like this as much. I believe following the RFC for TLS SNI 
 should be implicit and not something the programmer need to put effort into 
 achieving. I acknowledge this approach does go against some explicit 
 behaviour programming quality metrics.

It's almost always wrong for Python to enforce a particular *policy*, 
particularly in a very low level API (which is what the ssl module should be).  
Python's main job is to make it *possible* to do things.  It's the application 
developer's job to decide what things should be done.

It would be entirely appropriate, though, for a higher-level interface (for 
example, the httplib module) to take care of this itself and not require users 
to explicitly specify things separately.

 Well, the hostname should be specific to a connection, so I'm not sure it 
 makes sense to set it on the context.

That doesn't make sense to me.  For example, consider the case where you're 
talking to a web service.  The hostname lookup might result in 10 A records, 
which you then drop into a connection pool.  Your application doesn't care 
which server you talk to (and maybe it talks to serveral, or all, of them).  
But it does want to specify the same hostname for each.

 (besides, the OpenSSL APIs only allow it to be set on the SSL structure)

Nope, I checked before making the suggestion.  There's an SSL_CTX_ version of 
this API (in addition to the SSL_ version).

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5639
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5639] Support TLS SNI extension in ssl module

2010-05-23 Thread Jean-Paul Calderone

Jean-Paul Calderone exar...@twistedmatrix.com added the comment:

 Nope, I checked before making the suggestion.  There's an SSL_CTX_ version of 
 this API (in addition to the SSL_ version).

Sorry, I just checked again, and it seems you're right.  Perhaps I saw 
SSL_CTX_set_tlsext_servername_callback and got the two confused.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5639
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5639] Support TLS SNI extension in ssl module

2010-05-22 Thread Jean-Paul Calderone

Jean-Paul Calderone exar...@twistedmatrix.com added the comment:

Here's another possible approach:

ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
ctx.set_tlsext_host_name(foo.bar)
skt = ctx.wrap_socket(socket.socket())
skt.connect(bar.baz)

This makes it obvious what the SNI hostname is and what the TCP address to 
connect to is, and they can easily be different.

--
nosy: +exarkun

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5639
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8771] Socket freezing under load issue on Mac.

2010-05-20 Thread Jean-Paul Calderone

Jean-Paul Calderone exar...@twistedmatrix.com added the comment:

Have you looked at the number of TIME_WAIT sockets you have on the system when 
your benchmark gets to the 16000 request mark?

This looks exactly like a regular TCP limitation to me.  You'll find the limit 
on any platform, not just OS X.

--
nosy: +exarkun

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8771
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3051] heapq change breaking compatibility

2010-05-17 Thread Jean-Paul Calderone

Changes by Jean-Paul Calderone exar...@twistedmatrix.com:


--
status: closed - open

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue3051
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8712] Skip libpthread related test failures on OpenBSD

2010-05-14 Thread Jean-Paul Calderone

Jean-Paul Calderone exar...@twistedmatrix.com added the comment:

In addition to skipping the tests, would it also make sense to document these 
known limitations of Python threading on OpenBSD somewhere that end users might 
see it?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8712
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8661] FAQ item 2.25 is unclear

2010-05-08 Thread Jean-Paul Calderone

New submission from Jean-Paul Calderone exar...@twistedmatrix.com:

The item How do I prepare a new branch for merging? is unclear about which 
branch needs to be prepared.  It could be the source branch or the destination 
branch.  In #python-dev, I learned that it's probably the destination branch 
being discussed here.  This should be clarified (and it could also be pointed 
out that it is almost always the case that this step has been done by someone 
else already).

--
messages: 105300
nosy: exarkun
priority: normal
severity: normal
status: open
title: FAQ item 2.25 is unclear

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8661
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8354] siginterrupt with flag=False is reset when signal received

2010-05-08 Thread Jean-Paul Calderone

Jean-Paul Calderone exar...@twistedmatrix.com added the comment:

Should be resolved in, oh, let's see, r81007, r81011, r81016, and r81018.  
Thanks to everyone who helped out.

--
resolution:  - fixed
status: open - closed
versions: +Python 3.1

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8354
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2574] Add RFC 3768 SSM Multicast support to socket

2010-05-07 Thread Jean-Paul Calderone

Changes by Jean-Paul Calderone exar...@twistedmatrix.com:


--
keywords: +needs review
status: open - languishing
versions: +Python 3.2 -Python 2.6

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue2574
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8354] siginterrupt with flag=False is reset when signal received

2010-05-07 Thread Jean-Paul Calderone

Jean-Paul Calderone exar...@twistedmatrix.com added the comment:

I agree that this should be landed (for 2.6 and 2.7).  I think I can do it.  I 
made some changes to the tests, though.  It would be nice for someone to look 
those over and make sure the change still looks good.

I checked everything in to the siginterrupt-reset-issue8354 branch.  You can 
also find the diff at http://codereview.appspot.com/1134042/show

--
versions: +Python 2.7

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8354
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8656] urllib2 mangles file://-scheme URLs

2010-05-07 Thread Jean-Paul Calderone

Jean-Paul Calderone exar...@twistedmatrix.com added the comment:

Major buildbot failures caused by this change, eg:

ERROR: test_file (test.test_urllib2net.OtherNetworkTests)
--
Traceback (most recent call last):
  File 
/home/buildbot/slave/py-build/2.6.norwitz-amd64/build/Lib/test/test_urllib2net.py,
 line 126, in test_file
self._test_urls(urls, self._extra_handlers(), retry=True)
  File 
/home/buildbot/slave/py-build/2.6.norwitz-amd64/build/Lib/test/test_urllib2net.py,
 line 175, in _test_urls
f = urlopen(url, req, TIMEOUT)
  File 
/home/buildbot/slave/py-build/2.6.norwitz-amd64/build/Lib/test/test_urllib2net.py,
 line 28, in wrapped
return _retry_thrice(func, exc, *args, **kwargs)
  File 
/home/buildbot/slave/py-build/2.6.norwitz-amd64/build/Lib/test/test_urllib2net.py,
 line 19, in _retry_thrice
return func(*args, **kwargs)
  File /home/buildbot/slave/py-build/2.6.norwitz-amd64/build/Lib/urllib2.py, 
line 391, in open
response = self._open(req, data)
  File /home/buildbot/slave/py-build/2.6.norwitz-amd64/build/Lib/urllib2.py, 
line 409, in _open
'_open', req)
  File /home/buildbot/slave/py-build/2.6.norwitz-amd64/build/Lib/urllib2.py, 
line 369, in _call_chain
result = func(*args)
  File /home/buildbot/slave/py-build/2.6.norwitz-amd64/build/Lib/urllib2.py, 
line 1257, in file_open
return self.open_local_file(req)
  File /home/buildbot/slave/py-build/2.6.norwitz-amd64/build/Lib/urllib2.py, 
line 1291, in open_local_file
headers, 'file://'+ host + file)
TypeError: cannot concatenate 'str' and 'NoneType' objects

--
nosy: +exarkun

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8656
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8407] expose signalfd(2) and sigprocmask(2) in the signal module

2010-05-05 Thread Jean-Paul Calderone

Jean-Paul Calderone exar...@twistedmatrix.com added the comment:

I think this is ready for a first review.  See 
http://codereview.appspot.com/1132041.  If everyone agrees this is 
inappropriate for 2.7, then I'll port the changes to 3.x.  I don't expect there 
to be much difference in the 3.x version.

--
keywords: +needs review

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8407
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8576] test_support.find_unused_port can cause socket conflicts on Windows

2010-05-04 Thread Jean-Paul Calderone

Jean-Paul Calderone exar...@twistedmatrix.com added the comment:

 You mean that socket.create_connection(), httplib (issue 3972) and ftplib 
 (issue 8594) should have used a different API to implement their 
 source_address option?

I'm not sure what you mean.  The problem here is that you cannot reliably bind 
a specific local address because it might be bound already.

This is bad in unit tests because it causes spurious failures that waste 
developer effort forcing people to investigate non-bugs or because it causes 
people to ignore the results of the test suite.

This is bad in real applications because it prevents an application from 
working as it is supposed to.

Perhaps you have an application which requires that HTTP requests are issued 
from (1.2.3.4, 12345).  Then you'd better use an HTTP client library that lets 
you bind to this address when connecting to the HTTP server.  But the 
application is going to be prone to failure.  If you can't get around the 
requirement, then you just get to live with an unreliable application.

There's no such requirement in any unit test, though.  Unit tests can do 
whatever they want in order to achieve the goal of exercising the relevant 
implementation code and verify the results to be correct.  I don't think there 
are any unit tests which need to bind to one specific address in order to 
accomplish this goal.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8576
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8576] test_support.find_unused_port can cause socket conflicts on Windows

2010-05-04 Thread Jean-Paul Calderone

Jean-Paul Calderone exar...@twistedmatrix.com added the comment:

 One of the tests in test_socket is checking that an attempt to connect to a 
 port with no server running gives socket.error. For that, we need a port 
 that's guaranteed to have no server present.

A good way to do this is to create a socket, bind it to an address (any address 
- ie ('', 0)), ask it what its address is, and use that as the destination of 
the connect attempt.  Since you didn't listen() on it, it's not a server, and 
it won't accept any connections.

Doing it this way is again more reliable, since if you try to discover an 
unused address with find_unused_port, a real server might end up re-using that 
address by the time your test gets around to trying to connect to it.

 I think that one of the tests in test_httplib checks the source_address 
 attribute to make sure the port it contains is the one you connected on - 
 again, you need a specific port and it can't be in use.

If you're talking about SourceAddressTest.testHTTPConnectionSourceAddress, I 
see what you mean.  This is basically an integration test between httplib and 
the socket module.  No actual socket is required here.  I would implement this 
test using a fake socket object.  This would allow the test assertion to be 
strengthened (it currently doesn't assert anything about the ip part of the 
address, it only checks the port), and still avoids running into problems 
binding a *real* local address.

 Arguably these tests are of limited value and could simply be deleted

I definitely would not argue this.  These tests seem to cover real 
functionality which isn't directly covered elsewhere.  They shouldn't be 
deleted, but fixed to avoid the potential races they're subject to now.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8576
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5727] doctest pdb readline broken

2010-05-04 Thread Jean-Paul Calderone

Changes by Jean-Paul Calderone exar...@twistedmatrix.com:


--
stage: unit test needed - patch review

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5727
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8576] test_support.find_unused_port can cause socket conflicts on Windows

2010-05-03 Thread Jean-Paul Calderone

Jean-Paul Calderone exar...@twistedmatrix.com added the comment:

 I'm not sure if I agree that find_unused_port() should be removed though; it 
 does serve a purpose in very rare corner cases.

It can serve a purpose in any number of cases.  My point is that it's *always* 
unreliable, though.  Any time you have any API that you want to test that 
requires a pre-allocated port number, you're going to have intermittent 
failures.  Such APIs are broken and should be fixed where possible and avoided 
otherwise.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8576
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8604] Alias for distutils.file_util.write_file in e.g. shutils

2010-05-03 Thread Jean-Paul Calderone

Jean-Paul Calderone exar...@twistedmatrix.com added the comment:

Considering that it's extremely difficult to implement this correctly and in a 
cross-platform way, I think it makes sense as a stdlib addition (though I'd add 
it as a method of a `path` type rather than to the shell utilities module ;).

--
nosy: +exarkun

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8604
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8407] expose signalfd(2) and sigprocmask(2) in the signal module

2010-05-01 Thread Jean-Paul Calderone

Jean-Paul Calderone exar...@twistedmatrix.com added the comment:

One open question regarding interaction with threading.  sigprocmask's behavior 
in a multithreaded program is unspecified.  pthread_sigmask should be used 
instead.  I could either expose both of these and let the caller choose, or I 
could make signal.sigprocmask use pthread_sigmask if it's available, and fall 
back to sigprocmask.  I don't see any disadvantages of doing the latter, and 
the former seems like it would create an attractive nuisance.  However, I don't 
have much experience with sigprocmask; I'm only interested in it because of its 
use in combination with signalfd.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8407
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8407] expose signalfd(2) and sigprocmask(2) in the signal module

2010-05-01 Thread Jean-Paul Calderone

Changes by Jean-Paul Calderone exar...@twistedmatrix.com:


--
nosy: +gps

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8407
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8576] test_support.find_unused_port can cause socket conflicts on Windows

2010-04-30 Thread Jean-Paul Calderone

Jean-Paul Calderone exar...@twistedmatrix.com added the comment:

find_unused_port is the wrong approach altogether.  Uses of it should be 
replaced by bind_port and then find_unused_port should be removed.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8576
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue665761] reduce() masks exception

2010-04-30 Thread Jean-Paul Calderone

Changes by Jean-Paul Calderone exar...@twistedmatrix.com:


--
nosy:  -exarkun

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue665761
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8569] Upgrade OpenSSL in Windows builds

2010-04-29 Thread Jean-Paul Calderone

Jean-Paul Calderone exar...@twistedmatrix.com added the comment:

http://www.openssl.org/news/secadv_20100324.txt
http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2009-3555

New Windows builds of any versions of CPython which are still receiving 
security updates should be released.

--
nosy: +exarkun
priority: normal - critical

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8569
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8550] Expose SSL contexts

2010-04-27 Thread Jean-Paul Calderone

Jean-Paul Calderone exar...@twistedmatrix.com added the comment:

For reference:

http://pyopenssl.sourceforge.net/pyOpenSSL.html/openssl-context.html
http://www.heikkitoivonen.net/m2crypto/api/M2Crypto.SSL.Context%27.Context-class.html

and `man -k SSL_CTX_`

--
nosy: +exarkun

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8550
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8493] socket's send can raise errno 35 under OS X, which causes problems in sendall

2010-04-26 Thread Jean-Paul Calderone

Jean-Paul Calderone exar...@twistedmatrix.com added the comment:

 What is the mnemonic corresponding to errno 35 under OS X?

EAGAIN

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8493
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8493] socket's send can raise errno 35 under OS X, which causes problems in sendall

2010-04-26 Thread Jean-Paul Calderone

Jean-Paul Calderone exar...@twistedmatrix.com added the comment:

 But as I said, it's not reliable.

I don't see any evidence in support of this statement.  Did you notice that the 
FreeBSD thread you referenced is:

  * 6 years old
  * about UDP

It's not obvious to me that it's actually relevant here.

 Maybe it would help to have the sample code ?

This seems to be an excellent idea, though.  Without actually knowing what 
program triggers this behavior, any change is just a wild guess and probably a 
waste of time.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8493
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8493] socket's send can raise errno 35 under OS X, which causes problems in sendall

2010-04-26 Thread Jean-Paul Calderone

Jean-Paul Calderone exar...@twistedmatrix.com added the comment:

None of that has much relevance when the socket is in *non-blocking* mode.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8493
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8493] socket's send can raise errno 35 under OS X, which causes problems in sendall

2010-04-26 Thread Jean-Paul Calderone

Jean-Paul Calderone exar...@twistedmatrix.com added the comment:

 If there's something else that would be useful and I can provide it, I'd be 
 glad to.

A minimal example which reproduces the behavior. :)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8493
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8493] socket's send can raise errno 35 under OS X, which causes problems in sendall

2010-04-26 Thread Jean-Paul Calderone

Jean-Paul Calderone exar...@twistedmatrix.com added the comment:

 But if someone can get me access to an FTP server on the other end of a slow 
 link, I'd be glad to do what I can half-wink.

It's easy to get a slow FTP server.  Twisted's FTP support lets you do all 
kinds of customization; making a server that doesn't read very fast (or at 
all!) would be a snap.

Ultimately, I don't think you should actually need an FTP server to reproduce 
this, though.  A discard server should work just as well.

 Unfortunately the problem wasn't mine originally. I'm just the guy on 
 python-help who happened to figure out the answer.

Perhaps you can encourage the OP to take a look at this issue and post some 
code.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8493
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8524] SSL sockets do not retain the parent socket's attributes

2010-04-26 Thread Jean-Paul Calderone

Jean-Paul Calderone exar...@twistedmatrix.com added the comment:

getpeername() sometimes failing soon after a socket is created is a 
semi-well-known Windows socket... feature.  For whatever that's worth.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8524
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8498] Cannot use backlog = 0 for sockets

2010-04-24 Thread Jean-Paul Calderone

Jean-Paul Calderone exar...@twistedmatrix.com added the comment:

It'd be nice to have a unit test that passes a small enough value to listen() 
to trigger the check.  Since there's no way to reliably determine what the 
system backlog really is, there's probably no reason to actually try to 
determine that the right value was passed to listen.  Just making sure the 
code actually goes through the success-case when this check is hit is probably 
enough.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8498
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8524] SSL sockets do not retain the parent socket's attributes

2010-04-24 Thread Jean-Paul Calderone

Jean-Paul Calderone exar...@twistedmatrix.com added the comment:

Well, at the risk of stating the obvious, perhaps the dup() thing should be 
eliminated.  The justification for it seems less than clear, and apparently it 
causes some problems.

That might be a direction to consider in the long term, though, rather than as 
a (different) immediate fix for this issue.

--
nosy: +exarkun
priority: high - normal
resolution: fixed - 
stage: committed/rejected - 
status: pending - open
type: behavior - 

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8524
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8498] Cannot use backlog = 0 for sockets

2010-04-22 Thread Jean-Paul Calderone

Jean-Paul Calderone exar...@twistedmatrix.com added the comment:

 Furthermore, python's socket documentation makes it clear:

Why does CPython go out of its way to make it impossible to pass 0 to the 
platform listen() API?  The part of the specification you quoted makes it very 
clear that 0 is a valid value for this argument.  And 0 seems to have a very 
different meaning than 1, but for some reason CPython thinks that 1 is a better 
thing for 0 to mean.

Perhaps there is a real reason someone thought to add this check in 
sock_listen, but if not, I think it's worth considering removing this check.

Unfortunately the commit message for the revision which added this check 
(r3880) is not informative:

sock_listen: ensure backlog argument is at least1

 If you really want to only accept 1 connection (I'm talking of sending back a 
 SYN-ACK, not an accept() call), you can just close the server socket

This makes perfect sense, though, and is good advice in general.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8498
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8489] smtplib.SMTP.login() breaks with unicode input

2010-04-21 Thread Jean-Paul Calderone

Jean-Paul Calderone exar...@twistedmatrix.com added the comment:

SMTP (RFC 2821) doesn't support non-ASCII envelope addresses.  A better 
behavior here would be for connection.login to raise a ValueError or a 
TypeError whenever a non-str is passed in.

RFC 5336, though, adds the UTF8SMTP extension, which adds support for UTF-8 
encoded unicode mailboxes.  If the server advertises the UTF8SMTP capability, 
then smtplib could encode unicode using UTF-8 and pass it on.

This is really a feature request (RFC 5336 support), not a bug.

--
nosy: +exarkun

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8489
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8407] expose signalfd(2) and sigprocmask(2) in the signal module

2010-04-16 Thread Jean-Paul Calderone

Jean-Paul Calderone exar...@twistedmatrix.com added the comment:

 The one big difference I can see is that set_wakeup_fd() doesn't transmit the 
 signal number, but this could be fixed if desired (instead of sending '\0', 
 send a byte containing the signal number).

There's a lot more information than the signal number available as well.  The 
signalfd_siginfo struct has 16 fields in it now and may have more in the future.

Another advantage is that this approach allows all asynchronous preemption to 
be disabled.  This side-steps the possibility of hitting any signal bugs in 
CPython itself.  Of course, any such bugs that are found should be fixed, but 
fixing them is often quite challenging and involves lots of complex 
domain-specific knowledge.  In comparison, the signalfd and sigprocmask 
extensions are quite straight-forward and self-contained.

It's also possible to have several signalfds, each with a different signal 
mask.  set_wakeup_fd is limited to a single fd per-process.

sigprocmask has other uses all by itself, of course, like delaying the delivery 
of signals while some sensitive code runs.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8407
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8354] siginterrupt with flag=False is reset when signal received

2010-04-15 Thread Jean-Paul Calderone

Jean-Paul Calderone exar...@twistedmatrix.com added the comment:

 Will the modified test fail on platforms that don't define HAVE_SIGACTION?

Only if they also have siginterrupt, which seems unlikely (as neologix 
explained).  The implemented behavior on such platforms is unmodified from 
current trunk, while the test requires new behavior.

I think it's probably worth testing this new behavior separately from the test 
for the existing behavior anyway, for the sake of clarity.  If it turns out 
there's a platform with siginterrupt but not sigaction, then that'll also let 
the test be skipped there, which is nice (though this case seems unlikely to 
come up).

I'm not exactly sure how we will know if it is expected to fail, though.  I 
don't think `HAVE_SIGACTION` is exposed nicely to Python right now.  Perhaps 
the signal module should make this information available (it's somewhat 
important now, as it will mean the difference between a nicely working 
signal.siginterrupt and a not-so-nicely working one).

This quirk probably also bears a mention in the siginterrupt documentation.

A few other thoughts on the code nearby:

  * There seems to be no good reason to special case SIGCHLD in signal_handler. 
 The comment about infinite recursion has no obvious interpretation to me.  
Fortunately, this is irrelevant on platforms with sigaction, because the 
handler remains installed anyway!

  * The distance between the new #ifndef HAVE_SIGACTION check and the 
corresponding #ifdef HAVE_SIGACTION in pythonrun.c is somewhat unfortunate.  
Someone could very easily change the logic in PyOS_setsig and disturb this 
relationship.  I'm not sure how this could best be fixed.  A general idea which 
presents itself is that both of these pieces of code could use a new identifier 
to make this choice, and that identifier could be named/documented such that it 
is obvious that it is used in two different places which must be kept 
synchronized.  Or, some more comments in both places might help.  It seems 
likely that the remaining SIGCHLD check in handle_signal is only there because 
whoever updated PyOS_setsig to use sigaction didn't know about it/remember it.

Aside from those points, the fix seems correct and good.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8354
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8363] Lots of duplicate code between test_classify_oldstyle and test_classify_newstyle in test_inspect.py

2010-04-10 Thread Jean-Paul Calderone

New submission from Jean-Paul Calderone exar...@divmod.com:

There are two tests for the way inspect.classify_class_attrs handles various 
sorts of attributes.  The tests are identical, except one uses a classic class 
and one a new-style class.  The tests sources have actually begun to diverge, 
but so far only in whitespace.  This code will be easier to maintain (not to 
mention shorter) if there is just one copy of the actual test parts.

--
assignee: exarkun
components: Library (Lib), Tests
keywords: needs review, patch
messages: 102776
nosy: exarkun
severity: normal
status: open
title: Lots of duplicate code between test_classify_oldstyle and 
test_classify_newstyle in test_inspect.py
versions: Python 2.7

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8363
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



<    1   2   3   4   5   6   7   8   9   10   >