X Tutup
Skip to content

Commit 471108f

Browse files
committed
Python 3 compatibility fixes - there is no dict.has_key() method.
1 parent c6178b4 commit 471108f

File tree

6 files changed

+9
-9
lines changed

6 files changed

+9
-9
lines changed

cefpython/browser.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ cdef dict g_pyBrowsers = {}
2121
IF CEF_VERSION == 3:
2222
# Unused function warning in CEF 1.
2323
cdef PyBrowser GetPyBrowserById(int browserId):
24-
if g_pyBrowsers.has_key(browserId):
24+
if browserId in g_pyBrowsers:
2525
return g_pyBrowsers[browserId]
2626
return None
2727

@@ -87,7 +87,7 @@ IF CEF_VERSION == 3:
8787
# Called from LifespanHandler_OnBeforeClose().
8888
# TODO: call this function also in CEF 1.
8989
global g_pyBrowsers
90-
if g_pyBrowsers.has_key(browserId):
90+
if browserId in g_pyBrowsers:
9191
Debug("del g_pyBrowsers[%s]" % browserId)
9292
del g_pyBrowsers[browserId]
9393
else:

cefpython/cef1/windows/binaries/panda3d_.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,10 +247,10 @@ def onKeystroke(self, key):
247247
self.keyInfo(ord(key)), 0)
248248

249249
def onButtonDownOrUp(self, keyType, key):
250-
if self.modifierKeys.has_key(key):
250+
if key in self.modifierKeys:
251251
self.keyModifiers |= self.modifierKeys[key]
252252
else:
253-
if self.translateKeys.has_key(key):
253+
if key in self.translateKeys:
254254
self.browser.SendKeyEvent(keyType,
255255
self.keyInfo(self.translateKeys[key]),
256256
self.keyModifiers)

cefpython/cefpython.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ cpdef py_void SetGlobalClientCallback(py_string name, object callback):
307307

308308
cpdef object GetGlobalClientCallback(py_string name):
309309
global g_globalClientCallbacks
310-
if g_globalClientCallbacks.has_key(name):
310+
if name in g_globalClientCallbacks:
311311
return g_globalClientCallbacks[name]
312312
else:
313313
return None

cefpython/frame.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ cdef dict g_pyFrames = {}
77
IF CEF_VERSION == 3:
88
# Unused function warning in CEF 1.
99
cdef PyFrame GetPyFrameById(object frameId):
10-
if g_pyFrames.has_key(frameId):
10+
if frameId in g_pyFrames:
1111
return g_pyFrames[frameId]
1212
return None
1313

@@ -45,7 +45,7 @@ IF CEF_VERSION == 3:
4545
# Called from V8ContextHandler_OnContextReleased().
4646
# TODO: call this function also in CEF 1.
4747
global g_pyFrames
48-
if g_pyFrames.has_key(frameId):
48+
if frameId in g_pyFrames:
4949
Debug("del g_pyFrames[%s]" % frameId)
5050
del g_pyFrames[frameId]
5151
else:

cefpython/process_message_utils.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ cdef object CheckForCefPythonMessageHash(CefRefPtr[CefBrowser] cefBrowser,
1919
if pyString.startswith(cefPythonMessageHash):
2020
jsonData = pyString[len(cefPythonMessageHash):]
2121
message = json.loads(jsonData)
22-
if message and type(message) == dict and message.has_key("what") \
22+
if message and type(message) == dict and ("what" in message) \
2323
and message["what"] == "javascript-callback":
2424
jsCallback = CreateJavascriptCallback(
2525
message["callbackId"], cefBrowser,

cefpython/python_callback_cef3.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ cdef public cpp_bool ExecutePythonCallback(
7373
cdef object returnValue
7474
try:
7575
global g_pythonCallbacks
76-
if g_pythonCallbacks.has_key(callbackId):
76+
if callbackId in g_pythonCallbacks:
7777
# [0] browserId, [1] frameId, [2] function.
7878
function = g_pythonCallbacks[callbackId][2]
7979
functionArguments = CefListValueToPyList(

0 commit comments

Comments
 (0)
X Tutup