<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>87413</bug_id>
          
          <creation_ts>2012-05-24 12:30:19 -0700</creation_ts>
          <short_desc>webkitpy.layout_tests.port.base.get_option should not return None if a default argument is supplied</short_desc>
          <delta_ts>2012-06-15 15:08:25 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Tools / Tests</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WONTFIX</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          <dependson>89135</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter>jochen</reporter>
          <assigned_to name="Dirk Pranke">dpranke</assigned_to>
          <cc>abarth</cc>
    
    <cc>dpranke</cc>
    
    <cc>eric</cc>
    
    <cc>ojan</cc>
    
    <cc>thorton</cc>
    
    <cc>tony</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>633053</commentid>
    <comment_count>0</comment_count>
    <who name="">jochen</who>
    <bug_when>2012-05-24 12:30:19 -0700</bug_when>
    <thetext>if an option &apos;foo&apos; is set to None, get_option(&apos;foo&apos;, &apos;bar&apos;) returns None, but it should return &apos;bar&apos;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>633056</commentid>
    <comment_count>1</comment_count>
    <who name="Dirk Pranke">dpranke</who>
    <bug_when>2012-05-24 12:31:38 -0700</bug_when>
    <thetext>For the record, there was a reason I did it this way, but in retrospect it was probably a dumb reason as it has led to a confusing and unintuitive interface. I need to go back and poke around to try and figure out why I did it this way in the first place.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>648756</commentid>
    <comment_count>2</comment_count>
    <who name="Tim Horton">thorton</who>
    <bug_when>2012-06-13 20:56:36 -0700</bug_when>
    <thetext>Yes please.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>648759</commentid>
    <comment_count>3</comment_count>
    <who name="Dirk Pranke">dpranke</who>
    <bug_when>2012-06-13 20:59:10 -0700</bug_when>
    <thetext>I&apos;ll try to get to this tomorrow ... sigh ...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>649554</commentid>
    <comment_count>4</comment_count>
    <who name="Dirk Pranke">dpranke</who>
    <bug_when>2012-06-14 15:41:43 -0700</bug_when>
    <thetext>Okay, having poked around with this a fair amount, it turns out that the code is doing the &quot;correct&quot; thing.

Meaning, if you have:

obj.x = None
getattr(obj, &apos;x&apos;, 4) == None   # is True

d = {&apos;x&apos;: None}
d.get(&apos;x&apos;, 4) == None # is True

i.e., the code is mirroring the normal python behavior.

admittedly, this will be confusing on occasion, but I think having it do the opposite is also confusing.

In the long run what we probably need is some consistent way to make sure port._options has all the values the port/* classes will need, and then make port.get_option() and port.set_option_default() protected/private functions so that callers of port objects are responsible for their own options management.

Fixing this is annoying because, even in NRWT, right now the responsibility for setting default values in options is split between code in run_webkit_tests.py and code in the port packages.

I&apos;m going to post a separate patch that cleans up this code slightly, but I wanted people to get a chance to read and comment on this before I spent time refactoring a bunch of code to do what I describe above.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>650558</commentid>
    <comment_count>5</comment_count>
    <who name="Dirk Pranke">dpranke</who>
    <bug_when>2012-06-15 15:08:25 -0700</bug_when>
    <thetext>closing this as WONTFIX (although the reason code is debatable ...)</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>