Mailing List Archive

Py_IS_TYPE(op, &PyDict_Type) does not work on MacOS
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.
--
https://mail.python.org/mailman/listinfo/python-list
Re: Py_IS_TYPE(op, &PyDict_Type) does not work on MacOS [ In reply to ]
> On 8 Nov 2021, at 07:45, Marco Sulla <Marco.Sulla.Python@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
>
--
https://mail.python.org/mailman/listinfo/python-list
Re: Py_IS_TYPE(op, &PyDict_Type) does not work on MacOS [ In reply to ]
Indeed now I use PyDict_Check, but anyway it's very strange that
Py_IS_TYPE(op, &PyDict_Type) does not work only on MacOS.

On Mon, 8 Nov 2021 at 19:30, Barry <barry@barrys-emacs.org> wrote:
>
>
>
> On 8 Nov 2021, at 07:45, Marco Sulla <Marco.Sulla.Python@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
>
--
https://mail.python.org/mailman/listinfo/python-list