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

Python > 3.4 does not convert float to hex via %x formatter #120

Open
cstrotm opened this issue Jul 24, 2017 · 1 comment
Open

Python > 3.4 does not convert float to hex via %x formatter #120

cstrotm opened this issue Jul 24, 2017 · 1 comment

Comments

@cstrotm
Copy link
Contributor

cstrotm commented Jul 24, 2017

# /usr/local/sbin/bundy -v
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib64/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/usr/lib64/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/libexec/bundy/bundy-msgq", line 678, in run
    self.run_select()
  File "/usr/local/libexec/bundy/bundy-msgq", line 708, in run_select
    self.process_accept()
  File "/usr/local/libexec/bundy/bundy-msgq", line 332, in process_accept
    self.register_socket(newsocket)
  File "/usr/local/libexec/bundy/bundy-msgq", line 340, in register_socket
    lname = self.newlname()
  File "/usr/local/libexec/bundy/bundy-msgq", line 577, in newlname
    self.hostname)
TypeError: %x format: an integer is required, not float

@cstrotm
Copy link
Contributor Author

cstrotm commented Jul 24, 2017

proposed fix

    def newlname(self):
        """Generate a unique connection identifier for this socket.
        This is done by using an increasing counter and the current
        time."""
        self.connection_counter += 1
        return "%s_%s@%s" % (time.ctime(), float.hex(self.connection_counter),
                             self.hostname)

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

No branches or pull requests

1 participant