community.general/lib/ansible/plugins
Bruno Rocha b06fb2022c Fix unbound method call for JSONEncoder (#17970)
* Fix unbound method call for JSONEncoder

The way it is currently it will lead to unbound method error

```python
In [1]: import json

In [2]: json.JSONEncoder.default('object_here')
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-2-872fdacfda50> in <module>()
----> 1 json.JSONEncoder.default('object_here')

TypeError: unbound method default() must be called with JSONEncoder instance as first argument (got str instance instead)

```

But what is really wanted is to let the json module to raise the "is not serializable error" which demands a bounded instance of `JSONEncoder()`

```python
In [3]: json.JSONEncoder().default('object_here')
---------------------------------------------------------------------------
TypeError: 'object_here' is not JSON serializable 

```


BTW: I think it would try to call `.to_json` of object before raising as it is a common pattern.

* Calling JSONEncoder bounded `default` method using super()
2016-10-11 08:31:53 -07:00
..
action fixed storing of cwd 2016-10-04 14:24:45 -04:00
cache Fix error using jsonfile with incomplete config (#17567) 2016-09-16 15:08:02 -04:00
callback Add foreman callback plugin (#17141) 2016-10-03 00:12:12 -04:00
connection On python3, subprocess needs another arg to pass extra file descriptors 2016-10-02 15:29:54 -07:00
filter Fix unbound method call for JSONEncoder (#17970) 2016-10-11 08:31:53 -07:00
lookup no need for warnings in first_found 2016-10-03 20:23:33 -04:00
shell Move uses of to_bytes, to_text, to_native to use the module_utils version (#17423) 2016-09-06 22:54:17 -07:00
strategy Make interprocess polling interval configurable (#16560) 2016-10-06 14:30:20 -05:00
test J2 test docs (#16646) 2016-07-12 10:13:00 -04:00
vars Making the switch to v2 2015-05-03 21:47:26 -05:00
__init__.py Revert "Clear the plugin path cache when adding new directories" (#17785) 2016-09-27 16:17:35 -07:00