Is this a bug in fparser/base_classed.py ?

1 view
Skip to first unread message

TakaoKotani

unread,
Jul 13, 2009, 1:14:18 AM7/13/09
to F2PY Developers
Hello all,
I had a problem to apply tree = parse(xxx,isfree=False)
for xxx=
"""
subroutine xxx()
real(8):: pa(1:3)
end
"""
Then pa(1:nx) is not recognized.

I think a bug is in analyze(self) for class AttributeHolder
--------------------------------
def analyze(self):
......
for spec in array_spec:
if len(spec)==1:
shape.append(spec[0])
else:
#shape.append(spec[1]-spec[0]) !<-- this is
wrong
shape.append(spec[1]+'-'+spec[0])
--------------------------------

Am I correct?

takao kotani
Tottori university, japan

Pearu Peterson

unread,
Jul 13, 2009, 3:49:35 AM7/13/09
to F2PY Developers
It is not really a bug, it is rather a not implemented feature.
Namely,
the plan is to make spec items symbolic objects that can be
symbolically manipulated. Currently spec items are strings
and your fix is appropriate for the moment. However, to make
the problematic line working for both cases (symbolic objects and
strings),
one can use:
shape.append(spec[1]+('-(%s)' % spec[0]))

Pearu
(I think I can look into adding symbolic support to f2py parser
within next two weeks)

TakaoKotani

unread,
Jul 13, 2009, 12:57:22 PM7/13/09
to F2PY Developers
Thank you for your reply. It is very helpful.

I am still testing fparser.py. Until now, I saw it works very well.
I will report how it works to my code.
(I found parse(isfree=False,isstrict=False) is needed for my fix90
code with *.F).

Then I want to analyze my fortran code (I maintain a fortran package
for electronic structure calculation).

takao
Reply all
Reply to author
Forward
0 new messages