Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Issue 180] Fix python2 x python3 incompatibility #225

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

almostimplemented
Copy link

Addresses bug #180 encountered when running Graphite in Python 3.

@brutasse
Copy link
Owner

Would it be possible to add a regression test? I'm not sure which conditions triggers this issue.

@almostimplemented
Copy link
Author

Sure, added.

The condition to trigger is when the operands of the compare in bisect.bisect_left (specifically: if a[mid] < x: lo = mid+1) agree on the first value of the tuple, thus requiring a comparison of the next entry. In the current code, that entry is None, which is no longer a supported operand for comparison in Python3.

("127.0.0.1",None)
]
carbonlink = ConsistentHashRing(hosts)
node = carbonlink.get_node('hosts.worker44.cpu')
Copy link
Author

@almostimplemented almostimplemented Nov 2, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, it looks like this passed the automated test... I arrived upon this value by iterating through metric values (e.g. for x in range(100): ... 'hosts.worker%s.cpu' % x ... ). This was the first value triggering the raised bisect exception.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants