Fix `str`-typed options with `int` defaults. #4184

Merged
merged 1 commit into from Jan 14, 2017

Conversation

Projects
None yet
2 participants
@jsirois
Member

jsirois commented Jan 14, 2017

Prompted by a CI failure in #4183:

...
E   	  File "/home/travis/build/pantsbuild/pants/contrib/go/src/python/pants/contrib/go/subsystems/go_import_meta_tag_reader.py", line 61, in get_imported_repo
E   	    page_data = session.get('http://{import_path}?go-get=1'.format(import_path=import_path))
E   	  File "/home/travis/build/pantsbuild/pants/build-support/pants_dev_deps.venv/lib/python2.7/site-packages/requests/sessions.py", line 473, in get
E   	    return self.request('GET', url, **kwargs)
E   	  File "/home/travis/build/pantsbuild/pants/build-support/pants_dev_deps.venv/lib/python2.7/site-packages/requests/sessions.py", line 461, in request
E   	    resp = self.send(prep, **send_kwargs)
E   	  File "/home/travis/build/pantsbuild/pants/build-support/pants_dev_deps.venv/lib/python2.7/site-packages/requests/sessions.py", line 573, in send
E   	    r = adapter.send(request, **kwargs)
E   	  File "/home/travis/build/pantsbuild/pants/build-support/pants_dev_deps.venv/lib/python2.7/site-packages/requests/adapters.py", line 370, in send
E   	    timeout=timeout
E   	  File "/home/travis/build/pantsbuild/pants/build-support/pants_dev_deps.venv/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py", line 597, in urlopen
E   	    _stacktrace=sys.exc_info()[2])
E   	  File "/home/travis/build/pantsbuild/pants/build-support/pants_dev_deps.venv/lib/python2.7/site-packages/requests/packages/urllib3/util/retry.py", line 226, in increment
E   	    total -= 1
E   	
E   	Exception message: unsupported operand type(s) for -=: 'str' and 'int'
...

Instances of the issue swept via:

$ git grep register | grep -E "default=[0-9]" | grep -v -E "type=(int|float)"
contrib/go/src/python/pants/contrib/go/subsystems/archive_retriever.py:    register('--retries', default=1, advanced=True,
contrib/go/src/python/pants/contrib/go/subsystems/go_import_meta_tag_reader.py:    register('--retries', default=1, advanced=True,
@benjyw

benjyw approved these changes Jan 14, 2017

@jsirois jsirois merged commit 9322184 into pantsbuild:master Jan 14, 2017

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@jsirois jsirois deleted the jsirois:jsirois/options/fix_default_type_mismatches branch Jan 17, 2017

lenucksi added a commit to lenucksi/pants that referenced this pull request Apr 25, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment