EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: pyepics bug (need fix asap!) + Matthew Newville?
From: Matt Newville <[email protected]>
To: Matt Newville <[email protected]>, EPICS tech-talk <[email protected]>
Date: Wed, 22 Sep 2010 09:56:55 -0500
Hi Emmanuel,

OK, I was able to reproduce the problem on a linux x86_64 machine.
For Python, I see that

>>> import ctypes
>>> ctypes.c_long == ctypes.c_int

is True on 32 bit systems but is False on 64-bit linux.  As I said, I
was mapping Epcics DBR_LONG to a ctypes.c_long.   My suspicion is that
an Epics DBR_LONG is actually not a "long" on 64-bit machines, but a
32-bit integer, which is to say an int.  Perhaps someone can confirm,
correct, or clarify this.

In any event, a test and possible fix (works for me on x86_64) is this:

>>> import ctypes
>>> import epics
>>> epics.dbr.Map[epics.dbr.LONG] = ctypes.c_int

which changes the mapping to use a C int.  With that,

>>> p = epics.PV('XXX_LONG.VAL')
>>> print p.get()

should report the correct value, and then

>>> epics.dbr.Map[epics.dbr.LONG] = ctypes.c_long
>>> print p.get()

should (as before) report the wrong value.  If you can confirm this,
I'll change the mapping to map DBR_LONG to ctypes.c_int, though I'll
want to test that on a few more sytems (especially Windows) first.

I use ctypes.c_long and ctypes.c_ulong all over dbr.py for the mapping
of various CA structures, including event and connection handling and
in the more complex data (DBR_CTRL_XXX, etc).  But callbacks and at
least some complex data types appear to be working, so some portions
of these structures must really be longs.  I'll have to do more
testing on 64-bit machines to better sample over all the mappings of
the C structures.

--Matt Newville <newville at cars.uchicago.edu> 630-252-0431


On Wed, Sep 22, 2010 at 9:09 AM,  <[email protected]> wrote:
> On 06:38 Wed 22 Sep     , Matt Newville wrote:
>> What system are you working on, and how were Epics base and python
>> built? Could this be an issue with 64bit machines?
>
> All of my OPIs are FEdora 11.... 64-bits
> Base 3.14.11
> python was yum'ed
>
> ~/svn/opis/cls1/lib/py/lib
> epics2@cr1com1 $ python
> Python 2.6 (r26:66714, Nov  3 2009, 17:33:18)
> [GCC 4.4.1 20090725 (Red Hat 4.4.1-2)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>>>>
>
> I will try to run on fedora 8 32-bit and report the results
>
> --
> Emmanuel


Replies:
Re: pyepics bug (need fix asap!) + Matthew Newville? Andrew Johnson
Re: pyepics bug (need fix asap!) + Matthew Newville? emmanuel_mayssat
References:
pyepics bug (need fix asap!) + Matthew Newville? emmanuel_mayssat
Re: pyepics bug (need fix asap!) + Matthew Newville? Matt Newville
Re: pyepics bug (need fix asap!) + Matthew Newville? emmanuel_mayssat

Navigate by Date:
Prev: Re: pyepics bug (need fix asap!) + Matthew Newville? emmanuel_mayssat
Next: Re: pymsi - a python alternative to msi Andrew Johnson
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: pyepics bug (need fix asap!) + Matthew Newville? emmanuel_mayssat
Next: Re: pyepics bug (need fix asap!) + Matthew Newville? Andrew Johnson
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 22 Sep 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·