Opened 10 years ago

Closed 10 years ago

Last modified 6 years ago

#2510 closed patch (Fixed)

Bug in config.py type checking

Reported by: awknaust Owned by:
Priority: minor Milestone: 2.0.0
Component: Core Version: develop
Keywords: config Cc:

Description

The old (1.37) compared types properly but in development, isinstance is being misused. This resulted in a exceptions when a new config option was being added (maybe when moving the preferences dialog)

Attachments (2)

0001-Fix-a-bug-in-config-typechecking.patch (902 bytes ) - added by awknaust 10 years ago.
0001-Added-test-case-for-overwriting-null-config-values.patch (1.4 KB ) - added by awknaust 10 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 by Calum, 10 years ago

Using isinstance is the correct usage to compare types, I just messed up the implementation here.

A test needs add to test_config to replicate this issue and ensure it is fixed.

Do you have the exception trace or how to replicate?

comment:2 by awknaust, 10 years ago

This is an example traceback. I wrote a short test case to cover this scenario

Traceback (most recent call last):
  File "/home/awknaust/deluge/deluge/ui/gtkui/preferences.py", line 831, in on_pref_dialog_configure_event
    self.gtkui_config["pref_dialog_width"] = event.width
  File "/home/awknaust/deluge/deluge/config.py", line 148, in __setitem__
    return self.set_item(key, value)
  File "/home/awknaust/deluge/deluge/config.py", line 189, in set_item
    value = oldtype(value)
TypeError: cannot create 'NoneType' instances

comment:3 by Calum, 10 years ago

Thanks, I've added to develop your test [3b950094] and fixed the issue [11c6e387].

Last edited 10 years ago by Calum (previous) (diff)

comment:4 by Calum, 10 years ago

Resolution: Fixed
Status: newclosed

comment:5 by Calum, 9 years ago

Milestone: 2.0.x2.0

comment:6 by Calum, 6 years ago

Milestone: 2.02.0.0

Milestone renamed

Note: See TracTickets for help on using tickets.