Opened 7 years ago

Closed 7 years ago

#7339 closed (fixed)

Relying on __del__ being run immediately after del a

Reported by: fijal 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 fijal 7 years ago.
test_dispatcher_jython_gc_v2.patch (1.5 KB) - added by leosoto 7 years ago.
patch which also works with jython
7339_test_dispatcher_gc_fix.diff (1.9 KB) - added by leosoto 7 years ago.
Fixed a mistake I made on the previous patch

Download all attachments as: .zip

Change History (8)

Changed 7 years ago by fijal

comment:1 Changed 7 years ago by jacob

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to wontfix
  • Status changed from new to closed

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 7 years ago by jacob

  • Resolution wontfix deleted
  • Status changed from closed to reopened
  • Triage 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.

Changed 7 years ago by leosoto

patch which also works with jython

comment:3 Changed 7 years ago 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 :( ]

Changed 7 years ago by leosoto

Fixed a mistake I made on the previous patch

comment:4 Changed 7 years ago by fijal

  • Cc fijall@… added

comment:5 Changed 7 years ago by russellm

  • Resolution set to fixed
  • Status changed from reopened to closed

(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