picop.cyfrozendict#

Fast frozendict helpers (CPython 3.15+).

picop.cyfrozendict.anydict_check(obj)#

Return True if obj is a dict or a frozendict (subtypes included).

Notes

mirrors PyAnyDict_Check; on 3.14 this is dict_check.

Parameters:

obj (object)

Return type:

bool

picop.cyfrozendict.anydict_check_exact(obj)#

Return True if obj is exactly a dict or exactly a frozendict.

Notes

dict subclasses such as defaultdict are False.

Parameters:

obj (object)

Return type:

bool

picop.cyfrozendict.anydict_len(obj)#

Return the entry count of a dict or frozendict.

Notes

raises TypeError for anything else; the read uses the PyDict_GET_SIZE layout shared by dict and frozendict.

Parameters:

obj (object)

Return type:

int

picop.cyfrozendict.frozendict_check(obj)#

Return True if obj is a frozendict or a frozendict subtype.

Parameters:

obj (object)

Return type:

bool

picop.cyfrozendict.frozendict_check_exact(obj)#

Return True if obj is exactly a frozendict (subtypes excluded).

Parameters:

obj (object)

Return type:

bool

picop.cyfrozendict.frozendict_empty()#

Return an empty frozendict without building an iterable.

Notes

raises NotImplementedError on 3.14.

Return type:

object

picop.cyfrozendict.frozendict_new(iterable)#

Return a new frozendict built from an iterable.

Notes

None is not iterable — use frozendict_empty() for the no-iterable path. Passing an existing frozendict returns the same object with an incremented reference, not a copy. Raises NotImplementedError on 3.14.

Parameters:

iterable (object)

Return type:

object