Skip to content

Importing glom on Python3.12 fails #336

@joerick

Description

@joerick

Didn't happen when I was using cProfile. Here is the stacktrace:
glom version 23.5.0
pyinstrument version 4.6.2
python version 3.12.2
TypeError Traceback (most recent call last)
File Untitled-1:5
3 p = pyinstrument.Profiler()
4 p.start()
----> 5 import glom
6 p.stop()

File venv/lib/python3.12/site-packages/glom/init.py:48
34 from glom.reduction import Sum, Fold, Flatten, flatten, FoldError, Merge, merge
35 from glom.matching import (M,
36 Or,
37 And,
(...)
46 Check,
47 CheckError)
---> 48 from glom.mutation import Assign, Delete, assign, delete, PathDeleteError
50 # there's no -ion word that really fits what "streaming" means.
51 # generation, production, iteration, all have more relevant meanings
52 # elsewhere. (maybe procrastination :P)
53 from glom.streaming import Iter

File .venv/lib/python3.12/site-packages/glom/mutation.py:209
204 return glom(obj, Assign(path, val, missing=missing))
207 _ALL_BUILTIN_TYPES = [v for v in builtins.values() if isinstance(v, type)]
208 _BUILTIN_BASE_TYPES = [v for v in _ALL_BUILTIN_TYPES
--> 209 if not issubclass(v, tuple([t for t in _ALL_BUILTIN_TYPES
210 if t not in (v, type, object)]))]
211 _UNASSIGNABLE_BASE_TYPES = tuple(set(_BUILTIN_BASE_TYPES)
212 - set([dict, list, BaseException, object, type]))
215 def _set_sequence_item(target, idx, val):

TypeError: issubclass() arg 2 must be a class, a tuple of classes, or a union

Originally posted by @AvivSamet-Silk in #288 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions