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

Default value for socket.gethostname() should be str, not bytes #295

Open
PierreQuentel opened this issue Oct 21, 2021 · 0 comments
Open

Comments

@PierreQuentel
Copy link

boltons/boltons/iterutils.py

Lines 1322 to 1332 in 270e974

def reseed(self):
import socket
self.pid = os.getpid()
self.salt = '-'.join([str(self.pid),
socket.gethostname() or b'<nohostname>',
str(time.time()),
codecs.encode(os.urandom(6),
'hex_codec').decode('ascii')])
# that codecs trick is the best/only way to get a bytes to
# hexbytes in py2/3
return

If the default value is used, '-'.join([...]) fails because the second item is bytes, not str.

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