What's the public API alternative to _PyObject_GC_IS_TRACKED()?
Marco Sulla
Marco.Sulla.Python at gmail.com
Wed Dec 29 07:45:12 EST 2021
On Wed, 29 Dec 2021 at 12:11, Dieter Maurer <dieter at handshake.de> wrote:
>
> Marco Sulla wrote at 2021-12-29 11:59 +0100:
> >On Wed, 29 Dec 2021 at 09:12, Dieter Maurer <dieter at handshake.de> wrote:
> >> `MutableMapping` is a so called abstract base class (--> `abc`).
> >>
> >> It uses the `__subclass_check__` (and `__instance_check__`) of
> >> `abc.ABCMeta` to ensure `issubclass(dict, MutableMapping)`.
> >> Those can be customized by overriding `MutableMapping.__subclasshook__`
> >> to ensure that your `frozendict` class (and their subclasses)
> >> are not considered subclasses of `MutableMapping`.
> >
> >It does not work:
> > ...
> >>>> issubclass(fd, Mm)
> >True
>
> There is a cache involved. The `issubclass` above,
> brings your `fd` in the `Mn`'s subclass cache.
It works, thank you! I had to put it before
Mapping.register(frozendict)
More information about the Python-list
mailing list