# HG changeset patch
# User ZyX <[email protected]>
# Date 1369552448 -14400
# Node ID 3fb04fcf34ebf32f217f724f85064879e29b7fe4
# Parent  abd30ecabb334396aabab4b284b008d57cbedd16
Add FunctionRepr

diff -r abd30ecabb33 -r 3fb04fcf34eb src/if_py_both.h
--- a/src/if_py_both.h  Sun May 26 11:11:34 2013 +0400
+++ b/src/if_py_both.h  Sun May 26 11:14:08 2013 +0400
@@ -1584,6 +1584,12 @@
     return result;
 }
 
+    static PyObject *
+FunctionRepr(FunctionObject *self)
+{
+    return PyString_FromFormat("<vim.Function '%s'>", self->name);
+}
+
 static struct PyMethodDef FunctionMethods[] = {
     {"__call__",(PyCFunction)FunctionCall,  METH_VARARGS|METH_KEYWORDS,        
""},
     {"__dir__",        (PyCFunction)FunctionDir,   METH_NOARGS,                
""},
@@ -4639,6 +4645,7 @@
     FunctionType.tp_flags = Py_TPFLAGS_DEFAULT;
     FunctionType.tp_doc = "object that calls vim function";
     FunctionType.tp_methods = FunctionMethods;
+    FunctionType.tp_repr = (reprfunc)FunctionRepr;
 #if PY_MAJOR_VERSION >= 3
     FunctionType.tp_getattro = (getattrofunc)FunctionGetattro;
 #else

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


*** /tmp/extdiff.PgKi9o/vim.abd30ecabb33/src/if_py_both.h	2013-05-26 12:16:20.411779183 +0400
--- vim.3fb04fcf34eb/src/if_py_both.h	2013-05-26 12:16:20.418779116 +0400
***************
*** 1584,1589 ****
--- 1584,1595 ----
      return result;
  }
  
+     static PyObject *
+ FunctionRepr(FunctionObject *self)
+ {
+     return PyString_FromFormat("<vim.Function '%s'>", self->name);
+ }
+ 
  static struct PyMethodDef FunctionMethods[] = {
      {"__call__",(PyCFunction)FunctionCall,  METH_VARARGS|METH_KEYWORDS,	""},
      {"__dir__",	(PyCFunction)FunctionDir,   METH_NOARGS,		""},
***************
*** 4639,4644 ****
--- 4645,4651 ----
      FunctionType.tp_flags = Py_TPFLAGS_DEFAULT;
      FunctionType.tp_doc = "object that calls vim function";
      FunctionType.tp_methods = FunctionMethods;
+     FunctionType.tp_repr = (reprfunc)FunctionRepr;
  #if PY_MAJOR_VERSION >= 3
      FunctionType.tp_getattro = (getattrofunc)FunctionGetattro;
  #else

Raspunde prin e-mail lui