[py3porters-devel] Porting reportbug to Python 3

Thomas Goirand zigo at debian.org
Mon Jun 1 23:22:41 UTC 2015


On 06/01/2015 03:49 PM, Florian Bruhin wrote:
> * Thomas Goirand <zigo at debian.org> [2015-06-01 10:37:46 +0200]:
>> Your comments are welcome, and as well, anyone from the py3porters team
>> is more than welcome to review my patch.
> 
> I hope the ML is the right place for this - I did a quick look at the
> patch and added some thoughts below.
> 
> Also, is it desirable to keep python2 compatibility?

Not sure.

>> +try:
>> +    sys.setdefaultencoding("utf-8")
>> +except:
>> +    print("")
> 
> Same issue as above - and what's the print("") for?

The above is just bad, and I know it. I intended to print some big
warnings saying it was still left TODO, but didn't finish it...

>> -import commands
>> -import rfc822
>> +try:
>> +    import commands
>> +except:
>> +    import subprocess
>> +try:
>> +    import rfc822
>> +except:
>> +    import email
> 
> "except ImportError:"
> 
> And you might want to do some "as"-imports and/or only import certain
> classes so you end up getting the same classes to use for the
> following code.

The above was basically to make it just build, then I intended to make
it somehow work later on! :)

(and same for the other series of import "fixes")

So basically, this was unfinished work, just like I wrote.

>> @@ -794,15 +804,15 @@ def get_cpu_cores():
>> -	#Alpha platform
>> -	if line.startswith('cpus detected'):
>> -	    cpucount = int(line.split()[-1])
>> +        #Alpha platform
>> +        if line.startswith('cpus detected'):
>> +            cpucount = int(line.split()[-1])
> 
> I don't have the context here - but did you intend to dedent this?

The patch is replacing tabs by spaces, as it was an issue in the
original source code, which broke only in Python 3, it seems.

Cheers,

Thomas




More information about the py3porters-devel mailing list