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)

Changed 10 years ago by awknaust

comment:1 Changed 10 years ago by Cas

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 Changed 10 years ago by awknaust

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 Changed 10 years ago by Cas

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

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

comment:4 Changed 10 years ago by Cas

  • Resolution set to Fixed
  • Status changed from new to closed

comment:5 Changed 8 years ago by Cas

  • Milestone changed from 2.0.x to 2.0

comment:6 Changed 6 years ago by Cas

  • Milestone changed from 2.0 to 2.0.0

Milestone renamed

Note: See TracTickets for help on using tickets.