[Rpm-maint] [PATCH 07/15] Use macros to hide "int" implementation differences between Python 2 and 3

Panu Matilainen pmatilai at redhat.com
Thu Oct 29 11:29:29 UTC 2009


On Mon, 19 Oct 2009, Panu Matilainen wrote:

> On Thu, 15 Oct 2009, David Malcolm wrote:
>
>> On Python 3, use macros to alias all usage of PyInt_ to PyLong_ 
>> equivalents,
>> as the former no longer exists.
>
> Right, simply aliasing to PyLong is probably quite ok.
>
>> 
>> Likewise, the "cmpfunc" typedef no longer exists; introduce a dummy 
>> definition
>> to enable our code to compile
>
> ...but this is not really :) We'll need to convert the tp_compare cases to 
> tp_richcompare, AFAICT Python handles this compatibly in 2.x so it shouldn't 
> be a big deal.

I ended up with the gentle chainsaw approach on this, no comparison code 
means nothing to convert.

The comparisons on header and dependency set objects are awfully ambiguous 
(and the mapping is plain weird in case of rpm.ds), I figured its better 
just rip it. For header version comparisons there's rpm.versionCompare() 
which has clear enough semantics, and provides a way to write compatible 
code. For rpm.ds there's no compatible way, but AFAIK nobody is actually 
using the comparisons. If somebody does, we'll hear sooner or later...

 	- Panu -


More information about the Rpm-maint mailing list