]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commit
Fixed multiple py34 gate issues
authorKevin Benton <blak111@gmail.com>
Wed, 7 Oct 2015 03:16:15 +0000 (20:16 -0700)
committerIhar Hrachyshka <ihrachys@redhat.com>
Thu, 8 Oct 2015 12:13:56 +0000 (14:13 +0200)
commit8f58bbf38f5984e70d6e0be7427deb99d7782d1d
tree151f6191d8a7a110a65d1e58de11c46c2b863cc8
parentfda5df4ff66c52e90988d2accaf8877d4cd55d78
Fixed multiple py34 gate issues

1. Scope mock of 'open' to module

By mocking 'open' at the module level, we can avoid affecting
'open' calls from other modules.

2. Stop using LOG.exception in contexts with no sys.exc_info set

Python 3.4 logger fills in record.exc_info with sys.exc_info() result
[1], and then it uses it to determine the current exception [2] to
append to the log message. Since there is no exception, exc_info[1] is
None, and we get AttributeError inside traceback module.

It's actually a bug in Python interpreter that it attempt to access the
attribute when there is no exception. It turns out that it's fixed in
latest master of cPython [3] (the intent of the patch does not seem
relevant, but it removes the offending code while reshuffling the code).
Note that now cPython correctly checks the exception value before
accessing its attributes [4].

The patch in cPython that resulted in the failure is [5] and is present
since initial Python 3k releases.

The patch in fixtures that broke us is [6].

[1]: https://hg.python.org/cpython/file/tip/Lib/logging/__init__.py#l1412
[2]: https://hg.python.org/cpython/file/tip/Lib/logging/__init__.py#l575
[3]: https://hg.python.org/cpython/rev/73afda5a4e4c
[4]: https://hg.python.org/cpython/rev/73afda5a4e4c#l6.484
[5]: https://hg.python.org/cpython/rev/2ee09afee126
[6]: https://github.com/testing-cabal/fixtures/commit/67dd2956943261e845a866dab155208c51da937e

Closes-Bug: #1503847
Closes-Bug: #1504053
Co-Authored-By: Ihar Hrachyshka <ihrachys@redhat.com>
Change-Id: I456b7846b8a53e4d3f8c91583685e0e1eaa84719
neutron/manager.py
neutron/policy.py
neutron/services/provider_configuration.py
neutron/tests/unit/db/test_migration.py