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

merged 1 commit into from Jan 14, 2017


None yet
2 participants

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/", 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/", 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/", 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/", 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/", 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/", 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/", line 226, in increment
E   	    total -= 1
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/    register('--retries', default=1, advanced=True,
contrib/go/src/python/pants/contrib/go/subsystems/    register('--retries', default=1, advanced=True,

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

@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