[ python-Bugs-1448639 ] asyncore dispatcher.__getattr__() masks self._map
SourceForge.net
noreply at sourceforge.net
Fri Mar 17 12:51:28 CET 2006
Bugs item #1448639, was opened at 2006-03-13 04:52
Message generated for change (Comment added) made by gbrandl
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1448639&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.4
>Status: Closed
>Resolution: Invalid
Priority: 5
Submitted By: Doug White (dwhite)
Assigned to: Nobody/Anonymous (nobody)
Summary: asyncore dispatcher.__getattr__() masks self._map
Initial Comment:
The abstraction of socket_map in the asyncore module
in Python 2.4 forgets to allow accesses to the
internal attribute self._map in __getattr__(). This
causes any asyncore application to fail in
create_socket(), which pretty much renders asyncore
inoperative in Python 2.4.
This problem was introduced in rev 34469 as a commit
of Bug #758241.
Example backtrace, generated from an application that
uses Medusa servers that don't use the private map
function:
Traceback (most recent call last):
File "/usr/local/qos/qosserver/qos_server.py", line
1576, in ?
m = monitor.monitor_server ('127.0.0.1',
BasePort)
File "/usr/local/qos/qosserver/monitor.py", line
161, in __init__
self.create_socket (socket.AF_INET,
socket.SOCK_STREAM)
File "/usr/local/lib/python2.4/asyncore.py", line
261, in create_socket
self.add_channel()
File "/usr/local/lib/python2.4/asyncore.py", line
244, in add_channel
map = self._map
File "/usr/local/lib/python2.4/asyncore.py", line
366, in __getattr__
return getattr(self.socket, attr)
AttributeError: '_socketobject' object has no
attribute '_map'
__getattr__() should test if the attribute exists in
its own object before passing it on to the underlying
socket object.
----------------------------------------------------------------------
>Comment By: Georg Brandl (gbrandl)
Date: 2006-03-17 11:51
Message:
Logged In: YES
user_id=849994
It seems that zseil is right. Closing as Invalid.
----------------------------------------------------------------------
Comment By: iga Seilnacht (zseil)
Date: 2006-03-17 11:37
Message:
Logged In: YES
user_id=1326842
This is a bug in your code, since you don't call the
base class's __init__() method, and as a consequence
the '_map' attribute really doesn't exist.
__getattr__() doesn't have to check for existance of
an attribute since it is called only when the normal
lookup mechanism fails. See the docs:
http://docs.python.org/ref/attribute-access.html
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1448639&group_id=5470
More information about the Python-bugs-list
mailing list