Opened 8 years ago

Closed 8 years ago

#7339 closed (fixed)

Relying on __del__ being run immediately after del a

Reported by: Maciej Fijalkowski Owned by: nobody
Component: Uncategorized Version: master
Severity: Keywords:
Cc: fijall@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

A patch for calling gc.collect here and there in tests, not to rely on gc being refcounting.

Attachments (3)

django.diff (1.7 KB) - added by Maciej Fijalkowski 8 years ago.
test_dispatcher_jython_gc_v2.patch (1.5 KB) - added by Leo Soto M. 8 years ago.
patch which also works with jython
7339_test_dispatcher_gc_fix.diff (1.9 KB) - added by Leo Soto M. 8 years ago.
Fixed a mistake I made on the previous patch

Download all attachments as: .zip

Change History (8)

Changed 8 years ago by Maciej Fijalkowski

Attachment: django.diff added

comment:1 Changed 8 years ago by Jacob

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Resolution: wontfix
Status: newclosed

You need to read more about how __del__ works in Python. The way it works is by design, and we're not going to engage in GC tricks to try to make it act like it does in other languages.

comment:2 Changed 8 years ago by Jacob

Resolution: wontfix
Status: closedreopened
Triage Stage: UnreviewedAccepted

Nope, I need to read more about how del works in other Python implementations -- PyPy needs this to make the test pass. Thanks for setting me straight, fijal.

Changed 8 years ago by Leo Soto M.

patch which also works with jython

comment:3 Changed 8 years ago by Leo Soto M.

Oh, I didn't see this ticket when filling #7440. I marked that as duplicate and uploaded a new patch here, which should work for Jython and PyPy too.

[Yep, the GC in Java is more tricky :( ]

Changed 8 years ago by Leo Soto M.

Fixed a mistake I made on the previous patch

comment:4 Changed 8 years ago by Maciej Fijalkowski

Cc: fijall@… added

comment:5 Changed 8 years ago by Russell Keith-Magee

Resolution: fixed
Status: reopenedclosed

(In [8004]) Fixed #7339 -- Added manual calls to the garbage collector. This is required for PyPy and Jython; these implementations don't use reference counting, so you can't rely on del being run immediately after del is called. Thanks to Maciej Fijalkowski (fijal) and Leo Soto.

Note: See TracTickets for help on using tickets.
Back to Top