Perhaps your append function is not able to take an integer as an argument?
If I try out the following statements, ...
@script:python collection depends on !is_void@
typ << function_declaration.t;
fun << function_declaration.f;
places << function_declaration.p;
@@
for place in places:
fields = []
fields.append(12345)
... 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
Traceback (most recent call last):
File "<string>", line 10, in <module>
TypeError: sequence item 0: expected string, int found
Failure in collection
Fatal error: exception Pycocci.Pycocciexception
Why does Coccinelle's scripting interface not support an integer at this place
when this parameter passing works as expected in a standard execution environment?
elfring@Sonne:~> python
Python 2.7.2 (default, Aug 19 2011, 20:41:43) [GCC] on linux2
...
>>> fields = []
>>> fields.append("ABC")
>>> fields.append(12345)
>>> print(fields)
['ABC', 12345]
>>>
elfring@Sonne:~> python3
Python 3.2.1 (default, Jul 18 2011, 16:24:40) [GCC] on linux2
...
>>> fields = []
>>> fields.append("ABC")
>>> fields.append(12345)
>>> print(fields)
['ABC', 12345]
>>>
Regards,
Markus
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)