Issue1497319
Created on 2006年05月30日 05:29 by zseil, last changed 2022年04月11日 14:56 by admin. This issue is now closed.
| Messages (5) |
|
msg28679 - (view) |
Author: Ziga Seilnacht (zseil) * (Python committer) |
Date: 2006年05月30日 05:29 |
The crash happens if an Exception doesn't
have a dict, in BaseException_reduce.
Example:
Python 2.5a2 (trunk:46539M, May 30 2006, 05:02:24)
[MSC v.1310 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license"
for more information.
>>> import pickle
>>> e = BaseException()
>>> pickle.dumps(e) # crash
I'm attaching a module with this and some
other failing tests, mostly caused by
backward incompatibilities. All of the
tests pass on 2.5a2.
|
|
msg28680 - (view) |
Author: Georg Brandl (georg.brandl) * (Python committer) |
Date: 2006年05月30日 07:13 |
Logged In: YES
user_id=849994
Thanks! Fixed in rev. 46551, added a test case.
|
|
msg28681 - (view) |
Author: Georg Brandl (georg.brandl) * (Python committer) |
Date: 2006年05月30日 07:35 |
Logged In: YES
user_id=849994
Added another test for kw args in rev. 46553.
That args can only be an iterable and will, once assigned,
always be a tuple, was a decision we made.
|
|
msg28682 - (view) |
Author: Ziga Seilnacht (zseil) * (Python committer) |
Date: 2006年05月30日 08:20 |
Logged In: YES
user_id=1326842
The _PyArg_NoKeywords check should probably be in
BaseException_init, not in BaseException_new, so
that subclasses that want keyword arguments don't
have to override two methods.
|
|
msg28683 - (view) |
Author: Ziga Seilnacht (zseil) * (Python committer) |
Date: 2006年05月30日 08:35 |
Logged In: YES
user_id=1326842
Oh, and another thing, unpickling exceptions
that were pickled with an older version
of Python will have strange effects:
Python 2.4.3 (#69, Mar 29 2006, 17:35:34)
...
>>> import pickle
>>> f = open('jar', 'wb')
>>> e = Exception('cucumbers', 'cabbage')
>>> e.args
('cucumbers', 'cabbage')
>>> pickle.dump(e, f)
>>> f.close()
>>> f = open('jar', 'rb')
>>> e = pickle.load(f)
>>> f.close()
>>> e.args
('cucumbers', 'cabbage')
Python 2.5a2 (trunk:46539M, May 30 2006, 05:02:24)
...
>>> import pickle
>>> f = open('jar', 'rb')
>>> e = pickle.load(f)
>>> f.close()
>>> e.args
()
>>> e.__dict__['args']
('cucumbers', 'cabbage')
|
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2022年04月11日 14:56:17 | admin | set | github: 43433 |
| 2006年05月30日 05:29:12 | zseil | create |