Author: David Schneider <david.schnei...@picle.org> Branch: Changeset: r64721:d3b498962380 Date: 2013-06-02 15:23 -0500 http://bitbucket.org/pypy/pypy/changeset/d3b498962380/
Log: merge heads diff --git a/pypy/module/imp/importing.py b/pypy/module/imp/importing.py --- a/pypy/module/imp/importing.py +++ b/pypy/module/imp/importing.py @@ -303,7 +303,7 @@ return _absolute_import(space, modulename, baselevel, fromlist_w, tentative) finally: - lock.release_lock() + lock.release_lock(silent_after_fork=True) @jit.unroll_safe def absolute_import_try(space, modulename, baselevel, fromlist_w): @@ -788,10 +788,10 @@ self.lockowner = me self.lockcounter += 1 - def release_lock(self): + def release_lock(self, silent_after_fork): me = self.space.getexecutioncontext() # used as thread ident if self.lockowner is not me: - if self.lockowner is None: + if self.lockowner is None and silent_after_fork: # Too bad. This situation can occur if a fork() occurred # with the import lock held, and we're the child. return diff --git a/pypy/module/imp/interp_imp.py b/pypy/module/imp/interp_imp.py --- a/pypy/module/imp/interp_imp.py +++ b/pypy/module/imp/interp_imp.py @@ -177,7 +177,7 @@ def release_lock(space): if space.config.objspace.usemodules.thread: - importing.getimportlock(space).release_lock() + importing.getimportlock(space).release_lock(silent_after_fork=False) def reinit_lock(space): if space.config.objspace.usemodules.thread: diff --git a/pypy/objspace/std/formatting.py b/pypy/objspace/std/formatting.py --- a/pypy/objspace/std/formatting.py +++ b/pypy/objspace/std/formatting.py @@ -352,9 +352,8 @@ def std_wp(self, r): length = len(r) if do_unicode and isinstance(r, str): - # convert string to unicode explicitely here - from pypy.objspace.std.unicodetype import plain_str2unicode - r = plain_str2unicode(self.space, r) + # convert string to unicode using the default encoding + r = self.space.unicode_w(self.space.wrap(r)) prec = self.prec if prec == -1 and self.width == 0: # fast path @@ -509,12 +508,10 @@ result = formatter.format() except NeedUnicodeFormattingError: # fall through to the unicode case - from pypy.objspace.std.unicodetype import plain_str2unicode - fmt = plain_str2unicode(space, fmt) + pass else: return space.wrap(result) - else: - fmt = space.unicode_w(w_fmt) + fmt = space.unicode_w(w_fmt) formatter = UnicodeFormatter(space, fmt, values_w, w_valuedict) result = formatter.format() return space.wrap(result) diff --git a/pypy/objspace/std/test/test_stringobject.py b/pypy/objspace/std/test/test_stringobject.py --- a/pypy/objspace/std/test/test_stringobject.py +++ b/pypy/objspace/std/test/test_stringobject.py @@ -530,6 +530,12 @@ del sys.modules[module_name] temp_sys.setdefaultencoding('utf-8') assert u''.join(['\xc3\xa1']) == u'\xe1' + # + assert ('\xc3\xa1:%s' % u'\xe2') == u'\xe1:\xe2' + class Foo(object): + def __repr__(self): + return '\xc3\xa2' + assert u'\xe1:%r' % Foo() == u'\xe1:\xe2' finally: temp_sys.setdefaultencoding(old_encoding) sys.modules.update(self.original_modules) diff --git a/pypy/objspace/std/unicodetype.py b/pypy/objspace/std/unicodetype.py --- a/pypy/objspace/std/unicodetype.py +++ b/pypy/objspace/std/unicodetype.py @@ -13,22 +13,6 @@ from pypy.objspace.std.unicodeobject import W_UnicodeObject return W_UnicodeObject(uni) -def plain_str2unicode(space, s): - try: - return unicode(s) - except UnicodeDecodeError: - for i in range(len(s)): - if ord(s[i]) > 127: - raise OperationError( - space.w_UnicodeDecodeError, - space.newtuple([ - space.wrap('ascii'), - space.wrap(s), - space.wrap(i), - space.wrap(i+1), - space.wrap("ordinal not in range(128)")])) - assert False, "unreachable" - unicode_capitalize = SMM('capitalize', 1, doc='S.capitalize() -> unicode\n\nReturn a' diff --git a/rpython/jit/metainterp/test/test_fficall.py b/rpython/jit/metainterp/test/test_fficall.py --- a/rpython/jit/metainterp/test/test_fficall.py +++ b/rpython/jit/metainterp/test/test_fficall.py @@ -17,7 +17,7 @@ def get_description(atypes, rtype): p = lltype.malloc(CIF_DESCRIPTION, len(atypes), flavor='raw', immortal=True) - p.abi = 42 + p.abi = 1 # default p.nargs = len(atypes) p.rtype = rtype p.atypes = lltype.malloc(FFI_TYPE_PP.TO, len(atypes), diff --git a/rpython/translator/platform/openbsd.py b/rpython/translator/platform/openbsd.py --- a/rpython/translator/platform/openbsd.py +++ b/rpython/translator/platform/openbsd.py @@ -5,11 +5,7 @@ from rpython.translator.platform.bsd import BSD class OpenBSD(BSD): - if os.environ.get("CC") is None: - DEFAULT_CC = "cc" - else: - DEFAULT_CC = os.environ.get("CC") - + DEFAULT_CC = "cc" name = "openbsd" link_flags = os.environ.get("LDFLAGS", "").split() + ['-pthread'] _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit