pybind11
pybind11 copied to clipboard
[BUG]: `json.dumps` failed on object with new `_pybind11_conduit_v1` method
Required prerequisites
- [X] Make sure you've read the documentation. Your issue may be addressed there.
- [X] Search the issue tracker and Discussions to verify that this hasn't already been reported. +1 or comment there if it has.
- [ ] Consider asking first in the Gitter chat room or in a Discussion.
What version (or hash if on master) of pybind11 are you using?
2.13.6
Problem description
A new self._pybind11_conduit_v1_() method that is added to all classes by default breaks the serialization of this object through json.dumps([object with _pybind11_conduit_v1], default=vars). I would like to clarify whether this is by mistake or intentional, considering also that this is a patch release. Thanks!
The error:
File "/opt/hostedtoolcache/Python/3.9.20/x64/lib/python3.9/site-packages/triton/compiler/compiler.py", line 315, in compile
metadata_group[metadata_filename] = fn_cache_manager.put(json.dumps(metadata, default=vars), metadata_filename,
File "/opt/hostedtoolcache/Python/3.9.20/x64/lib/python3.9/json/__init__.py", line 234, in dumps
return cls(
File "/opt/hostedtoolcache/Python/3.9.20/x64/lib/python3.9/json/encoder.py", line 199, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/opt/hostedtoolcache/Python/3.9.20/x64/lib/python3.9/json/encoder.py", line 257, in iterencode
return _iterencode(o, 0)
TypeError: vars() argument must have __dict__ attribute
Reproducible example code
Since this should be a problem with any object, and I have no experience with `pybind`, I will leave it without a reproducer for now, but if it is not so easy to reproduce, I may try to make one.
Is this a regression? Put the last known working version here if it is.
2.13.5