Opened 8 years ago

#7274 defect new

RemoteCache objects don't pass themselves into self.observe_* methods

Reported by: Daniel Sank Owned by:
Priority: normal Milestone:
Component: pb Keywords: pb
Cc: warner Branch:
Author: sank.daniel@gmail.com

Description

Suppose I have an instance of a RemoteCache (or subclass) called myRemoteCache. If I call id(myRemoteCache), I get a certain number which we denote X. If I call id(self) within an observe_* method of myRemoteCache, I get a different number, which we denote Y. We find that in general X!=Y.

This is a bug because the self argument passed into a bound method should be the same as the object before the dot in the method call.

I do know why this is happening. In twisted.spread.flavors.py we have the RemoteCache class. This guy's unjellyFor creates a new completely blank (1) object called cProxy (2) with the following line of code

cProxy = _newDummyLike(self),

and returns it. By inserting print lines, we find that

id(cProxy)=X,

but

id(self)=Y

It looks like this is the source of the bug.

Attached to this ticket are a small set of files which can be run to reproduce the error. Run server.py and then client.py to see that the RemoteCache reports its id differently depending on whether it reports from within observe_* or elsewhere.

(1) Blank as in no code in the class definition.

(2) What is the meaning of this name?

Attachments (4)

client.py (202 bytes) - added by Daniel Sank 8 years ago.
The runnable client
server.py (446 bytes) - added by Daniel Sank 8 years ago.
The runnable server
resources.py (3.2 KB) - added by Daniel Sank 8 years ago.
Definitions of the classes used in the client and server
readme.txt (356 bytes) - added by Daniel Sank 8 years ago.
Instructions on how to run the demo.

Download all attachments as: .zip

Change History (5)

comment:1 Changed 8 years ago by DefaultCC Plugin

Cc: warner added

Changed 8 years ago by Daniel Sank

Attachment: client.py added

The runnable client

Changed 8 years ago by Daniel Sank

Attachment: server.py added

The runnable server

Changed 8 years ago by Daniel Sank

Attachment: resources.py added

Definitions of the classes used in the client and server

Changed 8 years ago by Daniel Sank

Attachment: readme.txt added

Instructions on how to run the demo.

Note: See TracTickets for help on using tickets.