chiark / gitweb /
Do not execute a statement without catching the return value in global namespace
authorYouness Alaoui <kakaroto@kakaroto.homelinux.net>
Wed, 21 Oct 2015 18:26:33 +0000 (14:26 -0400)
committerYouness Alaoui <kakaroto@kakaroto.homelinux.net>
Wed, 21 Oct 2015 18:55:39 +0000 (14:55 -0400)
The issue is that any statement without a variable to catch the
returned value will cause that value to be stored in the _ variable
and when that happens in the global namespace, it will cause issues
such as the gettext _ variable being overwritten

Cura/gui/printWindow.py
Cura/gui/util/openglHelpers.py
Cura/gui/util/taskbar.py

index fe5f48930e02b43daf268dab8fe14f02e9a693e5..b21b79e149472f2e26bf114c32f29e23e178b85a 100644 (file)
@@ -37,8 +37,8 @@ elif sys.platform.startswith('darwin'):
        frameworkIdentifier="com.apple.iokit",
        frameworkPath=objc.pathForFramework("/System/Library/Frameworks/IOKit.framework"),
        globals=globals())
-       objc.loadBundleFunctions(bundle, globals(), [("IOPMAssertionCreateWithName", b"i@I@o^I")])
-       objc.loadBundleFunctions(bundle, globals(), [("IOPMAssertionRelease", b"iI")])
+       foo = objc.loadBundleFunctions(bundle, globals(), [("IOPMAssertionCreateWithName", b"i@I@o^I")])
+       foo = objc.loadBundleFunctions(bundle, globals(), [("IOPMAssertionRelease", b"iI")])
        def preventComputerFromSleeping(frame, prevent):
                if prevent:
                        success, preventComputerFromSleeping.assertionID = IOPMAssertionCreateWithName(kIOPMAssertionTypeNoDisplaySleep, kIOPMAssertionLevelOn, "Cura is printing", None)
index 0c1e9cb6ce723252cefa4657b5ca04a15c3da88d..3880c3644fe0920b3bdce68da4a56aa29fa41138 100644 (file)
@@ -14,7 +14,8 @@ from OpenGL.GLUT import *
 from OpenGL.GLU import *
 from OpenGL.GL import *
 from OpenGL.GL import shaders
-glutInit() #Hack; required before glut can be called. Not required for all OS.
+
+foo = glutInit() #Hack; required before glut can be called. Not required for all OS.
 
 class GLReferenceCounter(object):
        def __init__(self):
index e78fc0f22911e96790a0da7e137594d80e2951cc..a59f73dd87aa0aea45ac92664fcb3ac88c792998 100644 (file)
@@ -5,11 +5,11 @@ __copyright__ = "Copyright (C) 2013 David Braam - Released under terms of the AG
 
 try:
        import comtypes.client as cc
-       cc.GetModule('taskbarlib.tlb')
+       foo = cc.GetModule('taskbarlib.tlb')
        import comtypes.gen.TaskbarLib as tbl
 
        ITaskbarList3 = cc.CreateObject("{56FDF344-FD6D-11d0-958A-006097C9A090}", interface=tbl.ITaskbarList3)
-       ITaskbarList3.HrInit()
+       foo = ITaskbarList3.HrInit()
 
        #Stops displaying progress and returns the button to its normal state. Call this method with this flag to dismiss the progress bar when the operation is complete or canceled.
        TBPF_NOPROGRESS = 0x00000000