badouxn <bado...@ethz.ch> added the comment:

My first fix was indeed wrong. 
Upon looking further into it, it seems to me that the problem come from the 
fact that the call to super is not done with the right argument. 
Upon unpickling, the argument that will be passed to the __init__ is the string 
representation built on line 33-34.
That's why, when leaving expected as optional the number returned is 44, the 
length of the string. 

I went looking for similar Exception class in the code base and found the 
MaybeEncodingError in multiprocessing/pool.py 

By replacing the Error content with this one I don't have any error anymore. 
The message is kept identical. 
'''
     def __init__(self, partial, expected):
         super().__init__(partial, expected)
         self.partial = partial
         self.expected = expected
     def __str__(self):
         return ("%d bytes read on a total of %r expected bytes" % 
(len(partial), expected))
'''

Does such a fix looks correct to you ?

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32034>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to