This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: test_ctypes failure on AIX in PyEval_CallObjectWithKeywords
Type: crash Stage:
Components: Interpreter Core Versions: Python 3.5
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: David.Edelsohn, python-dev, vstinner
Priority: normal Keywords:

Created on 2013-07-31 21:24 by David.Edelsohn, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (5)
msg194024 - (view) Author: David Edelsohn (David.Edelsohn) * Date: 2013-07-31 21:24
test_ctypes now crashes on AIX after the ceval change to PyEval_CallObjectWithKeywords to check PyErr_Occurred().

#5  0x100ff0c8 in PyEval_CallObjectWithKeywords (func=0x300a4c3c,
    arg=0x3062bb24, kw=0x0) at Python/ceval.c:4066
#6  0x10166bfc in PyCodec_Decode (object=0x305d5834,
    encoding=0x200a0b80 "iso8859-1",
    errors=0x102dd0b4 <PyOS_mystricmp+13668> "surrogateescape")
    at Python/codecs.c:403
#7  0x1006d500 in PyUnicode_Decode (
    s=0xdb1c8234 <_GLOBAL__FD__ctypes_so+8356> "_ctypes/callbacks.c", size=19,
    encoding=0x200a0b80 "iso8859-1",
    errors=0x102dd0b4 <PyOS_mystricmp+13668> "surrogateescape")
    at Objects/unicodeobject.c:3045
#8  0x1006f208 in PyUnicode_DecodeFSDefaultAndSize (
    s=0xdb1c8234 <_GLOBAL__FD__ctypes_so+8356> "_ctypes/callbacks.c", size=19)
    at Objects/unicodeobject.c:3640
#9  0x1006f150 in PyUnicode_DecodeFSDefault (
    s=0xdb1c8234 <_GLOBAL__FD__ctypes_so+8356> "_ctypes/callbacks.c")
    at Objects/unicodeobject.c:3618
#10 0x1017b870 in PyCode_NewEmpty (
    filename=0xdb1c8234 <_GLOBAL__FD__ctypes_so+8356> "_ctypes/callbacks.c",
    funcname=0xdb1c8218 <_GLOBAL__FD__ctypes_so+8328> "'calling
callback function'", firstlineno=260) at Objects/codeobject.c:174
#11 0xdb1c3960 in _ctypes_add_traceback (
    funcname=0xdb1c8218 <_GLOBAL__FD__ctypes_so+8328> "'calling
callback function'", filename=0xdb1c8234 <_GLOBAL__FD__ctypes_so+8356>
    lineno=260) at /home/dje/src/cpython/Modules/_ctypes/callbacks.c:104
#12 0xdb1c4204 in _CallPythonObject (mem=0x2ff144d8, restype=0x303a1ddc,
    setfunc=@0x20365824: 0xdb1bbfd4 <l_set>, callable=0x3055b454,
    converters=0x30628e6c, flags=257, pArgs=0x2ff14444)
    at /home/dje/src/cpython/Modules/_ctypes/callbacks.c:261
#13 0xdb1c4690 in closure_fcn (cif=0x30528de8, resp=0x2ff144d8,
    args=0x2ff14440, userdata=0x30528dcc)
    at /home/dje/src/cpython/Modules/_ctypes/callbacks.c:322
#14 0xdb1c2a90 in ffi_closure_helper_DARWIN (closure=0x20367008,
    rvalue=0x2ff144d8, pgr=0x2ff14570, pfr=0x2ff144f0)
    at /home/dje/src/cpython/Modules/_ctypes/libffi/src/powerpc/ffi_darwin.c:1355
#15 0xdb1c2c80 in ffi_closure_ASM ()
   from /home/dje/src/cpython/build/lib.aix-7.1-3.4-pydebug/
#16 0xdb1c2ba0 in ffi_call_AIX ()
   from /home/dje/src/cpython/build/lib.aix-7.1-3.4-pydebug/
