[PATCH V2] extensions: add notloaded method to return extensions failed to load

Gregory Szorc gregory.szorc at gmail.com
Sun Feb 28 00:49:03 EST 2016


On Mon, Feb 22, 2016 at 3:00 PM, Augie Fackler <raf at durin42.com> wrote:

> On Wed, Feb 17, 2016 at 01:26:24AM +0900, Yuya Nishihara wrote:
> > On Tue, 16 Feb 2016 15:48:56 +0000, Jun Wu wrote:
> > > On 02/16/2016 02:43 PM, Yuya Nishihara wrote:
> > > > LGTM. I'll change it to .iteritems() and push to the clowncopter,
> > > > thanks.
> > >
> > > OpenStack also faces Python 2 to 3 issue like us. They have a style
> > > guide at https://wiki.openstack.org/wiki/Python3 (which recommends
> items
> > > over iteritems). I wonder if we want a similar style guide to make
> > > Python 3 transition easier.
> >
> > We have lots of .iteritems(). I don't know if we can rewrite all of them,
> > so it doesn't make sense to switch to .items() right now.
> >
> > But I agree we'll need something for Py3k support.
>
> I suspect the best option is a 2to3 rule for that. We probably don't
> want the RAM overhead of the copy that .items() implies on 2.6 and
> 2.7.


You can alias dict.items and dict.iteritems to a local symbol and then call
it with the instance of the dict you are iterating over. e.g.

if sys.version_info[0] == 2:
    iteritems = dict.iteritems
else:
    iteritems = dict.items
...
for k, v in iteritems(d):

We will likely want to throw such helper symbols in py3kcompat.py or
util.py.

BTW, I just sent a series that kills 2to3. I'm very adamant that we run all
the Pythons from the same code install without source transformation. See
previous work around the module importer that allows pure and non-pure
running from the same install.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mercurial-scm.org/pipermail/mercurial-devel/attachments/20160227/5d6f49fe/attachment.html>


More information about the Mercurial-devel mailing list