[New-bugs-announce] [issue7688] TypeError: __name__ must be set to a string object

Frank Millman report at bugs.python.org
Wed Jan 13 08:47:00 CET 2010


New submission from Frank Millman <frank at chagford.com>:

At the top of my program I have 'from __future__ import unicode_literals'.

The relevant lines from my program read -
    from multiprocessing.managers import BaseManager
    class MyManager(BaseManager): pass
    MyManager.register('my_function', my_function)

In multiprocessing.managers.py, the following lines are executed -

605 @classmethod
606 def register(cls, typeid, ...)
        [...]
632     def temp(...):
            [...]
642     temp.__name__ = typeid

At this point, Python raises the exception
    TypeError: __name__ must be set to a string object

I can fix it by changing my last line to -
    MyManager.register(str('my_function'), my_function)

Is it possible to allow __name__ to be a unicode object?

If not, may I suggest that line 642 of managers.py is changed to -
        temp.__name__ = str(typeid)

Frank Millman

----------
components: Library (Lib)
messages: 97697
nosy: frankmillman
severity: normal
status: open
title: TypeError: __name__ must be set to a string object
type: crash
versions: Python 2.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7688>
_______________________________________


More information about the New-bugs-announce mailing list