Title: asynchat async_chat __init__() arguments changed in python 2.6
Type: Stage:
Components: Library (Lib) Versions: Python 2.6
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: josiahcarlson Nosy List: forest, josiahcarlson, nadeem.vawda
Priority: normal Keywords:

Created on 2008-09-18 22:27 by forest, last changed 2008-09-19 02:08 by josiahcarlson. This issue is now closed.

Messages (2)
msg73405 - (view) Author: Forest (forest) Date: 2008-09-18 22:27
In python 2.6rc2, the async_chat.__init__() parameters have changed. 
The first arg was called 'conn' in python 2.5, and it is now called
'sock'.  This change breaks code that worked with previous python 2.x
versions, if that code followed the example in the official docs:

  class http_request_handler(asynchat.async_chat):
    def __init__(self, conn, addr, sessions, log):
      asynchat.async_chat.__init__(self, conn=conn)

The change also breaks the 2.6 docs, as they have not been updated to
reflect the newly renamed parameter.

The change appears to come from Nadeem Vawda as part of issue1519.  (See

I expect that existing python code could be modified to work around the
problem by using positional args instead of keyword args.  However, I
didn't expect to have to update my working code to accommodate such a
change in the python 2.x code line.  I agree that 'sock' is a better
name for the parameter, especially since it matches the same in
asyncore.dispatcher, but should the change really happen before python
3.0?  If so, let's at least update the docs.
msg73413 - (view) Author: Josiah Carlson (josiahcarlson) * (Python triager) Date: 2008-09-19 02:08
Fixed documentation in revision 66510.  Also, the parameters changed 
long before rc2. ;)
Date User Action Args
2008-09-19 02:08:19josiahcarlsonsetstatus: open -> closed
resolution: fixed
messages: + msg73413
2008-09-18 22:33:25benjamin.petersonsetassignee: josiahcarlson
nosy: + josiahcarlson
2008-09-18 22:27:57forestcreate