[pypy-commit] pypy unicode-dtype: hg merge default

rlamy noreply at buildbot.pypy.org
Thu Jun 11 18:35:29 CEST 2015


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: unicode-dtype
Changeset: r78032:5b192b71776d
Date: 2015-06-11 17:35 +0100
http://bitbucket.org/pypy/pypy/changeset/5b192b71776d/

Log:	hg merge default

diff --git a/pypy/module/_cffi_backend/lib_obj.py b/pypy/module/_cffi_backend/lib_obj.py
--- a/pypy/module/_cffi_backend/lib_obj.py
+++ b/pypy/module/_cffi_backend/lib_obj.py
@@ -65,7 +65,7 @@
         ptr = rffi.cast(rffi.CCHARP, g.c_address)
         assert ptr
         return W_FunctionWrapper(self.space, ptr, g.c_size_or_direct_fn, w_ct,
-                                 locs, rawfunctype, fnname)
+                                 locs, rawfunctype, fnname, self.libname)
 
     @jit.elidable_promote()
     def _get_attr_elidable(self, attr):
diff --git a/pypy/module/_cffi_backend/test/test_recompiler.py b/pypy/module/_cffi_backend/test/test_recompiler.py
--- a/pypy/module/_cffi_backend/test/test_recompiler.py
+++ b/pypy/module/_cffi_backend/test/test_recompiler.py
@@ -418,6 +418,11 @@
         # 'x' is another <built-in method> object on lib, made very indirectly
         x = type(lib).__dir__.__get__(lib)
         raises(TypeError, ffi.typeof, x)
+        #
+        # present on built-in functions on CPython; must be emulated on PyPy:
+        assert lib.sin.__name__ == 'sin'
+        assert lib.sin.__module__ == '_CFFI_test_math_sin_type'
+        assert lib.sin.__doc__=='direct call to the C function of the same name'
 
     def test_verify_anonymous_struct_with_typedef(self):
         ffi, lib = self.prepare(
diff --git a/pypy/module/_cffi_backend/wrapper.py b/pypy/module/_cffi_backend/wrapper.py
--- a/pypy/module/_cffi_backend/wrapper.py
+++ b/pypy/module/_cffi_backend/wrapper.py
@@ -1,6 +1,6 @@
 from pypy.interpreter.error import oefmt
 from pypy.interpreter.baseobjspace import W_Root
-from pypy.interpreter.typedef import TypeDef
+from pypy.interpreter.typedef import TypeDef, interp_attrproperty
 from pypy.interpreter.gateway import interp2app
 from rpython.rlib import jit
 
@@ -21,9 +21,10 @@
     also returns the original struct/union signature.
     """
     _immutable_ = True
+    common_doc_str = 'direct call to the C function of the same name'
 
     def __init__(self, space, fnptr, directfnptr, ctype,
-                 locs, rawfunctype, fnname):
+                 locs, rawfunctype, fnname, modulename):
         assert isinstance(ctype, W_CTypeFunc)
         assert ctype.cif_descr is not None     # not for '...' functions
         assert locs is None or len(ctype.fargs) == len(locs)
@@ -35,6 +36,7 @@
         self.locs = locs
         self.rawfunctype = rawfunctype
         self.fnname = fnname
+        self.modulename = modulename
         self.nargs_expected = len(ctype.fargs) - (locs is not None and
                                                   locs[0] == 'R')
 
@@ -111,5 +113,8 @@
         'FFIFunctionWrapper',
         __repr__ = interp2app(W_FunctionWrapper.descr_repr),
         __call__ = interp2app(W_FunctionWrapper.descr_call),
+        __name__ = interp_attrproperty('fnname', cls=W_FunctionWrapper),
+        __module__ = interp_attrproperty('modulename', cls=W_FunctionWrapper),
+        __doc__ = interp_attrproperty('common_doc_str', cls=W_FunctionWrapper),
         )
 W_FunctionWrapper.typedef.acceptable_as_base_class = False
diff --git a/rpython/translator/c/genc.py b/rpython/translator/c/genc.py
--- a/rpython/translator/c/genc.py
+++ b/rpython/translator/c/genc.py
@@ -443,6 +443,11 @@
             mk.definition('OBJECTS1', '$(subst .asmgcc.s,.o,$(subst .c,.o,$(SOURCES)))')
             mk.definition('OBJECTS', '$(OBJECTS1) gcmaptable.s')
 
+            # the CFLAGS passed to gcc when invoked to assembler the .s file
+            # must not contain -g.  This confuses gcc 5.1.  (Note that it
+            # would seem that gcc 5.1 with "-g" does not produce debugging
+            # info in a format that gdb 4.7.1 can read.)
+            mk.definition('CFLAGS_AS', '$(patsubst -g,,$(CFLAGS))')
 
             # the rule that transforms %.c into %.o, by compiling it to
             # %.s, then applying trackgcroot to get %.lbl.s and %.gcmap, and
@@ -452,7 +457,7 @@
                     '-o $*.s -S $< $(INCLUDEDIRS)',
                 '$(PYTHON) $(RPYDIR)/translator/c/gcc/trackgcroot.py '
                     '-t $*.s > $*.gctmp',
-                '$(CC) $(CFLAGS) -o $*.o -c $*.lbl.s',
+                '$(CC) $(CFLAGS_AS) -o $*.o -c $*.lbl.s',
                 'mv $*.gctmp $*.gcmap',
                 'rm $*.s $*.lbl.s'])
 


More information about the pypy-commit mailing list