summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2013-07-22 21:02:05 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2013-07-22 21:02:05 (GMT)
commit4d1f5d6eee2864476c3042d7941e126b2c8a9c21 (patch)
tree89476061239f1804dad6c570753ca99eb55aad91 /Objects
parent62ce62a3a1633d97f93f85e85559f4439f1952c6 (diff)
downloadcpython-4d1f5d6eee2864476c3042d7941e126b2c8a9c21.zip
cpython-4d1f5d6eee2864476c3042d7941e126b2c8a9c21.tar.gz
cpython-4d1f5d6eee2864476c3042d7941e126b2c8a9c21.tar.bz2
Reindent PyFunction_NewWithQualName()
Diffstat (limited to 'Objects')
-rw-r--r--Objects/funcobject.c98
1 files changed, 49 insertions, 49 deletions
diff --git a/Objects/funcobject.c b/Objects/funcobject.c
index 49415b9..b5525e3 100644
--- a/Objects/funcobject.c
+++ b/Objects/funcobject.c
@@ -8,60 +8,60 @@
PyObject *
PyFunction_NewWithQualName(PyObject *code, PyObject *globals, PyObject *qualname)
{
- PyFunctionObject *op = PyObject_GC_New(PyFunctionObject,
- &PyFunction_Type);
- static PyObject *__name__ = 0;
- if (op != NULL) {
- PyObject *doc;
- PyObject *consts;
- PyObject *module;
- op->func_weakreflist = NULL;
- Py_INCREF(code);
- op->func_code = code;
- Py_INCREF(globals);
- op->func_globals = globals;
- op->func_name = ((PyCodeObject *)code)->co_name;
- Py_INCREF(op->func_name);
- op->func_defaults = NULL; /* No default arguments */
- op->func_kwdefaults = NULL; /* No keyword only defaults */
- op->func_closure = NULL;
- consts = ((PyCodeObject *)code)->co_consts;
- if (PyTuple_Size(consts) >= 1) {
- doc = PyTuple_GetItem(consts, 0);
- if (!PyUnicode_Check(doc))
- doc = Py_None;
- }
- else
+ PyFunctionObject *op;
+ PyObject *doc, *consts, *module;
+ static PyObject *__name__ = NULL;
+
+ op = PyObject_GC_New(PyFunctionObject, &PyFunction_Type);
+ if (op == NULL)
+ return NULL;
+
+ op->func_weakreflist = NULL;
+ Py_INCREF(code);
+ op->func_code = code;
+ Py_INCREF(globals);
+ op->func_globals = globals;
+ op->func_name = ((PyCodeObject *)code)->co_name;
+ Py_INCREF(op->func_name);
+ op->func_defaults = NULL; /* No default arguments */
+ op->func_kwdefaults = NULL; /* No keyword only defaults */
+ op->func_closure = NULL;
+ consts = ((PyCodeObject *)code)->co_consts;
+ if (PyTuple_Size(consts) >= 1) {
+ doc = PyTuple_GetItem(consts, 0);
+ if (!PyUnicode_Check(doc))
doc = Py_None;
- Py_INCREF(doc);
- op->func_doc = doc;
- op->func_dict = NULL;
- op->func_module = NULL;
- op->func_annotations = NULL;
-
- /* __module__: If module name is in globals, use it.
- Otherwise, use None.
- */
+ }
+ else
+ doc = Py_None;
+ Py_INCREF(doc);
+ op->func_doc = doc;
+ op->func_dict = NULL;
+ op->func_module = NULL;
+ op->func_annotations = NULL;
+
+ /* __module__: If module name is in globals, use it.
+ Otherwise, use None.
+ */
+ if (!__name__) {
+ __name__ = PyUnicode_InternFromString("__name__");
if (!__name__) {
- __name__ = PyUnicode_InternFromString("__name__");
- if (!__name__) {
- Py_DECREF(op);
- return NULL;
- }
- }
- module = PyDict_GetItem(globals, __name__);
- if (module) {
- Py_INCREF(module);
- op->func_module = module;
+ Py_DECREF(op);
+ return NULL;
}
- if (qualname)
- op->func_qualname = qualname;
- else
- op->func_qualname = op->func_name;
- Py_INCREF(op->func_qualname);
}
+
+ module = PyDict_GetItem(globals, __name__);
+ if (module) {
+ Py_INCREF(module);
+ op->func_module = module;
+ }
+ if (qualname)
+ op->func_qualname = qualname;
else
- return NULL;
+ op->func_qualname = op->func_name;
+ Py_INCREF(op->func_qualname);
+
_PyObject_GC_TRACK(op);
return (PyObject *)op;
}