Commit 3ddf9f5f authored by Thomas Goirand's avatar Thomas Goirand
Browse files

Merge tag '4.1.0' into debian/wallaby

oslo.serialization 4.1.0 release

meta:version: 4.1.0
meta:diff-start: -
meta:series: wallaby
meta:release-type: release
meta:pypi: yes
meta:first: yes
meta:release:Author: Daniel Bengtsson <dbengt@redhat.com>
meta:release:Commit: Daniel Bengtsson <dbengt@redhat.com>
meta:release:Change-Id: I712e9ad4b4b998b80ca71fe53fea1a6cbf328e3c
meta:release:Code-Review+2: Hervé Beraud <hberaud@redhat.com>
meta:release:Code-Review+2: Sean McGinnis <sean.mcginnis@gmail.com>
meta:release:Workflow+1: Sean McGinnis <sean.mcginnis@gmail.com>
parents 29c15362 8445e61e
......@@ -55,3 +55,5 @@ ChangeLog
# reno build
releasenotes/build
RELEASENOTES.rst
releasenotes/notes/reno.cache
# We from the Oslo project decided to pin repos based on the
# commit hash instead of the version tag to prevend arbitrary
# code from running in developer's machines. To update to a
# newer version, run `pre-commit autoupdate` and then replace
# the newer versions with their commit hash.
default_language_version:
python: python3
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: ebc15addedad713c86ef18ae9632c88e187dd0af # v3.1.0
hooks:
- id: trailing-whitespace
# Replaces or checks mixed line ending
- id: mixed-line-ending
args: ['--fix', 'lf']
exclude: '.*\.(svg)$'
# Forbid files which have a UTF-8 byte-order marker
- id: check-byte-order-marker
# Checks that non-binary executables have a proper shebang
- id: check-executables-have-shebangs
# Check for files that contain merge conflict strings.
- id: check-merge-conflict
# Check for debugger imports and py37+ breakpoint()
# calls in python source
- id: debug-statements
- id: check-yaml
files: .*\.(yaml|yml)$
- repo: https://gitlab.com/pycqa/flake8
rev: 181bb46098dddf7e2d45319ea654b4b4d58c2840 # 3.8.3
hooks:
- id: flake8
additional_dependencies:
- hacking>=3.0.1,<3.1.0
......@@ -2,8 +2,7 @@
templates:
- check-requirements
- lib-forward-testing-python3
- openstack-lower-constraints-jobs
- openstack-python3-victoria-jobs
- openstack-python3-wallaby-jobs
- periodic-stable-jobs
- publish-openstack-docs-pti
- release-notes-jobs-python3
# -*- coding: utf-8 -*-
# Copyright (C) 2020 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
......@@ -22,7 +24,6 @@ sys.path.insert(0, os.path.abspath('../..'))
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = [
'sphinx.ext.autodoc',
#'sphinx.ext.intersphinx',
'openstackdocstheme'
]
......@@ -76,6 +77,3 @@ latex_documents = [
u'%s Documentation' % project,
u'OpenStack Foundation', 'manual'),
]
# Example configuration for intersphinx: refer to the Python standard library.
#intersphinx_mapping = {'http://docs.python.org/': None}
......@@ -33,6 +33,7 @@ import codecs
import datetime
import functools
import inspect
import io
import itertools
import json
import uuid
......@@ -161,7 +162,7 @@ def to_primitive(value, convert_instances=False, convert_datetime=True,
# Python 3 does not have iteritems
elif hasattr(value, 'items'):
return recursive(dict(value.items()), level=level + 1)
elif hasattr(value, '__iter__'):
elif hasattr(value, '__iter__') and not isinstance(value, io.IOBase):
return list(map(recursive, value))
elif convert_instances and hasattr(value, '__dict__'):
# Likely an instance of something. Watch for cycles.
......
......@@ -401,6 +401,16 @@ class ToPrimitiveTestCase(test_base.BaseTestCase):
ret = jsonutils.to_primitive(obj, fallback=lambda _: 'fallback')
self.assertEqual('fallback', ret)
def test_fallback_typeerror_IO_object(self):
# IO Objects are not callable, cause a TypeError in to_primitive()
obj = io.IOBase
ret = jsonutils.to_primitive(obj)
self.assertEqual(str(obj), ret)
ret = jsonutils.to_primitive(obj, fallback=lambda _: 'fallback')
self.assertEqual('fallback', ret)
def test_exception(self):
self.assertIn(jsonutils.to_primitive(ValueError("an exception")),
["ValueError('an exception',)",
......
---
fixes:
- |
`Bug #1908607 <https://bugs.launchpad.net/cinder/+bug/1908607>`_: Fix
json to_primitive when using IO OBjects.
# -*- coding: utf-8 -*-
# Copyright (C) 2020 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
......
......@@ -6,6 +6,7 @@
:maxdepth: 1
unreleased
victoria
ussuri
train
stein
......
=============================
Victoria Series Release Notes
=============================
.. release-notes::
:branch: stable/victoria
# The order of packages is significant, because pip processes them in the order
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
hacking>=3.0,<3.1.0 # Apache-2.0
hacking>=3.0.1,<3.1.0 # Apache-2.0
netaddr>=0.7.18 # BSD
stestr>=2.0.0 # Apache-2.0
......@@ -11,3 +11,5 @@ coverage!=4.4,>=4.0 # Apache-2.0
# Bandit security code scanner
bandit>=1.6.0,<1.7.0 # Apache-2.0
pre-commit>=2.6.0 # MIT
[tox]
minversion = 3.2.0
envlist = py38,pep8
envlist = py3,pep8
basepython = python3
ignore_basepython_conflict = true
......@@ -13,7 +13,7 @@ commands = stestr run --slowest {posargs}
[testenv:pep8]
commands =
flake8
pre-commit run -a
# Run security linter
bandit -r oslo_serialization tests -n5
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment