GTG

returnlist reimplements copy.deepcopy

Bug #398360 reported by Jonathan Lange
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
GTG
Fix Released
Wishlist
Jonathan Lange

Bug Description

The comment before returnlist() says:
  #Return a copy of the list and avoid a to keep the same object
  #It handles multilple dimension matrix through recursion

(Incidentally, shouldn't that be a docstring?)

Python already comes with a way to do this. It's called 'deepcopy' and it's in the 'copy' module of the standard library.

Tags: code-cleanup

Related branches

Revision history for this message
Jonathan Lange (jml) wrote :

I've submitted a patch for this.

Changed in gtg:
assignee: nobody → Jonathan Lange (jml)
status: New → In Progress
Revision history for this message
Lionel Dricot (ploum-deactivatedaccount) wrote :

I've undoed your merge for this as it causes some trouble (heavy crashes).

TypeError: instancemethod expected at least 2 arguments, got 0
Traceback (most recent call last):
  File "/home/ploum/gtg/GTG/taskbrowser/browser.py", line 768, in refresh_tb
    self.refresh_list(toselect=toselect)
  File "/home/ploum/gtg/GTG/taskbrowser/browser.py", line 877, in refresh_list
    treeview=False)
  File "/home/ploum/gtg/GTG/taskbrowser/browser.py", line 1007, in add_task_tree_to_list
    tags = task.get_tags()
  File "/home/ploum/gtg/GTG/core/task.py", line 401, in get_tags
    return deepcopy(self.tags)
  File "/usr/lib/python2.6/copy.py", line 162, in deepcopy
    y = copier(x, memo)

It looks like our own implementation is more robust.

Maybe, using deepcopy uncovered a bug in GTG. If this is the case, then I would suggest to make thing easier by only calling deepcopy in the returnlist function, allowing easy change for developpers.

Changed in gtg:
importance: Undecided → Wishlist
Changed in gtg:
milestone: none → 0.2
status: In Progress → Fix Committed
Changed in gtg:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.