Py_IS_TYPE(op, &PyDict_Type) does not work on MacOS

Barry barry at barrys-emacs.org
Mon Nov 8 13:30:43 EST 2021



> On 8 Nov 2021, at 07:45, Marco Sulla <Marco.Sulla.Python at gmail.com> wrote:
> 
> As you can read here:
> 
> https://github.com/Marco-Sulla/python-frozendict/issues/37
> 
> Py_IS_TYPE(op, &PyDict_Type) did not work on MacOS. I had to use PyDict_Check.
> 
> Why don't I have this problem with Linux?
> 
> PS: since I'm creating a modified version of dict, I copied the dict
> internal source and I link against them. Maybe the problem is
> correlated.

You can see what I did for PyCXX at https://sourceforge.net/p/cxx/code/HEAD/tree/trunk/CXX/Src/IndirectPythonInterface.cxx

See the _DictCheck and ends up using PyObject_IsInstance.

My guess is that use PyDict_Check is a good and better for the future.

Barry

> -- 
> https://mail.python.org/mailman/listinfo/python-list
> 


More information about the Python-list mailing list