python35 values for http status codes not ints

Bug #1629460 reported by Eric Brown
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Identity (keystone)
Invalid
Wishlist
Eric Brown

Bug Description

The values of Python 3.5 http status codes via http_client.OK, for example, are enums not ints like in py27 and py34. This can cause potential trouble and the unit tests are catching the difference.

Python 2.7/3.4
>>> from six.moves import http_client
>>> http_client.BAD_REQUEST
400

Python 3.5
>>> from six.moves import http_client
>>> http_client.BAD_REQUEST
<HTTPStatus.BAD_REQUEST: 400>

https://bitbucket.org/gutworth/six/issues/161/inconsistent-value-returned-from
https://bugs.python.org/issue26123

Tags: python3
Eric Brown (ericwb)
Changed in keystone:
assignee: nobody → Eric Brown (ericwb)
Changed in keystone:
status: New → In Progress
Revision history for this message
Lance Bragstad (lbragstad) wrote :

Are we looking to add a py35 environment to our tox.ini file?

description: updated
tags: added: python3
Revision history for this message
Lance Bragstad (lbragstad) wrote :

Judging by the upstream discussion [0], it seems like we'll have to either convert our http comparisons to strings or explicitly ask the enum for the numeric code [1].

[0] https://bitbucket.org/gutworth/six/issues/161/inconsistent-value-returned-from
[1] https://bugs.python.org/msg258306

Changed in keystone:
importance: Undecided → Wishlist
Revision history for this message
Tin Lam (lamt) wrote :

It appears that we can still do comparison of the 'HTTPStatus' enum against integer in 3.5.2.

   >>> from six.moves import http_client
   >>> http_client.BAD_REQUEST
   <HTTPStatus.BAD_REQUEST: 400>
   >>> http_client.BAD_REQUEST == 400
   True
   >>> http_client.OK != 201
   True

Revision history for this message
Eric Brown (ericwb) wrote :

Thanks Tin Lam, I'll mark invalid.

Changed in keystone:
status: In Progress → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.