Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Xavier Thompson
cython
Commits
cf66d527
Commit
cf66d527
authored
Jun 20, 2011
by
Vitja Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cyfunction make __doc__ writable
parent
64229856
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
10 deletions
+32
-10
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+32
-10
No files found.
Cython/Compiler/ExprNodes.py
View file @
cf66d527
...
...
@@ -8731,6 +8731,7 @@ typedef struct {
PyObject *func_dict;
PyObject *func_weakreflist;
PyObject *func_name;
PyObject *func_doc;
} __pyx_CyFunctionObject;
static PyTypeObject *__pyx_CyFunctionType = 0;
...
...
@@ -8742,18 +8743,37 @@ static int __Pyx_CyFunction_init(void);
"""
%
Naming
.
__dict__
,
impl
=
"""
static PyObject *
__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *
m
, void *closure)
__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *
op
, void *closure)
{
const char *doc = m->func.m_ml->ml_doc;
if (doc != NULL)
if (op->func_doc == NULL && op->func.m_ml->ml_doc) {
#if PY_MAJOR_VERSION >= 3
return PyUnicode_FromString(
doc);
op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_
doc);
#else
return PyString_FromString(
doc);
op->func_doc = PyString_FromString(op->func.m_ml->ml_
doc);
#endif
Py_INCREF(Py_None);
return Py_None;
}
if (op->func_doc == 0) {
Py_INCREF(Py_None);
return Py_None;
}
Py_INCREF(op->func_doc);
return op->func_doc;
}
static int
__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value)
{
if (value == NULL) {
Py_XDECREF(op->func_doc);
Py_INCREF(Py_None);
op->func_doc = Py_None; /* Mark as deleted */
} else {
PyObject *tmp = op->func_doc;
op->func_doc = value;
Py_INCREF(value);
Py_XDECREF(tmp);
}
return 0;
}
static PyObject *
...
...
@@ -8838,8 +8858,8 @@ __Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value)
}
static PyGetSetDef __pyx_CyFunction_getsets[] = {
{"func_doc", (getter)__Pyx_CyFunction_get_doc,
0
, 0, 0},
{"__doc__", (getter)__Pyx_CyFunction_get_doc,
0
, 0, 0},
{"func_doc", (getter)__Pyx_CyFunction_get_doc,
(setter)__Pyx_CyFunction_set_doc
, 0, 0},
{"__doc__", (getter)__Pyx_CyFunction_get_doc,
(setter)__Pyx_CyFunction_set_doc
, 0, 0},
{"func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
{"__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
{"__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0},
...
...
@@ -8885,6 +8905,7 @@ static PyObject *__Pyx_CyFunction_NewEx(PyMethodDef *ml, PyObject *self, PyObjec
op->func.m_module = module;
op->func_dict = NULL;
op->func_name = NULL;
op->func_doc = NULL;
PyObject_GC_Track(op);
return (PyObject *)op;
}
...
...
@@ -8898,6 +8919,7 @@ static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
Py_XDECREF(m->func.m_module);
Py_XDECREF(m->func_dict);
Py_XDECREF(m->func_name);
Py_XDECREF(m->func_doc);
PyObject_GC_Del(m);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment