Issue3634
Created on 2008-08-21 17:25 by haypo, last changed 2008-09-09 20:56 by benjamin.peterson.
| File name |
Uploaded |
Description |
Edit |
Remove |
|
weakref_init.patch
|
haypo,
2008-08-21 17:25
|
Fix weakref___init__() return value: -1 on error |
|
|
|
weakref_test-2.patch
|
haypo,
2008-09-09 09:44
|
Test <weakref to class>.__init__() using assertRaise() |
|
|
| msg71662 (view) |
Author: STINNER Victor (haypo) |
Date: 2008-08-21 17:25 |
|
_weakref.__init__() doesn't catch errors correctly. Example:
--------------------- 8< -------------------------
from gc import collect
import _weakref
class FuzzingUserClass:
pass
obj = _weakref.ref(FuzzingUserClass)
# Exception not raised??
obj.__init__(
0,
0,
0,
)
# Exception catched here??
collect()
--------------------- 8< -------------------------
Attached patch fix the bug for py3k branch: return -1 on error
(instead of 1).
|
| msg72809 (view) |
Author: STINNER Victor (haypo) |
Date: 2008-09-08 23:45 |
|
The bug and the fix are trivials. Can anyone review my patch?
|
| msg72811 (view) |
Author: Benjamin Peterson (benjamin.peterson) |
Date: 2008-09-08 23:58 |
|
The patch looks absolutely fine to me. (I think I have to have another
core developer look at it too, though.)
|
| msg72812 (view) |
Author: Antoine Pitrou (pitrou) |
Date: 2008-09-09 00:17 |
|
Adding a simple unit test would be nice.
|
| msg72830 (view) |
Author: STINNER Victor (haypo) |
Date: 2008-09-09 08:17 |
|
Add a test to check to regression.
|
| msg72833 (view) |
Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) |
Date: 2008-09-09 09:20 |
|
I think the test should check that TypeError is actually raised:
self.assertRaises(TypeError, r.__init__, 0, 0, 0, 0, 0)
It's even shorter than the try/except block...
|
| msg72835 (view) |
Author: STINNER Victor (haypo) |
Date: 2008-09-09 09:45 |
|
amaury: oh yes, i forget to use assertRaise(). A new patch is
attached.
|
| msg72842 (view) |
Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) |
Date: 2008-09-09 11:20 |
|
Both patches look fine to me.
They could be backported to 2.5 as well.
|
| msg72909 (view) |
Author: Benjamin Peterson (benjamin.peterson) |
Date: 2008-09-09 20:56 |
|
Fixed in r66352.
|
|
| Date |
User |
Action |
Args |
| 2008-09-09 20:56:33 | benjamin.peterson | set | status: open -> closed resolution: accepted -> fixed messages:
+ msg72909 |
| 2008-09-09 11:20:24 | amaury.forgeotdarc | set | keywords:
- needs review resolution: accepted messages:
+ msg72842 |
| 2008-09-09 09:45:03 | haypo | set | messages:
+ msg72835 |
| 2008-09-09 09:44:16 | haypo | set | files:
- weakref_test.patch |
| 2008-09-09 09:44:12 | haypo | set | files:
+ weakref_test-2.patch |
| 2008-09-09 09:20:55 | amaury.forgeotdarc | set | nosy:
+ amaury.forgeotdarc messages:
+ msg72833 |
| 2008-09-09 08:17:46 | haypo | set | files:
+ weakref_test.patch messages:
+ msg72830 |
| 2008-09-09 00:17:42 | pitrou | set | nosy:
+ pitrou messages:
+ msg72812 |
| 2008-09-08 23:58:14 | benjamin.peterson | set | keywords:
+ needs review assignee: benjamin.peterson messages:
+ msg72811 nosy:
+ benjamin.peterson |
| 2008-09-08 23:45:45 | haypo | set | messages:
+ msg72809 |
| 2008-08-26 00:53:31 | ajaksu2 | set | nosy:
+ ajaksu2 |
| 2008-08-21 17:25:00 | haypo | create | |
|