|
|
@ -37,6 +37,7 @@ bootstrap implementation sent to every new slave context.
|
|
|
|
import binascii
|
|
|
|
import binascii
|
|
|
|
import collections
|
|
|
|
import collections
|
|
|
|
import encodings.latin_1
|
|
|
|
import encodings.latin_1
|
|
|
|
|
|
|
|
import encodings.utf_8
|
|
|
|
import errno
|
|
|
|
import errno
|
|
|
|
import fcntl
|
|
|
|
import fcntl
|
|
|
|
import itertools
|
|
|
|
import itertools
|
|
|
@ -102,10 +103,9 @@ LOG = logging.getLogger('mitogen')
|
|
|
|
IOLOG = logging.getLogger('mitogen.io')
|
|
|
|
IOLOG = logging.getLogger('mitogen.io')
|
|
|
|
IOLOG.setLevel(logging.INFO)
|
|
|
|
IOLOG.setLevel(logging.INFO)
|
|
|
|
|
|
|
|
|
|
|
|
LATIN1_CODEC = encodings.latin_1.Codec()
|
|
|
|
|
|
|
|
# str.encode() may take import lock. Deadlock possible if broker calls
|
|
|
|
# str.encode() may take import lock. Deadlock possible if broker calls
|
|
|
|
# .encode() on behalf of thread currently waiting for module.
|
|
|
|
# .encode() on behalf of thread currently waiting for module.
|
|
|
|
UTF8_CODEC = encodings.latin_1.Codec()
|
|
|
|
LATIN1_CODEC = encodings.latin_1.Codec()
|
|
|
|
|
|
|
|
|
|
|
|
_v = False
|
|
|
|
_v = False
|
|
|
|
_vv = False
|
|
|
|
_vv = False
|
|
|
@ -288,7 +288,7 @@ class Kwargs(dict):
|
|
|
|
def __init__(self, dct):
|
|
|
|
def __init__(self, dct):
|
|
|
|
for k, v in dct.iteritems():
|
|
|
|
for k, v in dct.iteritems():
|
|
|
|
if type(k) is unicode:
|
|
|
|
if type(k) is unicode:
|
|
|
|
k, _ = UTF8_CODEC.encode(k)
|
|
|
|
k, _ = encodings.utf_8.encode(k)
|
|
|
|
self[k] = v
|
|
|
|
self[k] = v
|
|
|
|
|
|
|
|
|
|
|
|
def __repr__(self):
|
|
|
|
def __repr__(self):
|
|
|
@ -782,7 +782,7 @@ class Message(object):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
Syntax helper to construct a dead message.
|
|
|
|
Syntax helper to construct a dead message.
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
kwargs['data'], _ = UTF8_CODEC.encode(reason or u'')
|
|
|
|
kwargs['data'], _ = encodings.utf_8.encode(reason or u'')
|
|
|
|
return cls(reply_to=IS_DEAD, **kwargs)
|
|
|
|
return cls(reply_to=IS_DEAD, **kwargs)
|
|
|
|
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
@classmethod
|
|
|
@ -1381,7 +1381,7 @@ class Importer(object):
|
|
|
|
|
|
|
|
|
|
|
|
if mod.__package__ and not PY3:
|
|
|
|
if mod.__package__ and not PY3:
|
|
|
|
# 2.x requires __package__ to be exactly a string.
|
|
|
|
# 2.x requires __package__ to be exactly a string.
|
|
|
|
mod.__package__, _ = UTF8_CODEC.encode(mod.__package__)
|
|
|
|
mod.__package__, _ = encodings.utf_8.encode(mod.__package__)
|
|
|
|
|
|
|
|
|
|
|
|
source = self.get_source(fullname)
|
|
|
|
source = self.get_source(fullname)
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|