Author: Maciej Fijalkowski <[email protected]>
Branch: 
Changeset: r77511:fd4077ca6ba7
Date: 2015-05-24 09:21 +0200
http://bitbucket.org/pypy/pypy/changeset/fd4077ca6ba7/

Log:    hard to test case of error

diff --git a/pypy/module/_vmprof/interp_vmprof.py 
b/pypy/module/_vmprof/interp_vmprof.py
--- a/pypy/module/_vmprof/interp_vmprof.py
+++ b/pypy/module/_vmprof/interp_vmprof.py
@@ -30,12 +30,12 @@
     libraries = ['dl'],
     
     post_include_bits=["""
-        void pypy_vmprof_init(void);
+        int pypy_vmprof_init(void);
     """],
     
     separate_module_sources=["""
-        void pypy_vmprof_init(void) {
-            vmprof_set_mainloop(pypy_execute_frame_trampoline, 0,
+        int pypy_vmprof_init(void) {
+            return vmprof_set_mainloop(pypy_execute_frame_trampoline, 0,
                                 NULL);
         }
     """],
@@ -63,7 +63,7 @@
     _nowrapper=True, sandboxsafe=True,
     random_effects_on_gcobjs=True)
 
-pypy_vmprof_init = rffi.llexternal("pypy_vmprof_init", [], lltype.Void,
+pypy_vmprof_init = rffi.llexternal("pypy_vmprof_init", [], rffi.INT,
                                    compilation_info=eci)
 vmprof_enable = rffi.llexternal("vmprof_enable",
                                 [rffi.INT, rffi.LONG, rffi.INT,
@@ -145,7 +145,11 @@
         self.write_header(fileno, period_usec)
         if not self.ever_enabled:
             if we_are_translated():
-                pypy_vmprof_init()
+                res = pypy_vmprof_init()
+                if not res:
+                    raise OperationError(
+                        space.w_IOError,
+                        space.wrap(rffi.charp2str(vmprof_get_error())))
             self.ever_enabled = True
         self.gather_all_code_objs(space)
         space.register_code_callback(vmprof_register_code)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to