# Py\_msg\_queue\_\_delete\_head

**URL:** <https://www.ruby-forum.com/t/py-msg-queue-delete-head/241056>\
**Category:** GNU Radio\
**Created:** [May 11, 2014, 4:24am UTC](https://www.ruby-forum.com/t/py-msg-queue-delete-head/241056 "2014-05-11T04:24:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Detlef\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/58f4c7/32.png) [@Detlef\_R](https://www.ruby-forum.com/u/Detlef_R)\
**Post date:** [May 11, 2014, 4:24am UTC](https://www.ruby-forum.com/t/py-msg-queue-delete-head/241056/1 "2014-05-11T04:24:12Z")

</div>

Hi, All

I check the code in GNURadio 3.7.3,  
gnuradio-3.7.3/gnuradio-runtime/swig/msg\_queue.i

the code:  
83 #ifdef SWIGPYTHON  
84 %inline %{  
85 gr::message::sptr py\_msg\_queue\_\_delete\_head(gr::msg\_queue::sptr q)  
{  
86 gr::message::sptr msg;  
87 GR\_PYTHON\_BLOCKING\_CODE(  
88 msg = q-\>delete\_head();  
89 )  
90 return msg;  
91 }  
92  
93 void py\_msg\_queue\_\_insert\_tail(gr::msg\_queue::sptr q,  
gr::message::sptr msg) {  
94 GR\_PYTHON\_BLOCKING\_CODE(  
95 q-\>insert\_tail(msg);  
96 )  
97 }  
98 %}

output is located in “gnuradio-runtime/swig/runtime\_swig.py”  
the output is like:  
3791 def py\_msg\_queue\_\_delete\_head(\*args, \*\*kwargs):  
3792 “”“py\_msg\_queue\_\_delete\_head(sptr q) → sptr”“”  
3793 return \_runtime\_swig.py\_msg\_queue\_\_delete\_head(\*args, \*\*kwargs)  
3794  
3795 def py\_msg\_queue\_\_insert\_tail(\*args, \*\*kwargs):  
3796 “”“py\_msg\_queue\_\_insert\_tail(sptr q, sptr msg)”“”  
3797 return \_runtime\_swig.py\_msg\_queue\_\_insert\_tail(\*args, \*\*kwargs)

_Of course, the above in the gnuradio is work well._

I could not understand these swig output. so I write a small .i file to  
test this  
1 /\* -_- c -_- \*/  
2 // swig2.0 -python \*.i  
3 [//swig2.0](https://swig2.0) -python -v -c++ \*.i  
4  
5 %module(directors=“1”) util\_swig  
6  
7 #ifdef SWIGPYTHON  
8  
9  
10 %inline %{  
11 int fun1(int q) {  
12 return q;  
13 }  
14 %}  
15  
16 #endif

but there is one more line (see line 73 ) in the output file \*.py

71 def fun1(\*args):  
72 return \_util\_swig.fun1(\*args)  
73 fun1 = \_util\_swig.fun1  
74 # This file is compatible with both classic and new-style classes.

Is it some configuration in other place lead the output to be different  
from the standard “swig command” ?

Thanks & Best Regards.

---

<div class="post-metadata">

**Author:** ![chenjian](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f6c823/32.png) [@chenjian](https://www.ruby-forum.com/u/chenjian)\
**Post date:** [May 11, 2014, 4:18pm UTC](https://www.ruby-forum.com/t/py-msg-queue-delete-head/241056/2 "2014-05-11T16:18:54Z")

</div>

On Sat, May 10, 2014 at 10:22 PM, chenjian [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> 87 GR\_PYTHON\_BLOCKING\_CODE(  
> 97 }  
> 3797 return \_runtime\_swig.py\_msg\_queue\_\_insert\_tail(\*args, \*\*kwargs)  
> 6
> 
> Thanks & Best Regards.

We are not meant to understand the workings of SWIG…

But seriously, this is a SWIG question and not a GNU Radio question.  
Best  
ask the SWIG developers.

Tom
