pcp
[Top] [All Lists]

[Bug 1284417] Python PMAPI pmSetMode does not allow None timeval

To: pcp@xxxxxxxxxxx
Subject: [Bug 1284417] Python PMAPI pmSetMode does not allow None timeval
From: bugzilla@xxxxxxxxxx
Date: Tue, 24 Nov 2015 00:35:51 +0000
Auto-submitted: auto-generated
Delivered-to: pcp@xxxxxxxxxxx
In-reply-to: <bug-1284417-355098@xxxxxxxxxxxxxxxxxxx>
References: <bug-1284417-355098@xxxxxxxxxxxxxxxxxxx>
https://bugzilla.redhat.com/show_bug.cgi?id=1284417



--- Comment #1 from Nathan Scott <nathans@xxxxxxxxxx> ---
If I'm reading the ctypes docs correctly, the patch below should work ... could
you try it out Marko, if you have a use-case for this already?

cheers.


diff --git a/src/python/pcp/pmapi.py b/src/python/pcp/pmapi.py
index f9805a7..b3f126b 100644
--- a/src/python/pcp/pmapi.py
+++ b/src/python/pcp/pmapi.py
@@ -1551,7 +1551,10 @@ class pmContext(object):
         status = LIBPCP.pmUseContext(self.ctx)
         if status < 0:
             raise pmErr(status)
-        status = LIBPCP.pmSetMode(mode, pointer(timeVal), delta)
+        when = None
+        if timeVal != None:
+            when = pointer(timeVal)
+        status = LIBPCP.pmSetMode(mode, when, delta)
         if status < 0:
             raise pmErr(status)
         return status

-- 
You are receiving this mail because:
You are on the CC list for the bug.
Unsubscribe from this bug 
https://bugzilla.redhat.com/token.cgi?t=pELkc0recp&a=cc_unsubscribe

<Prev in Thread] Current Thread [Next in Thread>