[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: "gen-make.py --debug" with Python 3 fails with TypeError

From: Branko Čibej <brane_at_apache.org>
Date: Thu, 23 Apr 2020 07:16:45 +0200

On 23.04.2020 00:14, Yasuhito FUTATSUKI wrote:
> Let's take easier one to analyze :)
>
> On 2020/04/23 6:08, Johan Corveleyn wrote:
>> On Wed, Apr 22, 2020 at 10:09 PM Daniel Shahaf <d.s_at_daniel.shahaf.name>
>> wrote:
>>
>>> Johan Corveleyn wrote on Wed, 22 Apr 2020 19:16 +00:00:
>>>> Running "gen-make.py --debug" with Python 3 fails with:
>
>> Thanks, but now it fails earlier with this error (same with Yasuhito's
>> attempt, which is equivalent I guess):
> Yes, they are equivalent.

Not quite:

> With previous errorand this, earch element of sorted_targets
> can be str or ObjectFile objects, I assume. ObjectFile has
> __str__ method, then it can be ...
>
> [[[
> Index: gen-make.py
> ===================================================================
> --- gen-make.py (revision 1872433)
> +++ gen-make.py (working copy)
> @@ -70,7 +70,7 @@
>
> if ('--debug', '') in other_options:
> for dep_type, target_dict in generator.graph.deps.items():
> - sorted_targets = list(target_dict.keys()); sorted_targets.sort()
> + sorted_targets = sorted(target_dict.keys(), key=str)
> for target in sorted_targets:
> print(dep_type + ": " + _objinfo(target))
> for source in target_dict[target]:
> ]]]

The sorted() function returns an iterator, so you're changing the type
of the sorted_targets variable, which was a list before. But that
doesn't matter in this context, and I actually prefer the iterator-based
approach.

-- Brane
Received on 2020-04-23 07:16:57 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.