Hi Barry, On Tue, 2 Oct 2018 at 21:09, Barry Scott <ba...@barrys-emacs.org> wrote: > Using PyPy 0.6.0 on macOS I managed to build a .so that crashed when imported.
I will assume that you mean PyPy2 6.0.0, and not PyPy3 nor the version 0.6.0. > The reason is that the PyPy's C API does not allow tuples to be created. You cannot change tuple objects after they "escaped" to become general PyPy objects. You can only call PyTuple_SetItem() on a tuple object that exists as a "PyObject *" but not yet as a PyPy object. That means, mostly, you should only call PyTuple_SetItem() on the fresh result of PyTuple_New() before the "PyObject *" is sent somewhere else. In your example code, maybe the set() function makes the tuple object escape in this way. Note that escaping tuples before they are fully initialized can also sometimes create potential crashes on CPython. > if (PyMapping_DelItemString (ptr(), > const_cast<char*>(s.c_str())) == -1) > if (PyMapping_DelItem (ptr(), *s) == -1) I don't know how it ever worked, because PyMapping_DelItem and PyMapping_DelItemString are not implemented, neither right now nor at the time of release 6.0.0. If you are using these two functions, please open an issue (https://bitbucket.org/pypy/pypy/issues?status=new&status=open) and we'll implement them. A bientôt, Armin. _______________________________________________ pypy-dev mailing list pypy-dev@python.org https://mail.python.org/mailman/listinfo/pypy-dev