From benjamin at python.org Sun Jun 8 04:43:03 2014 From: benjamin at python.org (Benjamin Peterson) Date: Sat, 07 Jun 2014 19:43:03 -0700 Subject: [Python-porting] [RELEASE] six 1.7.0 Message-ID: <1402195383.29187.126353841.1B70D487@webmail.messagingengine.com> I'm pleased to announce the immediate availability of six 1.7.0. six is a small Python 2/3 compatibility library. The most interesting change in this release is yet another implementation by Anselm Kruis of six.moves using a sys.meta_path hook. Hopefully, this will cause less issues with the various tools that iterate blindly over sys.modules. Downloads are on PyPI: https://pypi.python.org/pypi/six Documentation is available on Read the Docs: http://six.readthedocs.org/ Here is the changelog for 1.7.0: - Pull request #30: Implement six.moves with a PEP 302 meta path hook. - Pull request #32: Add six.wraps, which is like functools.wraps but always sets the __wrapped__ attribute. - Pull request #35: Improve add_metaclass, so that it doesn't end up inserting another class into the hierarchy. - Pull request #34: Add import mappings for dummy_thread. - Pull request #33: Add import mappings for UserDict and UserList. - Pull request #31: Select the implementations of dictionary iterator routines at import time for a 20% speed boost. From rdmurray at bitdance.com Mon Jun 9 15:54:48 2014 From: rdmurray at bitdance.com (R. David Murray) Date: Mon, 09 Jun 2014 09:54:48 -0400 Subject: [Python-porting] six.buffer_types? In-Reply-To: <201405282101.17718.shai@platonix.com> References: <201405282101.17718.shai@platonix.com> Message-ID: <20140609135449.4EA28250D5E@webabinitio.net> On Wed, 28 May 2014 21:01:17 +0300, Shai Berger wrote: > Hi Python porters, > > This is my first message here; usually, I work on Django. In this work, I > recently felt the need to have a collection of the buffer, or bytes types > (parallel to the existing string_types) for an isinstance check. That is, > > if six.PY2: > buffer_types = buffer, bytearray > if six.PY3: > buffer_types = bytes, bytearray, memoryview Why do you not consider memoryview a buffer type in py2? --David From bcannon at gmail.com Thu Jun 12 21:58:44 2014 From: bcannon at gmail.com (Brett Cannon) Date: Thu, 12 Jun 2014 19:58:44 +0000 Subject: [Python-porting] in-progress work on a pylint checker for 2/3 compat Message-ID: I've started writing some custom pylint checkers to warn when some Python 2 code won't (possibly) work in Python 3. I decided to go with aggressive over conservative checking since pylint lets you turn off warnings entirely, per-module, or per-line. The code is sitting at https://gist.github.com/brettcannon/40af38646cdc959dffbf so I have a backup somewhere. It's not on some code hosting site because I need to decide if I want it to simply be a part of caniusepython3 or if it should be a separate project with some new name I don't have yet. I'm posting about it here before it's complete so people are aware that I'm working on this while I'm on vacation. My thinking is we are past the convincing stage for people wanting to use Python 3; now we need to push through the porting stage. With modernize(3k)/futurize to help porting, this checker to prevent regressions along with -3 (and let people know that porting from Python 3 isn't that bad), and caniusepython3 to know when dependencies are no longer in the way, all the major tooling should be there which can be done to assist in porting. -------------- next part -------------- An HTML attachment was scrubbed... URL: From benjamin at python.org Fri Jun 13 07:33:46 2014 From: benjamin at python.org (Benjamin Peterson) Date: Thu, 12 Jun 2014 22:33:46 -0700 Subject: [Python-porting] six.buffer_types? In-Reply-To: <201405282101.17718.shai@platonix.com> References: <201405282101.17718.shai@platonix.com> Message-ID: <1402637626.31624.128320277.4C7B9EFC@webmail.messagingengine.com> In addition to David said, usually the correct way to use a buffer type is to call a buffer type (either memoryview or buffer) on some object that supports the buffer interface. I'm curious what you're using the list for. On Wed, May 28, 2014, at 11:01, Shai Berger wrote: > Hi Python porters, > > This is my first message here; usually, I work on Django. In this work, I > recently felt the need to have a collection of the buffer, or bytes types > (parallel to the existing string_types) for an isinstance check. That is, > > if six.PY2: > buffer_types = buffer, bytearray > if six.PY3: > buffer_types = bytes, bytearray, memoryview > > We will probably add this soon to Django's customized version of six (the > initial PR is at https://github.com/django/django/pull/2732/files if > you're > interested). > > Do you think this would be useful for six in general? > > Thanks, > Shai. > _______________________________________________ > Python-porting mailing list > Python-porting at python.org > https://mail.python.org/mailman/listinfo/python-porting From ed at pythoncharmers.com Fri Jun 20 03:03:36 2014 From: ed at pythoncharmers.com (Ed Schofield) Date: Fri, 20 Jun 2014 11:03:36 +1000 Subject: [Python-porting] python-future v0.12 Message-ID: <24F1DC07-9442-40CB-8DEB-89DAB2BE8D7B@pythoncharmers.com> Hi all, Version 0.12.3 of python-future for Py2/3 compatibility is now available on PyPI. The major new features in the v0.12.x series are: - more robust standard-library import hooks - a newobject base class with Py2-compatible special methods (__next__, __nonzero__, __long__) - improvements to the past.builtins module (e.g. execfile(), and the Py2 behaviour of map() and filter() with None as a first argument is now available on Py3) - a backport of the surrogateescape error handler from Py3 In v0.12.3, we now also have: - backports of collections.OrderedDict and collections.Counter to Py2.6 - added Py3.4 support, so the test suite now runs successfully on Py2.6, Py2.7, Py3.3, and Py3.4 More details about the updates are here: http://python-future.org/whatsnew.html We?re aiming to have a Py3.5-compatible backport of the % operator for bytes objects for MySQLdb and other projects in the next major release (v0.13). If anyone would like to contribute to this, please get in touch! :) Best wishes, Ed -- Dr. Edward Schofield Python Charmers http://pythoncharmers.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From shai at platonix.com Sat Jun 14 00:44:18 2014 From: shai at platonix.com (Shai Berger) Date: Sat, 14 Jun 2014 01:44:18 +0300 Subject: [Python-porting] six.buffer_types? In-Reply-To: <1402637626.31624.128320277.4C7B9EFC@webmail.messagingengine.com> References: <201405282101.17718.shai@platonix.com> <1402637626.31624.128320277.4C7B9EFC@webmail.messagingengine.com> Message-ID: <201406140144.19511.shai@platonix.com> On Friday 13 June 2014 08:33:46 Benjamin Peterson wrote: > In addition to David said, David suggested that memoryview be considered a buffer type on Python2 as well, and he is correct, of course. I missed it because the Django code that this is, originally, an amendment to, conflates buffer and memoryview on purpose. So, I correct the suggestion: if six.PY2: buffer_types = buffer, bytearray, memoryview if six.PY3: buffer_types = bytes, bytearray, memoryview > usually the correct way to use a buffer type > is to call a buffer type (either memoryview or buffer) on some object > that supports the buffer interface. I'm curious what you're using the > list for. > As I said, for an isinstance check. The context is that I am receiving a value of unknown type, and need to format it for use as the default value of a database table column. If it is binary (buffer) data, it needs to be transformed to a string of hexadecimals. Other data types get different treatments (the data must be formatted, rather than passed as a parameter, because Oracle does not take parameters in schema-changing statements). Thanks, Shai,