#17 0xdb1c231c in ffi_call (cif=0x2ff146b8, fn=0x20367008, rvalue=0x2ff14770,
    at /home/dje/src/cpython/Modules/_ctypes/libffi/src/powerpc/ffi_darwin.c:936
#18 0xdb1a3a68 in _call_function_pointer (flags=4353, pProc=0x20367008,
    avalues=0x2ff14750, atypes=0x2ff14730, restype=0x303a1ddc,
    resmem=0x2ff14770, argcount=1)
    at /home/dje/src/cpython/Modules/_ctypes/callproc.c:811
#19 0xdb1a47c4 in _ctypes_callproc (pProc=0x20367008, argtuple=0x3062be6c,
    flags=4353, argtypes=0x3062b99c, restype=0x304735a4, checker=0x0)
    at /home/dje/src/cpython/Modules/_ctypes/callproc.c:1152
#20 0xdb19da70 in PyCFuncPtr_call (self=0x3061e9c4, inargs=0x3062be6c,
    kwds=0x3062bd1c) at /home/dje/src/cpython/Modules/_ctypes/_ctypes.c:3820
#21 0x1010b85c in PyObject_Call (func=0x3061e9c4, arg=0x3062be6c,
    kw=0x3062bd1c) at Objects/abstract.c:2105
#22 0x10101778 in ext_do_call (func=0x3061e9c4, pp_stack=0x2ff15154, flags=3,
    na=0, nk=0) at Python/ceval.c:4537
#23 0x100f8464 in PyEval_EvalFrameEx (f=0x305e5bcc, throwflag=0)
    at Python/ceval.c:2858
#24 0x100fca84 in PyEval_EvalCodeEx (_co=0x3055a980, globals=0x30554d1c,
    locals=0x0, args=0x3062c300, argcount=3, kws=0x3062c30c, kwcount=0,
    defs=0x0, defcount=0, kwdefs=0x0, closure=0x0) at Python/ceval.c:3567
#25 0x101004d4 in fast_function (func=0x3055b514, pp_stack=0x2ff15bb0, n=3,
    na=3, nk=0) at Python/ceval.c:4320
msg194130 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-08-01 22:49
New changeset de1ea7f84e08 by Victor Stinner in branch 'default':
Issue #18609, #18408: _ctypes_add_traceback() now clears the current exception
msg194132 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2013-08-01 22:56
This issue is not a bug, but a new assertion added by myself for the issue #18408. The idea is to not call a Python function with an exception set, because the exception may be cleared or replaced (ex: hasattr() clears the current exception if an attribute is not found).

I didn't see this specific issue because AIX is using a special locale setting. Its locale encoding is an alias of the ISO-8859-1 which is not known by PyUnicode_Decode().

I'm waiting for the buildbot to see if my changeset fixed the issue. If it does, I will also add a fast-path for the "iso8859-1" alias of the ISO-8859-1 codec in PyUnicode_Decode(). So the AIX buildbot will also use the C implementation of the codec.
msg194185 - (view) Author: David Edelsohn (David.Edelsohn) * Date: 2013-08-02 16:27
Thanks. The patch seems to return the tests to the expected failures and Python does not crash.
msg201620 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-10-29 10:34
New changeset 31f9c1481cfa by Victor Stinner in branch 'default':
Issue #18609: Add a fast-path for "iso8859-1" encoding
Date User Action Args
2022-04-11 14:57:48adminsetgithub: 62809
2013-10-29 10:34:20python-devsetmessages: + msg201620
2013-08-13 23:14:06vstinnersetstatus: open -> closed
resolution: fixed
2013-08-02 16:27:12David.Edelsohnsetmessages: + msg194185
2013-08-01 22:56:38vstinnersetmessages: + msg194132
2013-08-01 22:49:44python-devsetnosy: + python-dev
messages: + msg194130
2013-07-31 21:25:02David.Edelsohnsetnosy: + vstinner
2013-07-31 21:24:37David.Edelsohncreate