Error printing variables while debugging Cython
Asked Answered
E

1

8

I'm trying to debug some Cython code with gdb that is wrapping C++ code to be called from Python. I followed the instructions in the documentation but I'm getting some errors while debugging that are unrelated to my code. Example:

(gdb) cy print some_variable
Python Exception <type 'exceptions.AttributeError'> 'PyDictObjectPtr' object has no attribute 'items':
Error occurred in Python: 'PyDictObjectPtr' object has no attribute 'items'

I'm also getting this one sometimes (usually after the first one):

Python Exception <class 'gdb.error'> There is no member named ob_sval.:
Error occurred in Python command: There is no member named ob_sval.

To debug the code I created an environment with Docker:

FROM debian

RUN apt-get update && apt-get upgrade -y && apt-get install -y \
  build-essential gdb-python2 python-dbg python-dev \
  python-pip python-numpy-dbg

RUN pip install cython pygments

CMD bash

I found two related posts in the cython-users google group but with no answer.

Eichelberger answered 4/10, 2018 at 21:58 Comment(0)
S
2

An issue was finally opened in Cython (thanks @hygorxaraujo!) and it was identified as a defect:

https://github.com/cython/cython/issues/2699

Pull requests welcome!

Stickseed answered 6/11, 2018 at 16:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.