[openstack-dev] [oslo] eventlet 0.17.3 is now fully Python 3 compatible

Angus Lees gus at inodes.org
Thu Apr 23 08:11:21 UTC 2015


On Thu, 23 Apr 2015 at 17:11 Victor Stinner <vstinner at redhat.com> wrote:

> As announced, changes are boring, just obvious Python2/Python3 issues:
>
> - strip L from long integer literals: 123L => 123
> - replace dict.iteritems() with six.iteritems(dict)
> - replace list.sort(cmp_func) with list.sort(key=key_func)
> - replace "raise exc_info[0], exc_info[1], exc_info[2]" with
> six.reraise(*exc_info)
> - moved functions / modules
>
>   * get http.client, urllib.request and other stdlib modules from
> six.moves since they moved between Python 2 and Python 3
>   * get itertools.izip/zip_longest from six.moves
>   * replace unichr() with six.unichr()
>
> - replace filter(func, data) with [item for item in data if func(item)]
> - replace unicode() with six.text_type
> - replace (int, long) with six.integer_types
> - replace file() with open()
> - replace StringIO() with six.StringIO()
>
> These changes are not enough to port nova to Python 3. But they are
> required to be able to find next Python 3 bugs.


Is there already a static analysis tool that helps find these things?
 (Would a pylint check for the above be useful?  Some of them would be hard
to find reliably, but a bunch of the above would be trivial)

 - Gus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20150423/721b5bca/attachment.html>


More information about the OpenStack-dev mailing list