Django

Code

Ticket #7339 (closed: fixed)

Opened 2 years ago

Last modified 2 years ago

Relying on __del__ being run immediately after del a

Reported by: fijal Assigned to: nobody
Milestone: Component: Uncategorized
Version: SVN Keywords:
Cc: fijall@gmail.com Triage Stage: Accepted
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description

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

Attachments

django.diff (1.7 kB) - added by fijal on 05/31/08 14:10:33.
test_dispatcher_jython_gc_v2.patch (1.5 kB) - added by leosoto on 06/12/08 23:03:03.
patch which also works with jython
7339_test_dispatcher_gc_fix.diff (1.9 kB) - added by leosoto on 07/06/08 01:02:33.
Fixed a mistake I made on the previous patch

Change History

05/31/08 14:10:33 changed by fijal

  • attachment django.diff added.

05/31/08 17:01:00 changed by jacob

  • status changed from new to closed.
  • needs_better_patch changed.
  • resolution set to wontfix.
  • needs_tests changed.
  • needs_docs changed.

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.

05/31/08 19:36:00 changed by jacob

  • status changed from closed to reopened.
  • resolution deleted.
  • stage changed from Unreviewed to Accepted.

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.

06/12/08 23:03:03 changed by leosoto

  • attachment test_dispatcher_jython_gc_v2.patch added.

patch which also works with jython

06/12/08 23:07:54 changed by leosoto

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 :( ]

07/06/08 01:02:33 changed by leosoto

  • attachment 7339_test_dispatcher_gc_fix.diff added.

Fixed a mistake I made on the previous patch

07/13/08 02:21:07 changed by fijal

  • cc set to fijall@gmail.com.

07/20/08 01:32:55 changed by russellm

  • status changed from reopened to closed.
  • resolution set to fixed.

(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.


Add/Change #7339 (Relying on __del__ being run immediately after del a)




Change Properties
Action