Skip to content

Commit 023092c

Browse files
Avoid raising an exception if an error message is not correctly UTF-8
encoded.
1 parent a95def8 commit 023092c

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

doc/src/release_notes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ Thick Mode Changes
3737

3838
#) Eliminated memory leak when dequeing messages with JSON payloads
3939
(`issue 346 <https://github.com/oracle/python-oracledb/issues/346>`__).
40+
#) An exception is now avoided if an error message is not correctly UTF-8
41+
encoded by the database.
4042

4143
Common Changes
4244
++++++++++++++

src/oracledb/impl/thick/utils.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -432,8 +432,8 @@ cdef object _create_new_from_info(dpiErrorInfo *error_info):
432432
"""
433433
cdef bytes msg_bytes = error_info.message[:error_info.messageLength]
434434
context = "%s: %s" % (error_info.fnName, error_info.action)
435-
return errors._Error(msg_bytes.decode(), context, code=error_info.code,
436-
offset=error_info.offset,
435+
return errors._Error(msg_bytes.decode("utf-8", "replace"), context,
436+
code=error_info.code, offset=error_info.offset,
437437
isrecoverable=error_info.isRecoverable,
438438
iswarning=error_info.isWarning)
439439

0 commit comments

Comments
 (0)