I suspect that the problem is in delimiter join. Since you do not use
places in your loop, I think you should be able to set places to any array
when using python at top level and then run exactly the same code in both
cases.
julia
On Wed, 28 Dec 2011, SF Markus Elfring wrote:
But it is strange that you test one thing in your script code and another
thing
when you run python directly.
Various data types can usually be mixed in lists.
elfring@Sonne:~> python
Python 2.7.2 (default, Aug 19 2011, 20:41:43) [GCC] on linux2
Type "help", "copyright", "credits" or "license" for more information.
fields = []
print("fields:", type(fields))
('fields:', <type 'list'>)
fields.append(12345)
print(fields)
[12345]
If I try out the following statements, ...
@script:python collection depends on !is_void@
places << function_declaration.p;
@@
for place in places:
fields = []
print("fields:", type(fields))
fields.append(12345)
print(fields)
result.append(delimiter.join(fields))
... I get also another unexpected reaction.
elfring@Sonne:~/Projekte/Coccinelle/lokal/demos/return_values> spatch
-sp_file select_non_void_functions.cocci example1b.c
init_defs_builtins: /usr/share/coccinelle/standard.h
HANDLING: example1b.c
('fields:', <type 'list'>)
[12345]
Traceback (most recent call last):
File "<string>", line 8, in <module>
TypeError: sequence item 0: expected string, int found
Failure in collection
Fatal error: exception Pycocci.Pycocciexception
Why not test the same code in both cases?
I can only try an approximation in these execution environments to find out
unexpected differences in the run time behaviour.
I don't think there is anyone working on coccinelle that has the time
or expertise to solve this kind of problem.
I hope that this situation will change. I would appreciate if more
interested software developers will try to resolve such open issues.
Regards,
Markus
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)