Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
ee238b97
Commit
ee238b97
authored
Jul 09, 2000
by
Fred Drake
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ANSI-fication of the sources.
parent
1b190b46
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
79 deletions
+33
-79
Objects/funcobject.c
Objects/funcobject.c
+11
-27
Objects/methodobject.c
Objects/methodobject.c
+13
-31
Objects/moduleobject.c
Objects/moduleobject.c
+9
-21
No files found.
Objects/funcobject.c
View file @
ee238b97
...
...
@@ -15,9 +15,7 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#include "structmember.h"
PyObject
*
PyFunction_New
(
code
,
globals
)
PyObject
*
code
;
PyObject
*
globals
;
PyFunction_New
(
PyObject
*
code
,
PyObject
*
globals
)
{
PyFunctionObject
*
op
=
PyObject_NEW
(
PyFunctionObject
,
&
PyFunction_Type
);
...
...
@@ -47,8 +45,7 @@ PyFunction_New(code, globals)
}
PyObject
*
PyFunction_GetCode
(
op
)
PyObject
*
op
;
PyFunction_GetCode
(
PyObject
*
op
)
{
if
(
!
PyFunction_Check
(
op
))
{
PyErr_BadInternalCall
();
...
...
@@ -58,8 +55,7 @@ PyFunction_GetCode(op)
}
PyObject
*
PyFunction_GetGlobals
(
op
)
PyObject
*
op
;
PyFunction_GetGlobals
(
PyObject
*
op
)
{
if
(
!
PyFunction_Check
(
op
))
{
PyErr_BadInternalCall
();
...
...
@@ -69,8 +65,7 @@ PyFunction_GetGlobals(op)
}
PyObject
*
PyFunction_GetDefaults
(
op
)
PyObject
*
op
;
PyFunction_GetDefaults
(
PyObject
*
op
)
{
if
(
!
PyFunction_Check
(
op
))
{
PyErr_BadInternalCall
();
...
...
@@ -80,9 +75,7 @@ PyFunction_GetDefaults(op)
}
int
PyFunction_SetDefaults
(
op
,
defaults
)
PyObject
*
op
;
PyObject
*
defaults
;
PyFunction_SetDefaults
(
PyObject
*
op
,
PyObject
*
defaults
)
{
if
(
!
PyFunction_Check
(
op
))
{
PyErr_BadInternalCall
();
...
...
@@ -118,9 +111,7 @@ static struct memberlist func_memberlist[] = {
};
static
PyObject
*
func_getattr
(
op
,
name
)
PyFunctionObject
*
op
;
char
*
name
;
func_getattr
(
PyFunctionObject
*
op
,
char
*
name
)
{
if
(
name
[
0
]
!=
'_'
&&
PyEval_GetRestricted
())
{
PyErr_SetString
(
PyExc_RuntimeError
,
...
...
@@ -131,10 +122,7 @@ func_getattr(op, name)
}
static
int
func_setattr
(
op
,
name
,
value
)
PyFunctionObject
*
op
;
char
*
name
;
PyObject
*
value
;
func_setattr
(
PyFunctionObject
*
op
,
char
*
name
,
PyObject
*
value
)
{
if
(
PyEval_GetRestricted
())
{
PyErr_SetString
(
PyExc_RuntimeError
,
...
...
@@ -163,8 +151,7 @@ func_setattr(op, name, value)
}
static
void
func_dealloc
(
op
)
PyFunctionObject
*
op
;
func_dealloc
(
PyFunctionObject
*
op
)
{
PyObject_GC_Fini
(
op
);
Py_DECREF
(
op
->
func_code
);
...
...
@@ -177,8 +164,7 @@ func_dealloc(op)
}
static
PyObject
*
func_repr
(
op
)
PyFunctionObject
*
op
;
func_repr
(
PyFunctionObject
*
op
)
{
char
buf
[
140
];
if
(
op
->
func_name
==
Py_None
)
...
...
@@ -191,8 +177,7 @@ func_repr(op)
}
static
int
func_compare
(
f
,
g
)
PyFunctionObject
*
f
,
*
g
;
func_compare
(
PyFunctionObject
*
f
,
PyFunctionObject
*
g
)
{
int
c
;
if
(
f
->
func_globals
!=
g
->
func_globals
)
...
...
@@ -210,8 +195,7 @@ func_compare(f, g)
}
static
long
func_hash
(
f
)
PyFunctionObject
*
f
;
func_hash
(
PyFunctionObject
*
f
)
{
long
h
,
x
;
h
=
PyObject_Hash
(
f
->
func_code
);
...
...
Objects/methodobject.c
View file @
ee238b97
...
...
@@ -17,9 +17,7 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
static
PyCFunctionObject
*
free_list
=
NULL
;
PyObject
*
PyCFunction_New
(
ml
,
self
)
PyMethodDef
*
ml
;
PyObject
*
self
;
PyCFunction_New
(
PyMethodDef
*
ml
,
PyObject
*
self
)
{
PyCFunctionObject
*
op
;
op
=
free_list
;
...
...
@@ -39,8 +37,7 @@ PyCFunction_New(ml, self)
}
PyCFunction
PyCFunction_GetFunction
(
op
)
PyObject
*
op
;
PyCFunction_GetFunction
(
PyObject
*
op
)
{
if
(
!
PyCFunction_Check
(
op
))
{
PyErr_BadInternalCall
();
...
...
@@ -50,8 +47,7 @@ PyCFunction_GetFunction(op)
}
PyObject
*
PyCFunction_GetSelf
(
op
)
PyObject
*
op
;
PyCFunction_GetSelf
(
PyObject
*
op
)
{
if
(
!
PyCFunction_Check
(
op
))
{
PyErr_BadInternalCall
();
...
...
@@ -61,8 +57,7 @@ PyCFunction_GetSelf(op)
}
int
PyCFunction_GetFlags
(
op
)
PyObject
*
op
;
PyCFunction_GetFlags
(
PyObject
*
op
)
{
if
(
!
PyCFunction_Check
(
op
))
{
PyErr_BadInternalCall
();
...
...
@@ -74,8 +69,7 @@ PyCFunction_GetFlags(op)
/* Methods (the standard built-in methods, that is) */
static
void
meth_dealloc
(
m
)
PyCFunctionObject
*
m
;
meth_dealloc
(
PyCFunctionObject
*
m
)
{
Py_XDECREF
(
m
->
m_self
);
m
->
m_self
=
(
PyObject
*
)
free_list
;
...
...
@@ -83,9 +77,7 @@ meth_dealloc(m)
}
static
PyObject
*
meth_getattr
(
m
,
name
)
PyCFunctionObject
*
m
;
char
*
name
;
meth_getattr
(
PyCFunctionObject
*
m
,
char
*
name
)
{
if
(
strcmp
(
name
,
"__name__"
)
==
0
)
{
return
PyString_FromString
(
m
->
m_ml
->
ml_name
);
...
...
@@ -119,8 +111,7 @@ meth_getattr(m, name)
}
static
PyObject
*
meth_repr
(
m
)
PyCFunctionObject
*
m
;
meth_repr
(
PyCFunctionObject
*
m
)
{
char
buf
[
200
];
if
(
m
->
m_self
==
NULL
)
...
...
@@ -134,8 +125,7 @@ meth_repr(m)
}
static
int
meth_compare
(
a
,
b
)
PyCFunctionObject
*
a
,
*
b
;
meth_compare
(
PyCFunctionObject
*
a
,
PyCFunctionObject
*
b
)
{
if
(
a
->
m_self
!=
b
->
m_self
)
return
(
a
->
m_self
<
b
->
m_self
)
?
-
1
:
1
;
...
...
@@ -148,8 +138,7 @@ meth_compare(a, b)
}
static
long
meth_hash
(
a
)
PyCFunctionObject
*
a
;
meth_hash
(
PyCFunctionObject
*
a
)
{
long
x
,
y
;
if
(
a
->
m_self
==
NULL
)
...
...
@@ -189,8 +178,7 @@ PyTypeObject PyCFunction_Type = {
/* List all methods in a chain -- helper for findmethodinchain */
static
PyObject
*
listmethodchain
(
chain
)
PyMethodChain
*
chain
;
listmethodchain
(
PyMethodChain
*
chain
)
{
PyMethodChain
*
c
;
PyMethodDef
*
ml
;
...
...
@@ -223,10 +211,7 @@ listmethodchain(chain)
/* Find a method in a method chain */
PyObject
*
Py_FindMethodInChain
(
chain
,
self
,
name
)
PyMethodChain
*
chain
;
PyObject
*
self
;
char
*
name
;
Py_FindMethodInChain
(
PyMethodChain
*
chain
,
PyObject
*
self
,
char
*
name
)
{
if
(
name
[
0
]
==
'_'
&&
name
[
1
]
==
'_'
)
{
if
(
strcmp
(
name
,
"__methods__"
)
==
0
)
...
...
@@ -253,10 +238,7 @@ Py_FindMethodInChain(chain, self, name)
/* Find a method in a single method list */
PyObject
*
Py_FindMethod
(
methods
,
self
,
name
)
PyMethodDef
*
methods
;
PyObject
*
self
;
char
*
name
;
Py_FindMethod
(
PyMethodDef
*
methods
,
PyObject
*
self
,
char
*
name
)
{
PyMethodChain
chain
;
chain
.
methods
=
methods
;
...
...
@@ -267,7 +249,7 @@ Py_FindMethod(methods, self, name)
/* Clear out the free list */
void
PyCFunction_Fini
()
PyCFunction_Fini
(
void
)
{
while
(
free_list
)
{
PyCFunctionObject
*
v
=
free_list
;
...
...
Objects/moduleobject.c
View file @
ee238b97
...
...
@@ -18,8 +18,7 @@ typedef struct {
}
PyModuleObject
;
PyObject
*
PyModule_New
(
name
)
char
*
name
;
PyModule_New
(
char
*
name
)
{
PyModuleObject
*
m
;
PyObject
*
nameobj
;
...
...
@@ -44,8 +43,7 @@ PyModule_New(name)
}
PyObject
*
PyModule_GetDict
(
m
)
PyObject
*
m
;
PyModule_GetDict
(
PyObject
*
m
)
{
if
(
!
PyModule_Check
(
m
))
{
PyErr_BadInternalCall
();
...
...
@@ -55,8 +53,7 @@ PyModule_GetDict(m)
}
char
*
PyModule_GetName
(
m
)
PyObject
*
m
;
PyModule_GetName
(
PyObject
*
m
)
{
PyObject
*
nameobj
;
if
(
!
PyModule_Check
(
m
))
{
...
...
@@ -73,8 +70,7 @@ PyModule_GetName(m)
}
char
*
PyModule_GetFilename
(
m
)
PyObject
*
m
;
PyModule_GetFilename
(
PyObject
*
m
)
{
PyObject
*
fileobj
;
if
(
!
PyModule_Check
(
m
))
{
...
...
@@ -91,8 +87,7 @@ PyModule_GetFilename(m)
}
void
_PyModule_Clear
(
m
)
PyObject
*
m
;
_PyModule_Clear
(
PyObject
*
m
)
{
/* To make the execution order of destructors for global
objects a bit more predictable, we first zap all objects
...
...
@@ -142,8 +137,7 @@ _PyModule_Clear(m)
/* Methods */
static
void
module_dealloc
(
m
)
PyModuleObject
*
m
;
module_dealloc
(
PyModuleObject
*
m
)
{
if
(
m
->
md_dict
!=
NULL
)
{
_PyModule_Clear
((
PyObject
*
)
m
);
...
...
@@ -153,8 +147,7 @@ module_dealloc(m)
}
static
PyObject
*
module_repr
(
m
)
PyModuleObject
*
m
;
module_repr
(
PyModuleObject
*
m
)
{
char
buf
[
400
];
char
*
name
;
...
...
@@ -176,9 +169,7 @@ module_repr(m)
}
static
PyObject
*
module_getattr
(
m
,
name
)
PyModuleObject
*
m
;
char
*
name
;
module_getattr
(
PyModuleObject
*
m
,
char
*
name
)
{
PyObject
*
res
;
if
(
strcmp
(
name
,
"__dict__"
)
==
0
)
{
...
...
@@ -194,10 +185,7 @@ module_getattr(m, name)
}
static
int
module_setattr
(
m
,
name
,
v
)
PyModuleObject
*
m
;
char
*
name
;
PyObject
*
v
;
module_setattr
(
PyModuleObject
*
m
,
char
*
name
,
PyObject
*
v
)
{
if
(
name
[
0
]
==
'_'
&&
strcmp
(
name
,
"__dict__"
)
==
0
)
{
PyErr_SetString
(
PyExc_TypeError
,
...
...
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