[viff-devel] Weird behaviour

Janus Dam Nielsen janus.nielsen at alexandra.dk
Thu Jul 30 06:50:09 PDT 2009


Hi VIFF'ers,


I have a small class and a unit test for it. The unittest fails, but  
this is not the real issue. The issue is the strange behavior I see  
during execution.

During execution I see output similar to this:
 >>>
Seeding random generator with random seed 5590
test_dealer
   DealerTest
     test_next_three_cards ... INIT Share value: None <Share at  
0x278f0a8>
...
contains 3 []
...
contains 1 []
adding 1 <Share at 0x278ceb8  current result: {13}>
...
contains 2 []
adding 2 <Share at 0x278f558>
...
contains 2 [<Share at 0x278f558  current result: None>]
adding 2 <Share at 0x2787d50>
...
contains 3 [<Share at 0x278f440  current result: None>]
adding 3 <Share at 0x2791c38>
...
contains 1 [<Share at 0x278ceb8  current result: None>]
adding 1 <Share at 0x278fc88  current result: {9}>
...
<<<

As you see when player 1 adds a share to the value list, the current  
result of the share is 13. However when player 1 comes around to add a  
new share with current result 9, the current result of the share  
already contained in the list has transformed into None! It is clear  
from the hashcode that it is still the same object, so why does the  
current value change??

I have tried to boil down the code as much as possible.

The test is executed with
trial test_dealer.py
on python 2.6.2




____________________________________________________

Janus Dam Nielsen

R&D SCIENTIST, PhD.
CENTRE FOR IT-SECURITY

THE ALEXANDRA INSTITUTE LTD.

T +45 42 22 93 56
E janus.nielsen at alexandra.dk
W alexandra.dk
____________________________________________________

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.viff.dk/pipermail/viff-devel-viff.dk/attachments/20090730/d85fd0df/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dealer.py
Type: text/x-python-script
Size: 1035 bytes
Desc: not available
URL: <http://lists.viff.dk/pipermail/viff-devel-viff.dk/attachments/20090730/d85fd0df/attachment.bin>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.viff.dk/pipermail/viff-devel-viff.dk/attachments/20090730/d85fd0df/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_dealer.py
Type: text/x-python-script
Size: 1337 bytes
Desc: not available
URL: <http://lists.viff.dk/pipermail/viff-devel-viff.dk/attachments/20090730/d85fd0df/attachment-0001.bin>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.viff.dk/pipermail/viff-devel-viff.dk/attachments/20090730/d85fd0df/attachment-0002.htm>


More information about the viff-devel mailing list