Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 042579d

Browse filesBrowse files
committed
Allow for automatic conversion of string like objects to CEF strings.
For example a QString passed to LoadUrl() method was causing error and now it's handled fine.
1 parent 30439b6 commit 042579d
Copy full SHA for 042579d

File tree

Expand file treeCollapse file tree

1 file changed

+6
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-0
lines changed
Open diff view settings
Collapse file

‎src/string_utils.pyx‎

Copy file name to clipboardExpand all lines: src/string_utils.pyx
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,17 @@ cdef void PyToCefString(
103103
CefString& cefString
104104
) except *:
105105
if PY_MAJOR_VERSION < 3:
106+
# Handle objects that may be converted to string e.g. QString
107+
if not isinstance(pyString, str) and not isinstance(pyString, unicode):
108+
pyString = str(pyString)
106109
if type(pyString) == unicode:
107110
pyString = <bytes>(pyString.encode(
108111
g_applicationSettings["string_encoding"],
109112
errors=UNICODE_ENCODE_ERRORS))
110113
else:
114+
# Handle objects that may be converted to string e.g. QString
115+
if not isinstance(pyString, str) and not isinstance(pyString, bytes):
116+
pyString = str(pyString)
111117
# The unicode type is not defined in Python 3.
112118
if type(pyString) == str:
113119
pyString = <bytes>(pyString.encode(

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.