Issue 14501: Error initialising BaseManager class with 'authkey' argument of string type. (original) (raw)

Created on 2012-04-05 06:45 by Drauger, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (5)
msg157539 - (view) Author: Максим Цыпкин (Drauger) Date: 2012-04-05 06:45
The following code: class TestServer(BaseManager):pass Server_1=TestServer(address=("127.0.0.1",55555),authkey="passkey") produces following error in python 3.2 : "TypeError: string argument without an encoding" The cause is in BaseManager constructor implementation (Python32\Lib\multiprocessing\managers.py): self._authkey = AuthenticationString(authkey) The "AuthenticationString" class is a substitute of "bytes" class, and "bytes" class requires second encoding argument, if first argument is a string. I've solved this problem, changing the code in "Python32\Lib\multiprocessing\managers.py" to following: if isinstance(authkey,str): self._authkey = AuthenticationString(authkey,'utf-8') else: self._authkey = AuthenticationString(authkey) This works for me. Please consider to fix this issue in release.
msg157577 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2012-04-05 12:52
Thanks for the report. I'm not familiar with multiprocessing, so I'll have to leave it to someone else to judge the fix. We use 'crash' to indicate a segfault in the Python interpreter, so I'm changing the type to 'behavior' (that is, a normal bug).
msg166480 - (view) Author: Richard Oudkerk (sbt) * (Python committer) Date: 2012-07-26 12:59
You could just do Server_1=TestServer(address=("127.0.0.1",55555),authkey=b"passkey") so this is probably a documentation issue. The examples in the documentation should at least be updated.
msg168443 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-08-17 13:43
New changeset 636f75da4b9e by Richard Oudkerk in branch '3.2': Issue #14501: Clarify that authentication keys are byte strings http://hg.python.org/cpython/rev/636f75da4b9e
msg168444 - (view) Author: Richard Oudkerk (sbt) * (Python committer) Date: 2012-08-17 13:52
I have fixed the documentation and examples to say that authentication keys are byte strings.
History
Date User Action Args
2022-04-11 14:57:28 admin set github: 58706
2012-08-17 13:52:24 sbt set status: open -> closedresolution: fixedmessages: + stage: needs patch -> resolved
2012-08-17 13:43:35 python-dev set nosy: + python-devmessages: +
2012-07-26 12:59:39 sbt set messages: +
2012-07-26 00:23:11 sbt set nosy: + sbt
2012-07-25 22:51:26 ezio.melotti set nosy: + jnollerstage: needs patch
2012-04-05 12:52:36 r.david.murray set versions: + Python 3.3nosy: + r.david.murray, asksolmessages: + type: crash -> behavior
2012-04-05 06:45:54 Drauger create