[Python-Dev] [patch] fpconst for python3

David Malcolm dmalcolm at redhat.com
Wed Oct 20 18:43:23 CEST 2010


(my apologies, if necessary, for top-posting)

FWIW Neal asked about this on Fedora's development mailing list as well:
http://lists.fedoraproject.org/pipermail/devel/2010-October/144535.html

If I'm reading:
  http://pypi.python.org/pypi/fpconst/
correctly, that project hasn't had an upstream update in over four
years, and the upstream home page seems to be down.

I believe that there are a number of python 2 modules that are either
mature or "good enough", but need porting to work with python 3, and in
some of these cases, upstream may have either disappeared, or lost
interest.

I'm guessing that Neal has already made an effort to contact the
maintainer of fpconst.

IIRC, fpconst is a relatively simple module, and the fixes to port to
python 3 seem simple.

So IMHO this is on-topic for python.org (if not necessarily this list),
in that we have an interest in timely porting of Python 2 code to Python
3, and there has been discussion here on how to encourage people to port
their code.

We don't want each Linux distribution to do different patches to port
the code to Python 3: there ought to be some kind of clearing-house for
this kind of simple porting, so that python 3 stacks will work
consistently across the different distributions.

Whether or not that's python-dev, I'm not sure. Perhaps:
  http://mail.python.org/mailman/listinfo/python-porting
is a better list.

FWIW you can see the current status of Python 3 porting within Fedora
here:
  https://fedoraproject.org/wiki/Python3#Porting_status

Hope this is helpful
Dave

On Tue, 2010-10-19 at 20:07 -0500, Benjamin Peterson wrote:
> fpconst developers?
> 
> 2010/10/19 Neal Becker <ndbecker2 at gmail.com>:
> > Where should I send this patch?
> >
> > diff -u fpconst-0.7.2/fpconst.py fpconst-0.7.2.new/fpconst.py
> > --- fpconst-0.7.2/fpconst.py    2005-02-24 12:42:03.000000000 -0500
> > +++ fpconst-0.7.2.new/fpconst.py        2010-10-19 20:55:07.407765664 -0400
> > @@ -40,18 +40,18 @@
> >  ident = "$Id: fpconst.py,v 1.16 2005/02/24 17:42:03 warnes Exp $"
> >
> >  import struct, operator
> > +from functools import reduce
> >
> >  # check endianess
> > -_big_endian = struct.pack('i',1)[0] != '\x01'
> > -
> > +_big_endian = struct.pack('i',1)[0] != 1
> >  # and define appropriate constants
> >  if(_big_endian):
> > -    NaN    = struct.unpack('d', '\x7F\xF8\x00\x00\x00\x00\x00\x00')[0]
> > -    PosInf = struct.unpack('d', '\x7F\xF0\x00\x00\x00\x00\x00\x00')[0]
> > +    NaN    = struct.unpack('d', b'\x7F\xF8\x00\x00\x00\x00\x00\x00')[0]
> > +    PosInf = struct.unpack('d', b'\x7F\xF0\x00\x00\x00\x00\x00\x00')[0]
> >     NegInf = -PosInf
> >  else:
> > -    NaN    = struct.unpack('d', '\x00\x00\x00\x00\x00\x00\xf8\xff')[0]
> > -    PosInf = struct.unpack('d', '\x00\x00\x00\x00\x00\x00\xf0\x7f')[0]
> > +    NaN    = struct.unpack('d', b'\x00\x00\x00\x00\x00\x00\xf8\xff')[0]
> > +    PosInf = struct.unpack('d', b'\x00\x00\x00\x00\x00\x00\xf0\x7f')[0]
> >     NegInf = -PosInf
> >
> >  def _double_as_bytes(dval):
> >
> > _______________________________________________
> > Python-Dev mailing list
> > Python-Dev at python.org
> > http://mail.python.org/mailman/listinfo/python-dev
> > Unsubscribe: http://mail.python.org/mailman/options/python-dev/benjamin%40python.org
> >
> 
> 
> 



More information about the Python-Dev mailing list