c-api

Creation of PyTuple in C++ module crashes

Having some trouble with this code. Trying to return a tuple of tuples (coordinates) from a C++ module Im writing. It looks right to me, the dirty list contains two Coords so len is 2, the x and y values of the items in the list are 0,0 and 0,1 respectively. First time Im attempting this so I might very well have misunderstood the docs o...

How does one produce a specific unicode character with Python's C-API?

I'm writing a Python extension that runs through a Py_UNICODE array, finds specific (ASCII, if it matters) characters, i.e. '\' or '\n', and does some additional stuff for each one that it finds. Is there a way to write those characters as literals? If not, what is the correct way to obtain Py_UNICODEs for them, keeping in mind that Py...