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
709fe068
Commit
709fe068
authored
Jul 22, 2000
by
Thomas Wouters
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Mass ANSIfication of function definitions. Doesn't cover all 'extern'
declarations yet, those come later.
parent
7595e273
Changes
45
Hide whitespace changes
Inline
Side-by-side
Showing
45 changed files
with
704 additions
and
1526 deletions
+704
-1526
Python/atof.c
Python/atof.c
+1
-2
Python/bltinmodule.c
Python/bltinmodule.c
+60
-179
Python/ceval.c
Python/ceval.c
+49
-112
Python/codecs.c
Python/codecs.c
+3
-3
Python/compile.c
Python/compile.c
+104
-324
Python/dup2.c
Python/dup2.c
+1
-2
Python/dynload_aix.c
Python/dynload_aix.c
+3
-7
Python/errors.c
Python/errors.c
+17
-51
Python/frozenmain.c
Python/frozenmain.c
+1
-3
Python/getargs.c
Python/getargs.c
+12
-95
Python/getcompiler.c
Python/getcompiler.c
+1
-1
Python/getcopyright.c
Python/getcopyright.c
+1
-1
Python/getcwd.c
Python/getcwd.c
+3
-7
Python/getmtime.c
Python/getmtime.c
+1
-3
Python/getopt.c
Python/getopt.c
+2
-5
Python/getplatform.c
Python/getplatform.c
+1
-1
Python/getversion.c
Python/getversion.c
+1
-1
Python/hypot.c
Python/hypot.c
+1
-3
Python/import.c
Python/import.c
+69
-179
Python/importdl.c
Python/importdl.c
+1
-4
Python/marshal.c
Python/marshal.c
+22
-59
Python/memmove.c
Python/memmove.c
+2
-5
Python/modsupport.c
Python/modsupport.c
+8
-68
Python/mystrtoul.c
Python/mystrtoul.c
+2
-8
Python/pyfpe.c
Python/pyfpe.c
+1
-2
Python/pystate.c
Python/pystate.c
+10
-17
Python/pythonrun.c
Python/pythonrun.c
+45
-94
Python/sigcheck.c
Python/sigcheck.c
+1
-1
Python/strdup.c
Python/strdup.c
+1
-2
Python/strerror.c
Python/strerror.c
+1
-2
Python/strtod.c
Python/strtod.c
+4
-6
Python/structmember.c
Python/structmember.c
+3
-11
Python/sysmodule.c
Python/sysmodule.c
+20
-77
Python/thread.c
Python/thread.c
+2
-13
Python/thread_cthread.h
Python/thread_cthread.h
+34
-17
Python/thread_foobar.h
Python/thread_foobar.h
+34
-17
Python/thread_lwp.h
Python/thread_lwp.h
+17
-17
Python/thread_nt.h
Python/thread_nt.h
+2
-2
Python/thread_os2.h
Python/thread_os2.h
+34
-17
Python/thread_pth.h
Python/thread_pth.h
+18
-18
Python/thread_pthread.h
Python/thread_pthread.h
+40
-21
Python/thread_sgi.h
Python/thread_sgi.h
+25
-25
Python/thread_solaris.h
Python/thread_solaris.h
+37
-20
Python/thread_wince.h
Python/thread_wince.h
+1
-1
Python/traceback.c
Python/traceback.c
+8
-23
No files found.
Python/atof.c
View file @
709fe068
...
...
@@ -17,8 +17,7 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#include <ctype.h>
double
atof
(
s
)
char
*
s
;
double
atof
(
char
*
s
)
{
double
a
=
0
.
0
;
int
e
=
0
;
...
...
Python/bltinmodule.c
View file @
709fe068
...
...
@@ -32,9 +32,7 @@ static PyObject *filterstring(PyObject *, PyObject *);
static
PyObject
*
filtertuple
(
PyObject
*
,
PyObject
*
);
static
PyObject
*
builtin___import__
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
builtin___import__
(
PyObject
*
self
,
PyObject
*
args
)
{
char
*
name
;
PyObject
*
globals
=
NULL
;
...
...
@@ -60,9 +58,7 @@ fromlist is not empty.";
static
PyObject
*
builtin_abs
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
builtin_abs
(
PyObject
*
self
,
PyObject
*
args
)
{
PyObject
*
v
;
...
...
@@ -78,9 +74,7 @@ Return the absolute value of the argument.";
static
PyObject
*
builtin_apply
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
builtin_apply
(
PyObject
*
self
,
PyObject
*
args
)
{
PyObject
*
func
,
*
alist
=
NULL
,
*
kwdict
=
NULL
;
PyObject
*
t
=
NULL
,
*
retval
=
NULL
;
...
...
@@ -120,9 +114,7 @@ Note that classes are callable, as are instances with a __call__() method.";
static
PyObject
*
builtin_buffer
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
builtin_buffer
(
PyObject
*
self
,
PyObject
*
args
)
{
PyObject
*
ob
;
int
offset
=
0
;
...
...
@@ -143,9 +135,7 @@ extend to the end of the target object (or with the specified size).";
static
PyObject
*
builtin_unicode
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
builtin_unicode
(
PyObject
*
self
,
PyObject
*
args
)
{
PyObject
*
v
;
char
*
encoding
=
NULL
;
...
...
@@ -165,9 +155,7 @@ errors, defining the error handling, to 'strict'.";
static
PyObject
*
builtin_callable
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
builtin_callable
(
PyObject
*
self
,
PyObject
*
args
)
{
PyObject
*
v
;
...
...
@@ -184,9 +172,7 @@ Note that classes are callable, as are instances with a __call__() method.";
static
PyObject
*
builtin_filter
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
builtin_filter
(
PyObject
*
self
,
PyObject
*
args
)
{
PyObject
*
func
,
*
seq
,
*
result
;
PySequenceMethods
*
sqf
;
...
...
@@ -291,9 +277,7 @@ is true. If function is None, return a list of items that are true.";
static
PyObject
*
builtin_chr
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
builtin_chr
(
PyObject
*
self
,
PyObject
*
args
)
{
long
x
;
char
s
[
1
];
...
...
@@ -316,9 +300,7 @@ Return a string of one character with ordinal i; 0 <= i < 256.";
static
PyObject
*
builtin_unichr
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
builtin_unichr
(
PyObject
*
self
,
PyObject
*
args
)
{
long
x
;
Py_UNICODE
s
[
1
];
...
...
@@ -341,9 +323,7 @@ Return a Unicode string of one character with ordinal i; 0 <= i < 65536.";
static
PyObject
*
builtin_cmp
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
builtin_cmp
(
PyObject
*
self
,
PyObject
*
args
)
{
PyObject
*
a
,
*
b
;
int
c
;
...
...
@@ -362,9 +342,7 @@ Return negative if x<y, zero if x==y, positive if x>y.";
static
PyObject
*
builtin_coerce
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
builtin_coerce
(
PyObject
*
self
,
PyObject
*
args
)
{
PyObject
*
v
,
*
w
;
PyObject
*
res
;
...
...
@@ -387,9 +365,7 @@ containing the coerced values. When they can't be coerced, return None.";
static
PyObject
*
builtin_compile
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
builtin_compile
(
PyObject
*
self
,
PyObject
*
args
)
{
char
*
str
;
char
*
filename
;
...
...
@@ -425,8 +401,7 @@ single (interactive) statement, or 'eval' to compile an expression.";
#ifndef WITHOUT_COMPLEX
static
PyObject
*
complex_from_string
(
v
)
PyObject
*
v
;
complex_from_string
(
PyObject
*
v
)
{
extern
double
strtod
(
const
char
*
,
char
**
);
const
char
*
s
,
*
start
;
...
...
@@ -579,9 +554,7 @@ complex_from_string(v)
}
static
PyObject
*
builtin_complex
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
builtin_complex
(
PyObject
*
self
,
PyObject
*
args
)
{
PyObject
*
r
,
*
i
,
*
tmp
;
PyNumberMethods
*
nbr
,
*
nbi
=
NULL
;
...
...
@@ -672,9 +645,7 @@ This is equivalent to (real + imag*1j) where imag defaults to 0.";
#endif
static
PyObject
*
builtin_dir
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
builtin_dir
(
PyObject
*
self
,
PyObject
*
args
)
{
static
char
*
attrlist
[]
=
{
"__members__"
,
"__methods__"
,
NULL
};
PyObject
*
v
=
NULL
,
*
l
=
NULL
,
*
m
=
NULL
;
...
...
@@ -748,9 +719,7 @@ returned. For other types or arguments, this may list members or methods.";
static
PyObject
*
builtin_divmod
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
builtin_divmod
(
PyObject
*
self
,
PyObject
*
args
)
{
PyObject
*
v
,
*
w
;
...
...
@@ -766,9 +735,7 @@ Return the tuple ((x-x%y)/y, x%y). Invariant: div*y + mod == x.";
static
PyObject
*
builtin_eval
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
builtin_eval
(
PyObject
*
self
,
PyObject
*
args
)
{
PyObject
*
cmd
;
PyObject
*
globals
=
Py_None
,
*
locals
=
Py_None
;
...
...
@@ -820,9 +787,7 @@ globals and locals. If only globals is given, locals defaults to it.";
static
PyObject
*
builtin_execfile
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
builtin_execfile
(
PyObject
*
self
,
PyObject
*
args
)
{
char
*
filename
;
PyObject
*
globals
=
Py_None
,
*
locals
=
Py_None
;
...
...
@@ -869,9 +834,7 @@ globals and locals. If only globals is given, locals defaults to it.";
static
PyObject
*
builtin_getattr
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
builtin_getattr
(
PyObject
*
self
,
PyObject
*
args
)
{
PyObject
*
v
,
*
result
,
*
dflt
=
NULL
;
PyObject
*
name
;
...
...
@@ -896,9 +859,7 @@ exist; without it, an exception is raised in that case.";
static
PyObject
*
builtin_globals
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
builtin_globals
(
PyObject
*
self
,
PyObject
*
args
)
{
PyObject
*
d
;
...
...
@@ -916,9 +877,7 @@ Return the dictionary containing the current scope's global variables.";
static
PyObject
*
builtin_hasattr
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
builtin_hasattr
(
PyObject
*
self
,
PyObject
*
args
)
{
PyObject
*
v
;
PyObject
*
name
;
...
...
@@ -944,9 +903,7 @@ Return whether the object has an attribute with the given name.\n\
static
PyObject
*
builtin_id
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
builtin_id
(
PyObject
*
self
,
PyObject
*
args
)
{
PyObject
*
v
;
...
...
@@ -963,9 +920,7 @@ simultaneously existing objects. (Hint: it's the object's memory address.)";
static
PyObject
*
builtin_map
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
builtin_map
(
PyObject
*
self
,
PyObject
*
args
)
{
typedef
struct
{
PyObject
*
seq
;
...
...
@@ -1130,9 +1085,7 @@ the items of the sequence (or a list of tuples if more than one sequence).";
static
PyObject
*
builtin_setattr
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
builtin_setattr
(
PyObject
*
self
,
PyObject
*
args
)
{
PyObject
*
v
;
PyObject
*
name
;
...
...
@@ -1154,9 +1107,7 @@ Set a named attribute on an object; setattr(x, 'y', v) is equivalent to\n\
static
PyObject
*
builtin_delattr
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
builtin_delattr
(
PyObject
*
self
,
PyObject
*
args
)
{
PyObject
*
v
;
PyObject
*
name
;
...
...
@@ -1177,9 +1128,7 @@ Delete a named attribute on an object; delattr(x, 'y') is equivalent to\n\
static
PyObject
*
builtin_hash
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
builtin_hash
(
PyObject
*
self
,
PyObject
*
args
)
{
PyObject
*
v
;
long
x
;
...
...
@@ -1200,9 +1149,7 @@ the same hash value. The reverse is not necessarily true, but likely.";
static
PyObject
*
builtin_hex
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
builtin_hex
(
PyObject
*
self
,
PyObject
*
args
)
{
PyObject
*
v
;
PyNumberMethods
*
nb
;
...
...
@@ -1228,9 +1175,7 @@ Return the hexadecimal representation of an integer or long integer.";
static
PyObject
*
builtin_raw_input
(
PyObject
*
,
PyObject
*
);
static
PyObject
*
builtin_input
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
builtin_input
(
PyObject
*
self
,
PyObject
*
args
)
{
PyObject
*
line
;
char
*
str
;
...
...
@@ -1263,9 +1208,7 @@ Equivalent to eval(raw_input(prompt)).";
static
PyObject
*
builtin_intern
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
builtin_intern
(
PyObject
*
self
,
PyObject
*
args
)
{
PyObject
*
s
;
if
(
!
PyArg_ParseTuple
(
args
,
"S:intern"
,
&
s
))
...
...
@@ -1285,9 +1228,7 @@ same value.";
static
PyObject
*
builtin_int
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
builtin_int
(
PyObject
*
self
,
PyObject
*
args
)
{
PyObject
*
v
;
int
base
=
-
909
;
/* unlikely! */
...
...
@@ -1320,9 +1261,7 @@ non-string.";
static
PyObject
*
builtin_long
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
builtin_long
(
PyObject
*
self
,
PyObject
*
args
)
{
PyObject
*
v
;
int
base
=
-
909
;
/* unlikely! */
...
...
@@ -1356,9 +1295,7 @@ converting a non-string.";
static
PyObject
*
builtin_float
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
builtin_float
(
PyObject
*
self
,
PyObject
*
args
)
{
PyObject
*
v
;
...
...
@@ -1376,9 +1313,7 @@ Convert a string or number to a floating point number, if possible.";
static
PyObject
*
builtin_len
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
builtin_len
(
PyObject
*
self
,
PyObject
*
args
)
{
PyObject
*
v
;
long
res
;
...
...
@@ -1398,9 +1333,7 @@ Return the number of items of a sequence or mapping.";
static
PyObject
*
builtin_list
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
builtin_list
(
PyObject
*
self
,
PyObject
*
args
)
{
PyObject
*
v
;
...
...
@@ -1416,9 +1349,7 @@ Return a new list whose items are the same as those of the argument sequence.";
static
PyObject
*
builtin_slice
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
builtin_slice
(
PyObject
*
self
,
PyObject
*
args
)
{
PyObject
*
start
,
*
stop
,
*
step
;
...
...
@@ -1443,9 +1374,7 @@ Create a slice object. This is used for slicing by the Numeric extensions.";
static
PyObject
*
builtin_locals
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
builtin_locals
(
PyObject
*
self
,
PyObject
*
args
)
{
PyObject
*
d
;
...
...
@@ -1463,9 +1392,7 @@ Return the dictionary containing the current scope's local variables.";
static
PyObject
*
min_max
(
args
,
sign
)
PyObject
*
args
;
int
sign
;
min_max
(
PyObject
*
args
,
int
sign
)
{
int
i
;
PyObject
*
v
,
*
w
,
*
x
;
...
...
@@ -1516,9 +1443,7 @@ min_max(args, sign)
}
static
PyObject
*
builtin_min
(
self
,
v
)
PyObject
*
self
;
PyObject
*
v
;
builtin_min
(
PyObject
*
self
,
PyObject
*
v
)
{
return
min_max
(
v
,
-
1
);
}
...
...
@@ -1532,9 +1457,7 @@ With two or more arguments, return the smallest argument.";
static
PyObject
*
builtin_max
(
self
,
v
)
PyObject
*
self
;
PyObject
*
v
;
builtin_max
(
PyObject
*
self
,
PyObject
*
v
)
{
return
min_max
(
v
,
1
);
}
...
...
@@ -1548,9 +1471,7 @@ With two or more arguments, return the largest argument.";
static
PyObject
*
builtin_oct
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
builtin_oct
(
PyObject
*
self
,
PyObject
*
args
)
{
PyObject
*
v
;
PyNumberMethods
*
nb
;
...
...
@@ -1573,9 +1494,7 @@ Return the octal representation of an integer or long integer.";
static
PyObject
*
builtin_open
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
builtin_open
(
PyObject
*
self
,
PyObject
*
args
)
{
char
*
name
;
char
*
mode
=
"r"
;
...
...
@@ -1603,9 +1522,7 @@ buffered, and larger numbers specify the buffer size.";
static
PyObject
*
builtin_ord
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
builtin_ord
(
PyObject
*
self
,
PyObject
*
args
)
{
PyObject
*
obj
;
long
ord
;
...
...
@@ -1644,9 +1561,7 @@ Return the integer ordinal of a one character string.";
static
PyObject
*
builtin_pow
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
builtin_pow
(
PyObject
*
self
,
PyObject
*
args
)
{
PyObject
*
v
,
*
w
,
*
z
=
Py_None
;
...
...
@@ -1695,9 +1610,7 @@ get_len_of_range(lo, hi, step)
}
static
PyObject
*
builtin_range
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
builtin_range
(
PyObject
*
self
,
PyObject
*
args
)
{
long
ilow
=
0
,
ihigh
=
0
,
istep
=
1
;
long
bign
;
...
...
@@ -1757,9 +1670,7 @@ These are exactly the valid indices for a list of 4 elements.";
static
PyObject
*
builtin_xrange
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
builtin_xrange
(
PyObject
*
self
,
PyObject
*
args
)
{
long
ilow
=
0
,
ihigh
=
0
,
istep
=
1
;
long
n
;
...
...
@@ -1801,9 +1712,7 @@ than range() but more memory efficient.";
static
PyObject
*
builtin_raw_input
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
builtin_raw_input
(
PyObject
*
self
,
PyObject
*
args
)
{
PyObject
*
v
=
NULL
;
PyObject
*
f
;
...
...
@@ -1880,9 +1789,7 @@ is printed without a trailing newline before reading.";
static
PyObject
*
builtin_reduce
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
builtin_reduce
(
PyObject
*
self
,
PyObject
*
args
)
{
PyObject
*
seq
,
*
func
,
*
result
=
NULL
;
PySequenceMethods
*
sqf
;
...
...
@@ -1956,9 +1863,7 @@ sequence is empty.";
static
PyObject
*
builtin_reload
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
builtin_reload
(
PyObject
*
self
,
PyObject
*
args
)
{
PyObject
*
v
;
...
...
@@ -1974,9 +1879,7 @@ Reload the module. The module must have been successfully imported before.";
static
PyObject
*
builtin_repr
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
builtin_repr
(
PyObject
*
self
,
PyObject
*
args
)
{
PyObject
*
v
;
...
...
@@ -1993,9 +1896,7 @@ For most object types, eval(repr(object)) == object.";
static
PyObject
*
builtin_round
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
builtin_round
(
PyObject
*
self
,
PyObject
*
args
)
{
double
x
;
double
f
;
...
...
@@ -2031,9 +1932,7 @@ This always returns a floating point number. Precision may be negative.";
static
PyObject
*
builtin_str
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
builtin_str
(
PyObject
*
self
,
PyObject
*
args
)
{
PyObject
*
v
;
...
...
@@ -2050,9 +1949,7 @@ If the argument is a string, the return value is the same object.";
static
PyObject
*
builtin_tuple
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
builtin_tuple
(
PyObject
*
self
,
PyObject
*
args
)
{
PyObject
*
v
;
...
...
@@ -2069,9 +1966,7 @@ If the argument is a tuple, the return value is the same object.";
static
PyObject
*
builtin_type
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
builtin_type
(
PyObject
*
self
,
PyObject
*
args
)
{
PyObject
*
v
;
...
...
@@ -2089,9 +1984,7 @@ Return the type of the object.";
static
PyObject
*
builtin_vars
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
builtin_vars
(
PyObject
*
self
,
PyObject
*
args
)
{
PyObject
*
v
=
NULL
;
PyObject
*
d
;
...
...
@@ -2126,11 +2019,7 @@ Without arguments, equivalent to locals().\n\
With an argument, equivalent to object.__dict__."
;
static
int
abstract_issubclass
(
derived
,
cls
,
err
,
first
)
PyObject
*
derived
;
PyObject
*
cls
;
char
*
err
;
int
first
;
abstract_issubclass
(
PyObject
*
derived
,
PyObject
*
cls
,
char
*
err
,
int
first
)
{
static
PyObject
*
__bases__
=
NULL
;
PyObject
*
bases
;
...
...
@@ -2177,9 +2066,7 @@ abstract_issubclass(derived, cls, err, first)
}
static
PyObject
*
builtin_isinstance
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
builtin_isinstance
(
PyObject
*
self
,
PyObject
*
args
)
{
PyObject
*
inst
;
PyObject
*
cls
;
...
...
@@ -2238,9 +2125,7 @@ With a type as second argument, return whether that is the object's type.";
static
PyObject
*
builtin_issubclass
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
builtin_issubclass
(
PyObject
*
self
,
PyObject
*
args
)
{
PyObject
*
derived
;
PyObject
*
cls
;
...
...
@@ -2336,7 +2221,7 @@ static char builtin_doc[] =
Noteworthy: None is the `nil' object; Ellipsis represents `...' in slices."
;
PyObject
*
_PyBuiltin_Init
()
_PyBuiltin_Init
(
void
)
{
PyObject
*
mod
,
*
dict
,
*
debug
;
mod
=
Py_InitModule4
(
"__builtin__"
,
builtin_methods
,
...
...
@@ -2362,9 +2247,7 @@ _PyBuiltin_Init()
/* Helper for filter(): filter a tuple through a function */
static
PyObject
*
filtertuple
(
func
,
tuple
)
PyObject
*
func
;
PyObject
*
tuple
;
filtertuple
(
PyObject
*
func
,
PyObject
*
tuple
)
{
PyObject
*
result
;
register
int
i
,
j
;
...
...
@@ -2420,9 +2303,7 @@ Fail_1:
/* Helper for filter(): filter a string through a function */
static
PyObject
*
filterstring
(
func
,
strobj
)
PyObject
*
func
;
PyObject
*
strobj
;
filterstring
(
PyObject
*
func
,
PyObject
*
strobj
)
{
PyObject
*
result
;
register
int
i
,
j
;
...
...
Python/ceval.c
View file @
709fe068
...
...
@@ -99,7 +99,7 @@ static PyThread_type_lock interpreter_lock = 0;
static
long
main_thread
=
0
;
void
PyEval_InitThreads
()
PyEval_InitThreads
(
void
)
{
if
(
interpreter_lock
)
return
;
...
...
@@ -110,20 +110,19 @@ PyEval_InitThreads()
}
void
PyEval_AcquireLock
()
PyEval_AcquireLock
(
void
)
{
PyThread_acquire_lock
(
interpreter_lock
,
1
);
}
void
PyEval_ReleaseLock
()
PyEval_ReleaseLock
(
void
)
{
PyThread_release_lock
(
interpreter_lock
);
}
void
PyEval_AcquireThread
(
tstate
)
PyThreadState
*
tstate
;
PyEval_AcquireThread
(
PyThreadState
*
tstate
)
{
if
(
tstate
==
NULL
)
Py_FatalError
(
"PyEval_AcquireThread: NULL new thread state"
);
...
...
@@ -134,8 +133,7 @@ PyEval_AcquireThread(tstate)
}
void
PyEval_ReleaseThread
(
tstate
)
PyThreadState
*
tstate
;
PyEval_ReleaseThread
(
PyThreadState
*
tstate
)
{
if
(
tstate
==
NULL
)
Py_FatalError
(
"PyEval_ReleaseThread: NULL thread state"
);
...
...
@@ -150,7 +148,7 @@ PyEval_ReleaseThread(tstate)
with and without threads: */
PyThreadState
*
PyEval_SaveThread
()
PyEval_SaveThread
(
void
)
{
PyThreadState
*
tstate
=
PyThreadState_Swap
(
NULL
);
if
(
tstate
==
NULL
)
...
...
@@ -163,8 +161,7 @@ PyEval_SaveThread()
}
void
PyEval_RestoreThread
(
tstate
)
PyThreadState
*
tstate
;
PyEval_RestoreThread
(
PyThreadState
*
tstate
)
{
if
(
tstate
==
NULL
)
Py_FatalError
(
"PyEval_RestoreThread: NULL tstate"
);
...
...
@@ -221,9 +218,7 @@ static volatile int pendinglast = 0;
static
volatile
int
things_to_do
=
0
;
int
Py_AddPendingCall
(
func
,
arg
)
int
(
*
func
)(
ANY
*
);
ANY
*
arg
;
Py_AddPendingCall
(
int
(
*
func
)(
ANY
*
),
ANY
*
arg
)
{
static
int
busy
=
0
;
int
i
,
j
;
...
...
@@ -247,7 +242,7 @@ Py_AddPendingCall(func, arg)
}
int
Py_MakePendingCalls
()
Py_MakePendingCalls
(
void
)
{
static
int
busy
=
0
;
#ifdef WITH_THREAD
...
...
@@ -294,10 +289,7 @@ static int unpack_sequence(PyObject *, int, PyObject **);
PyObject
*
PyEval_EvalCode
(
co
,
globals
,
locals
)
PyCodeObject
*
co
;
PyObject
*
globals
;
PyObject
*
locals
;
PyEval_EvalCode
(
PyCodeObject
*
co
,
PyObject
*
globals
,
PyObject
*
locals
)
{
return
eval_code2
(
co
,
globals
,
locals
,
...
...
@@ -315,18 +307,9 @@ PyEval_EvalCode(co, globals, locals)
#endif
static
PyObject
*
eval_code2
(
co
,
globals
,
locals
,
args
,
argcount
,
kws
,
kwcount
,
defs
,
defcount
,
owner
)
PyCodeObject
*
co
;
PyObject
*
globals
;
PyObject
*
locals
;
PyObject
**
args
;
int
argcount
;
PyObject
**
kws
;
/* length: 2*kwcount */
int
kwcount
;
PyObject
**
defs
;
int
defcount
;
PyObject
*
owner
;
eval_code2
(
PyCodeObject
*
co
,
PyObject
*
globals
,
PyObject
*
locals
,
PyObject
**
args
,
int
argcount
,
PyObject
**
kws
,
int
kwcount
,
PyObject
**
defs
,
int
defcount
,
PyObject
*
owner
)
{
#ifdef DXPAIRS
int
lastopcode
=
0
;
...
...
@@ -1920,11 +1903,7 @@ eval_code2(co, globals, locals,
}
static
void
set_exc_info
(
tstate
,
type
,
value
,
tb
)
PyThreadState
*
tstate
;
PyObject
*
type
;
PyObject
*
value
;
PyObject
*
tb
;
set_exc_info
(
PyThreadState
*
tstate
,
PyObject
*
type
,
PyObject
*
value
,
PyObject
*
tb
)
{
PyFrameObject
*
frame
;
PyObject
*
tmp_type
,
*
tmp_value
,
*
tmp_tb
;
...
...
@@ -1970,8 +1949,7 @@ set_exc_info(tstate, type, value, tb)
}
static
void
reset_exc_info
(
tstate
)
PyThreadState
*
tstate
;
reset_exc_info
(
PyThreadState
*
tstate
)
{
PyFrameObject
*
frame
;
PyObject
*
tmp_type
,
*
tmp_value
,
*
tmp_tb
;
...
...
@@ -2009,8 +1987,7 @@ reset_exc_info(tstate)
/* Logic for the raise statement (too complicated for inlining).
This *consumes* a reference count to each of its arguments. */
static
enum
why_code
do_raise
(
type
,
value
,
tb
)
PyObject
*
type
,
*
value
,
*
tb
;
do_raise
(
PyObject
*
type
,
PyObject
*
value
,
PyObject
*
tb
)
{
if
(
type
==
NULL
)
{
/* Reraise */
...
...
@@ -2109,10 +2086,7 @@ do_raise(type, value, tb)
}
static
int
unpack_sequence
(
v
,
argcnt
,
sp
)
PyObject
*
v
;
int
argcnt
;
PyObject
**
sp
;
unpack_sequence
(
PyObject
*
v
,
int
argcnt
,
PyObject
**
sp
)
{
int
i
;
PyObject
*
w
;
...
...
@@ -2148,9 +2122,7 @@ finally:
#ifdef LLTRACE
static
int
prtrace
(
v
,
str
)
PyObject
*
v
;
char
*
str
;
prtrace
(
PyObject
*
v
,
char
*
str
)
{
printf
(
"%s "
,
str
);
if
(
PyObject_Print
(
v
,
stdout
,
0
)
!=
0
)
...
...
@@ -2161,9 +2133,7 @@ prtrace(v, str)
#endif
static
void
call_exc_trace
(
p_trace
,
p_newtrace
,
f
)
PyObject
**
p_trace
,
**
p_newtrace
;
PyFrameObject
*
f
;
call_exc_trace
(
PyObject
**
p_trace
,
PyObject
**
p_newtrace
,
PyFrameObject
*
f
)
{
PyObject
*
type
,
*
value
,
*
traceback
,
*
arg
;
int
err
;
...
...
@@ -2188,16 +2158,15 @@ call_exc_trace(p_trace, p_newtrace, f)
}
}
/* PyObject **p_trace: in/out; may not be NULL;
may not point to NULL variable initially
PyObject **p_newtrace: in/out; may be NULL;
may point to NULL variable;
may be same variable as p_newtrace */
static
int
call_trace
(
p_trace
,
p_newtrace
,
f
,
msg
,
arg
)
PyObject
**
p_trace
;
/* in/out; may not be NULL;
may not point to NULL variable initially */
PyObject
**
p_newtrace
;
/* in/out; may be NULL;
may point to NULL variable;
may be same variable as p_newtrace */
PyFrameObject
*
f
;
char
*
msg
;
PyObject
*
arg
;
call_trace
(
PyObject
**
p_trace
,
PyObject
**
p_newtrace
,
PyFrameObject
*
f
,
char
*
msg
,
PyObject
*
arg
)
{
PyThreadState
*
tstate
=
f
->
f_tstate
;
PyObject
*
args
,
*
what
;
...
...
@@ -2267,7 +2236,7 @@ call_trace(p_trace, p_newtrace, f, msg, arg)
}
PyObject
*
PyEval_GetBuiltins
()
PyEval_GetBuiltins
(
void
)
{
PyThreadState
*
tstate
=
PyThreadState_Get
();
PyFrameObject
*
current_frame
=
tstate
->
frame
;
...
...
@@ -2278,7 +2247,7 @@ PyEval_GetBuiltins()
}
PyObject
*
PyEval_GetLocals
()
PyEval_GetLocals
(
void
)
{
PyFrameObject
*
current_frame
=
PyThreadState_Get
()
->
frame
;
if
(
current_frame
==
NULL
)
...
...
@@ -2288,7 +2257,7 @@ PyEval_GetLocals()
}
PyObject
*
PyEval_GetGlobals
()
PyEval_GetGlobals
(
void
)
{
PyFrameObject
*
current_frame
=
PyThreadState_Get
()
->
frame
;
if
(
current_frame
==
NULL
)
...
...
@@ -2298,21 +2267,21 @@ PyEval_GetGlobals()
}
PyObject
*
PyEval_GetFrame
()
PyEval_GetFrame
(
void
)
{
PyFrameObject
*
current_frame
=
PyThreadState_Get
()
->
frame
;
return
(
PyObject
*
)
current_frame
;
}
int
PyEval_GetRestricted
()
PyEval_GetRestricted
(
void
)
{
PyFrameObject
*
current_frame
=
PyThreadState_Get
()
->
frame
;
return
current_frame
==
NULL
?
0
:
current_frame
->
f_restricted
;
}
int
Py_FlushLine
()
Py_FlushLine
(
void
)
{
PyObject
*
f
=
PySys_GetObject
(
"stdout"
);
if
(
f
==
NULL
)
...
...
@@ -2330,9 +2299,7 @@ Py_FlushLine()
/* for backward compatibility: export this interface */
PyObject
*
PyEval_CallObject
(
func
,
arg
)
PyObject
*
func
;
PyObject
*
arg
;
PyEval_CallObject
(
PyObject
*
func
,
PyObject
*
arg
)
{
return
PyEval_CallObjectWithKeywords
(
func
,
arg
,
(
PyObject
*
)
NULL
);
}
...
...
@@ -2340,10 +2307,7 @@ PyEval_CallObject(func, arg)
PyEval_CallObjectWithKeywords(func, arg, (PyObject *)NULL)
PyObject
*
PyEval_CallObjectWithKeywords
(
func
,
arg
,
kw
)
PyObject
*
func
;
PyObject
*
arg
;
PyObject
*
kw
;
PyEval_CallObjectWithKeywords
(
PyObject
*
func
,
PyObject
*
arg
,
PyObject
*
kw
)
{
ternaryfunc
call
;
PyObject
*
result
;
...
...
@@ -2382,10 +2346,7 @@ PyEval_CallObjectWithKeywords(func, arg, kw)
}
static
PyObject
*
call_builtin
(
func
,
arg
,
kw
)
PyObject
*
func
;
PyObject
*
arg
;
PyObject
*
kw
;
call_builtin
(
PyObject
*
func
,
PyObject
*
arg
,
PyObject
*
kw
)
{
if
(
PyCFunction_Check
(
func
))
{
PyCFunction
meth
=
PyCFunction_GetFunction
(
func
);
...
...
@@ -2428,10 +2389,7 @@ call_builtin(func, arg, kw)
}
static
PyObject
*
call_function
(
func
,
arg
,
kw
)
PyObject
*
func
;
PyObject
*
arg
;
PyObject
*
kw
;
call_function
(
PyObject
*
func
,
PyObject
*
arg
,
PyObject
*
kw
)
{
PyObject
*
class
=
NULL
;
/* == owner */
PyObject
*
argdefs
;
...
...
@@ -2549,8 +2507,7 @@ call_function(func, arg, kw)
"standard sequence type does not support step size other than one"
static
PyObject
*
loop_subscript
(
v
,
w
)
PyObject
*
v
,
*
w
;
loop_subscript
(
PyObject
*
v
,
PyObject
*
w
)
{
PySequenceMethods
*
sq
=
v
->
ob_type
->
tp_as_sequence
;
int
i
;
...
...
@@ -2572,9 +2529,7 @@ loop_subscript(v, w)
and error. Returns 1 on success.*/
int
_PyEval_SliceIndex
(
v
,
pi
)
PyObject
*
v
;
int
*
pi
;
_PyEval_SliceIndex
(
PyObject
*
v
,
int
*
pi
)
{
if
(
v
!=
NULL
)
{
long
x
;
...
...
@@ -2627,8 +2582,7 @@ _PyEval_SliceIndex(v, pi)
}
static
PyObject
*
apply_slice
(
u
,
v
,
w
)
/* return u[v:w] */
PyObject
*
u
,
*
v
,
*
w
;
apply_slice
(
PyObject
*
u
,
PyObject
*
v
,
PyObject
*
w
)
/* return u[v:w] */
{
int
ilow
=
0
,
ihigh
=
INT_MAX
;
if
(
!
_PyEval_SliceIndex
(
v
,
&
ilow
))
...
...
@@ -2639,8 +2593,7 @@ apply_slice(u, v, w) /* return u[v:w] */
}
static
int
assign_slice
(
u
,
v
,
w
,
x
)
/* u[v:w] = x */
PyObject
*
u
,
*
v
,
*
w
,
*
x
;
assign_slice
(
PyObject
*
u
,
PyObject
*
v
,
PyObject
*
w
,
PyObject
*
x
)
/* u[v:w] = x */
{
int
ilow
=
0
,
ihigh
=
INT_MAX
;
if
(
!
_PyEval_SliceIndex
(
v
,
&
ilow
))
...
...
@@ -2654,10 +2607,7 @@ assign_slice(u, v, w, x) /* u[v:w] = x */
}
static
PyObject
*
cmp_outcome
(
op
,
v
,
w
)
int
op
;
register
PyObject
*
v
;
register
PyObject
*
w
;
cmp_outcome
(
int
op
,
register
PyObject
*
v
,
register
PyObject
*
w
)
{
register
int
cmp
;
register
int
res
=
0
;
...
...
@@ -2699,10 +2649,7 @@ cmp_outcome(op, v, w)
}
static
int
import_from
(
locals
,
v
,
name
)
PyObject
*
locals
;
PyObject
*
v
;
PyObject
*
name
;
import_from
(
PyObject
*
locals
,
PyObject
*
v
,
PyObject
*
name
)
{
PyObject
*
w
,
*
x
;
if
(
!
PyModule_Check
(
v
))
{
...
...
@@ -2741,10 +2688,7 @@ import_from(locals, v, name)
}
static
PyObject
*
build_class
(
methods
,
bases
,
name
)
PyObject
*
methods
;
/* dictionary */
PyObject
*
bases
;
/* tuple containing classes */
PyObject
*
name
;
/* string */
build_class
(
PyObject
*
methods
,
PyObject
*
bases
,
PyObject
*
name
)
{
int
i
,
n
;
if
(
!
PyTuple_Check
(
bases
))
{
...
...
@@ -2806,11 +2750,8 @@ build_class(methods, bases, name)
}
static
int
exec_statement
(
f
,
prog
,
globals
,
locals
)
PyFrameObject
*
f
;
PyObject
*
prog
;
PyObject
*
globals
;
PyObject
*
locals
;
exec_statement
(
PyFrameObject
*
f
,
PyObject
*
prog
,
PyObject
*
globals
,
PyObject
*
locals
)
{
int
n
;
PyObject
*
v
;
...
...
@@ -2874,9 +2815,7 @@ exec_statement(f, prog, globals, locals)
/* Hack for ni.py */
static
PyObject
*
find_from_args
(
f
,
nexti
)
PyFrameObject
*
f
;
int
nexti
;
find_from_args
(
PyFrameObject
*
f
,
int
nexti
)
{
int
opcode
;
int
oparg
;
...
...
@@ -2914,8 +2853,7 @@ find_from_args(f, nexti)
#ifdef DYNAMIC_EXECUTION_PROFILE
PyObject
*
getarray
(
a
)
long
a
[
256
];
getarray
(
long
a
[
256
])
{
int
i
;
PyObject
*
l
=
PyList_New
(
256
);
...
...
@@ -2934,8 +2872,7 @@ getarray(a)
}
PyObject
*
_Py_GetDXProfile
(
self
,
args
)
PyObject
*
self
,
*
args
;
_Py_GetDXProfile
(
PyObject
*
self
,
PyObject
*
args
)
{
#ifndef DXPAIRS
return
getarray
(
dxp
);
...
...
Python/codecs.c
View file @
709fe068
...
...
@@ -36,7 +36,7 @@ static int import_encodings_called = 0;
*/
static
int
import_encodings
(
)
int
import_encodings
(
void
)
{
PyObject
*
mod
;
...
...
@@ -419,7 +419,7 @@ PyObject *PyCodec_Decode(PyObject *object,
return
NULL
;
}
void
_PyCodecRegistry_Init
()
void
_PyCodecRegistry_Init
(
void
)
{
if
(
_PyCodec_SearchPath
==
NULL
)
_PyCodec_SearchPath
=
PyList_New
(
0
);
...
...
@@ -430,7 +430,7 @@ void _PyCodecRegistry_Init()
Py_FatalError
(
"can't initialize codec registry"
);
}
void
_PyCodecRegistry_Fini
()
void
_PyCodecRegistry_Fini
(
void
)
{
Py_XDECREF
(
_PyCodec_SearchPath
);
_PyCodec_SearchPath
=
NULL
;
...
...
Python/compile.c
View file @
709fe068
...
...
@@ -76,16 +76,13 @@ static struct memberlist code_memberlist[] = {
};
static
PyObject
*
code_getattr
(
co
,
name
)
PyCodeObject
*
co
;
char
*
name
;
code_getattr
(
PyCodeObject
*
co
,
char
*
name
)
{
return
PyMember_Get
((
char
*
)
co
,
code_memberlist
,
name
);
}
static
void
code_dealloc
(
co
)
PyCodeObject
*
co
;
code_dealloc
(
PyCodeObject
*
co
)
{
Py_XDECREF
(
co
->
co_code
);
Py_XDECREF
(
co
->
co_consts
);
...
...
@@ -98,8 +95,7 @@ code_dealloc(co)
}
static
PyObject
*
code_repr
(
co
)
PyCodeObject
*
co
;
code_repr
(
PyCodeObject
*
co
)
{
char
buf
[
500
];
int
lineno
=
-
1
;
...
...
@@ -118,8 +114,7 @@ code_repr(co)
}
static
int
code_compare
(
co
,
cp
)
PyCodeObject
*
co
,
*
cp
;
code_compare
(
PyCodeObject
*
co
,
PyCodeObject
*
cp
)
{
int
cmp
;
cmp
=
PyObject_Compare
(
co
->
co_name
,
cp
->
co_name
);
...
...
@@ -141,8 +136,7 @@ code_compare(co, cp)
}
static
long
code_hash
(
co
)
PyCodeObject
*
co
;
code_hash
(
PyCodeObject
*
co
)
{
long
h
,
h0
,
h1
,
h2
,
h3
,
h4
;
h0
=
PyObject_Hash
(
co
->
co_name
);
...
...
@@ -183,21 +177,10 @@ PyTypeObject PyCode_Type = {
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz"
PyCodeObject
*
PyCode_New
(
argcount
,
nlocals
,
stacksize
,
flags
,
code
,
consts
,
names
,
varnames
,
filename
,
name
,
firstlineno
,
lnotab
)
int
argcount
;
int
nlocals
;
int
stacksize
;
int
flags
;
PyObject
*
code
;
PyObject
*
consts
;
PyObject
*
names
;
PyObject
*
varnames
;
PyObject
*
filename
;
PyObject
*
name
;
int
firstlineno
;
PyObject
*
lnotab
;
PyCode_New
(
int
argcount
,
int
nlocals
,
int
stacksize
,
int
flags
,
PyObject
*
code
,
PyObject
*
consts
,
PyObject
*
names
,
PyObject
*
varnames
,
PyObject
*
filename
,
PyObject
*
name
,
int
firstlineno
,
PyObject
*
lnotab
)
{
PyCodeObject
*
co
;
int
i
;
...
...
@@ -317,10 +300,7 @@ struct compiling {
/* Error message including line number */
static
void
com_error
(
c
,
exc
,
msg
)
struct
compiling
*
c
;
PyObject
*
exc
;
char
*
msg
;
com_error
(
struct
compiling
*
c
,
PyObject
*
exc
,
char
*
msg
)
{
size_t
n
=
strlen
(
msg
);
PyObject
*
v
;
...
...
@@ -347,9 +327,7 @@ com_error(c, exc, msg)
/* Interface to the block stack */
static
void
block_push
(
c
,
type
)
struct
compiling
*
c
;
int
type
;
block_push
(
struct
compiling
*
c
,
int
type
)
{
if
(
c
->
c_nblocks
>=
CO_MAXBLOCKS
)
{
com_error
(
c
,
PyExc_SystemError
,
...
...
@@ -361,9 +339,7 @@ block_push(c, type)
}
static
void
block_pop
(
c
,
type
)
struct
compiling
*
c
;
int
type
;
block_pop
(
struct
compiling
*
c
,
int
type
)
{
if
(
c
->
c_nblocks
>
0
)
c
->
c_nblocks
--
;
...
...
@@ -401,9 +377,7 @@ static PyObject *parsestrplus(node *);
static
PyObject
*
parsestr
(
char
*
);
static
int
com_init
(
c
,
filename
)
struct
compiling
*
c
;
char
*
filename
;
com_init
(
struct
compiling
*
c
,
char
*
filename
)
{
memset
((
void
*
)
c
,
'\0'
,
sizeof
(
struct
compiling
));
if
((
c
->
c_code
=
PyString_FromStringAndSize
((
char
*
)
NULL
,
...
...
@@ -453,8 +427,7 @@ com_init(c, filename)
}
static
void
com_free
(
c
)
struct
compiling
*
c
;
com_free
(
struct
compiling
*
c
)
{
Py_XDECREF
(
c
->
c_code
);
Py_XDECREF
(
c
->
c_consts
);
...
...
@@ -468,9 +441,7 @@ com_free(c)
}
static
void
com_push
(
c
,
n
)
struct
compiling
*
c
;
int
n
;
com_push
(
struct
compiling
*
c
,
int
n
)
{
c
->
c_stacklevel
+=
n
;
if
(
c
->
c_stacklevel
>
c
->
c_maxstacklevel
)
...
...
@@ -478,9 +449,7 @@ com_push(c, n)
}
static
void
com_pop
(
c
,
n
)
struct
compiling
*
c
;
int
n
;
com_pop
(
struct
compiling
*
c
,
int
n
)
{
if
(
c
->
c_stacklevel
<
n
)
{
/* fprintf(stderr,
...
...
@@ -494,8 +463,7 @@ com_pop(c, n)
}
static
void
com_done
(
c
)
struct
compiling
*
c
;
com_done
(
struct
compiling
*
c
)
{
if
(
c
->
c_code
!=
NULL
)
_PyString_Resize
(
&
c
->
c_code
,
c
->
c_nexti
);
...
...
@@ -504,9 +472,7 @@ com_done(c)
}
static
void
com_addbyte
(
c
,
byte
)
struct
compiling
*
c
;
int
byte
;
com_addbyte
(
struct
compiling
*
c
,
int
byte
)
{
int
len
;
/*fprintf(stderr, "%3d: %3d\n", c->c_nexti, byte);*/
...
...
@@ -531,19 +497,14 @@ com_addbyte(c, byte)
}
static
void
com_addint
(
c
,
x
)
struct
compiling
*
c
;
int
x
;
com_addint
(
struct
compiling
*
c
,
int
x
)
{
com_addbyte
(
c
,
x
&
0xff
);
com_addbyte
(
c
,
x
>>
8
);
/* XXX x should be positive */
}
static
void
com_add_lnotab
(
c
,
addr
,
line
)
struct
compiling
*
c
;
int
addr
;
int
line
;
com_add_lnotab
(
struct
compiling
*
c
,
int
addr
,
int
line
)
{
int
size
;
char
*
p
;
...
...
@@ -563,9 +524,7 @@ com_add_lnotab(c, addr, line)
}
static
void
com_set_lineno
(
c
,
lineno
)
struct
compiling
*
c
;
int
lineno
;
com_set_lineno
(
struct
compiling
*
c
,
int
lineno
)
{
c
->
c_lineno
=
lineno
;
if
(
c
->
c_firstlineno
==
0
)
{
...
...
@@ -591,10 +550,7 @@ com_set_lineno(c, lineno)
}
static
void
com_addoparg
(
c
,
op
,
arg
)
struct
compiling
*
c
;
int
op
;
int
arg
;
com_addoparg
(
struct
compiling
*
c
,
int
op
,
int
arg
)
{
if
(
op
==
SET_LINENO
)
{
com_set_lineno
(
c
,
arg
);
...
...
@@ -606,10 +562,7 @@ com_addoparg(c, op, arg)
}
static
void
com_addfwref
(
c
,
op
,
p_anchor
)
struct
compiling
*
c
;
int
op
;
int
*
p_anchor
;
com_addfwref
(
struct
compiling
*
c
,
int
op
,
int
*
p_anchor
)
{
/* Compile a forward reference for backpatching */
int
here
;
...
...
@@ -622,9 +575,7 @@ com_addfwref(c, op, p_anchor)
}
static
void
com_backpatch
(
c
,
anchor
)
struct
compiling
*
c
;
int
anchor
;
/* Must be nonzero */
com_backpatch
(
struct
compiling
*
c
,
int
anchor
)
{
unsigned
char
*
code
=
(
unsigned
char
*
)
PyString_AsString
(
c
->
c_code
);
int
target
=
c
->
c_nexti
;
...
...
@@ -645,11 +596,7 @@ com_backpatch(c, anchor)
/* Handle literals and names uniformly */
static
int
com_add
(
c
,
list
,
dict
,
v
)
struct
compiling
*
c
;
PyObject
*
list
;
PyObject
*
dict
;
PyObject
*
v
;
com_add
(
struct
compiling
*
c
,
PyObject
*
list
,
PyObject
*
dict
,
PyObject
*
v
)
{
PyObject
*
w
,
*
t
,
*
np
=
NULL
;
long
n
;
...
...
@@ -681,28 +628,20 @@ com_add(c, list, dict, v)
}
static
int
com_addconst
(
c
,
v
)
struct
compiling
*
c
;
PyObject
*
v
;
com_addconst
(
struct
compiling
*
c
,
PyObject
*
v
)
{
return
com_add
(
c
,
c
->
c_consts
,
c
->
c_const_dict
,
v
);
}
static
int
com_addname
(
c
,
v
)
struct
compiling
*
c
;
PyObject
*
v
;
com_addname
(
struct
compiling
*
c
,
PyObject
*
v
)
{
return
com_add
(
c
,
c
->
c_names
,
c
->
c_name_dict
,
v
);
}
#ifdef PRIVATE_NAME_MANGLING
static
int
com_mangle
(
c
,
name
,
buffer
,
maxlen
)
struct
compiling
*
c
;
char
*
name
;
char
*
buffer
;
size_t
maxlen
;
com_mangle
(
struct
compiling
*
c
,
char
*
name
,
char
*
buffer
,
size_t
maxlen
)
{
/* Name mangling: __private becomes _classname__private.
This is independent from how the name is used. */
...
...
@@ -732,10 +671,7 @@ com_mangle(c, name, buffer, maxlen)
#endif
static
void
com_addopnamestr
(
c
,
op
,
name
)
struct
compiling
*
c
;
int
op
;
char
*
name
;
com_addopnamestr
(
struct
compiling
*
c
,
int
op
,
char
*
name
)
{
PyObject
*
v
;
int
i
;
...
...
@@ -771,10 +707,7 @@ com_addopnamestr(c, op, name)
}
static
void
com_addopname
(
c
,
op
,
n
)
struct
compiling
*
c
;
int
op
;
node
*
n
;
com_addopname
(
struct
compiling
*
c
,
int
op
,
node
*
n
)
{
char
*
name
;
char
buffer
[
1000
];
...
...
@@ -809,9 +742,7 @@ com_addopname(c, op, n)
}
static
PyObject
*
parsenumber
(
co
,
s
)
struct
compiling
*
co
;
char
*
s
;
parsenumber
(
struct
compiling
*
co
,
char
*
s
)
{
extern
double
atof
(
const
char
*
);
char
*
end
;
...
...
@@ -861,8 +792,7 @@ parsenumber(co, s)
}
static
PyObject
*
parsestr
(
s
)
char
*
s
;
parsestr
(
char
*
s
)
{
PyObject
*
v
;
size_t
len
;
...
...
@@ -975,8 +905,7 @@ parsestr(s)
}
static
PyObject
*
parsestrplus
(
n
)
node
*
n
;
parsestrplus
(
node
*
n
)
{
PyObject
*
v
;
int
i
;
...
...
@@ -1012,9 +941,7 @@ parsestrplus(n)
}
static
void
com_list_constructor
(
c
,
n
)
struct
compiling
*
c
;
node
*
n
;
com_list_constructor
(
struct
compiling
*
c
,
node
*
n
)
{
int
len
;
int
i
;
...
...
@@ -1029,9 +956,7 @@ com_list_constructor(c, n)
}
static
void
com_dictmaker
(
c
,
n
)
struct
compiling
*
c
;
node
*
n
;
com_dictmaker
(
struct
compiling
*
c
,
node
*
n
)
{
int
i
;
/* dictmaker: test ':' test (',' test ':' value)* [','] */
...
...
@@ -1049,9 +974,7 @@ com_dictmaker(c, n)
}
static
void
com_atom
(
c
,
n
)
struct
compiling
*
c
;
node
*
n
;
com_atom
(
struct
compiling
*
c
,
node
*
n
)
{
node
*
ch
;
PyObject
*
v
;
...
...
@@ -1121,10 +1044,7 @@ com_atom(c, n)
}
static
void
com_slice
(
c
,
n
,
op
)
struct
compiling
*
c
;
node
*
n
;
int
op
;
com_slice
(
struct
compiling
*
c
,
node
*
n
,
int
op
)
{
if
(
NCH
(
n
)
==
1
)
{
com_addbyte
(
c
,
op
);
...
...
@@ -1149,10 +1069,7 @@ com_slice(c, n, op)
}
static
void
com_argument
(
c
,
n
,
pkeywords
)
struct
compiling
*
c
;
node
*
n
;
/* argument */
PyObject
**
pkeywords
;
com_argument
(
struct
compiling
*
c
,
node
*
n
,
PyObject
**
pkeywords
)
{
node
*
m
;
REQ
(
n
,
argument
);
/* [test '='] test; really [keyword '='] test */
...
...
@@ -1196,9 +1113,7 @@ com_argument(c, n, pkeywords)
}
static
void
com_call_function
(
c
,
n
)
struct
compiling
*
c
;
node
*
n
;
/* EITHER arglist OR ')' */
com_call_function
(
struct
compiling
*
c
,
node
*
n
)
{
if
(
TYPE
(
n
)
==
RPAR
)
{
com_addoparg
(
c
,
CALL_FUNCTION
,
0
);
...
...
@@ -1254,17 +1169,13 @@ com_call_function(c, n)
}
static
void
com_select_member
(
c
,
n
)
struct
compiling
*
c
;
node
*
n
;
com_select_member
(
struct
compiling
*
c
,
node
*
n
)
{
com_addopname
(
c
,
LOAD_ATTR
,
n
);
}
static
void
com_sliceobj
(
c
,
n
)
struct
compiling
*
c
;
node
*
n
;
com_sliceobj
(
struct
compiling
*
c
,
node
*
n
)
{
int
i
=
0
;
int
ns
=
2
;
/* number of slice arguments */
...
...
@@ -1309,9 +1220,7 @@ com_sliceobj(c, n)
}
static
void
com_subscript
(
c
,
n
)
struct
compiling
*
c
;
node
*
n
;
com_subscript
(
struct
compiling
*
c
,
node
*
n
)
{
node
*
ch
;
REQ
(
n
,
subscript
);
...
...
@@ -1333,10 +1242,7 @@ com_subscript(c, n)
}
static
void
com_subscriptlist
(
c
,
n
,
assigning
)
struct
compiling
*
c
;
node
*
n
;
int
assigning
;
com_subscriptlist
(
struct
compiling
*
c
,
node
*
n
,
int
assigning
)
{
int
i
,
op
;
REQ
(
n
,
subscriptlist
);
...
...
@@ -1388,9 +1294,7 @@ com_subscriptlist(c, n, assigning)
}
static
void
com_apply_trailer
(
c
,
n
)
struct
compiling
*
c
;
node
*
n
;
com_apply_trailer
(
struct
compiling
*
c
,
node
*
n
)
{
REQ
(
n
,
trailer
);
switch
(
TYPE
(
CHILD
(
n
,
0
)))
{
...
...
@@ -1410,9 +1314,7 @@ com_apply_trailer(c, n)
}
static
void
com_power
(
c
,
n
)
struct
compiling
*
c
;
node
*
n
;
com_power
(
struct
compiling
*
c
,
node
*
n
)
{
int
i
;
REQ
(
n
,
power
);
...
...
@@ -1430,9 +1332,7 @@ com_power(c, n)
}
static
void
com_factor
(
c
,
n
)
struct
compiling
*
c
;
node
*
n
;
com_factor
(
struct
compiling
*
c
,
node
*
n
)
{
REQ
(
n
,
factor
);
if
(
TYPE
(
CHILD
(
n
,
0
))
==
PLUS
)
{
...
...
@@ -1453,9 +1353,7 @@ com_factor(c, n)
}
static
void
com_term
(
c
,
n
)
struct
compiling
*
c
;
node
*
n
;
com_term
(
struct
compiling
*
c
,
node
*
n
)
{
int
i
;
int
op
;
...
...
@@ -1484,9 +1382,7 @@ com_term(c, n)
}
static
void
com_arith_expr
(
c
,
n
)
struct
compiling
*
c
;
node
*
n
;
com_arith_expr
(
struct
compiling
*
c
,
node
*
n
)
{
int
i
;
int
op
;
...
...
@@ -1512,9 +1408,7 @@ com_arith_expr(c, n)
}
static
void
com_shift_expr
(
c
,
n
)
struct
compiling
*
c
;
node
*
n
;
com_shift_expr
(
struct
compiling
*
c
,
node
*
n
)
{
int
i
;
int
op
;
...
...
@@ -1540,9 +1434,7 @@ com_shift_expr(c, n)
}
static
void
com_and_expr
(
c
,
n
)
struct
compiling
*
c
;
node
*
n
;
com_and_expr
(
struct
compiling
*
c
,
node
*
n
)
{
int
i
;
int
op
;
...
...
@@ -1564,9 +1456,7 @@ com_and_expr(c, n)
}
static
void
com_xor_expr
(
c
,
n
)
struct
compiling
*
c
;
node
*
n
;
com_xor_expr
(
struct
compiling
*
c
,
node
*
n
)
{
int
i
;
int
op
;
...
...
@@ -1588,9 +1478,7 @@ com_xor_expr(c, n)
}
static
void
com_expr
(
c
,
n
)
struct
compiling
*
c
;
node
*
n
;
com_expr
(
struct
compiling
*
c
,
node
*
n
)
{
int
i
;
int
op
;
...
...
@@ -1612,8 +1500,7 @@ com_expr(c, n)
}
static
enum
cmp_op
cmp_type
(
n
)
node
*
n
;
cmp_type
(
node
*
n
)
{
REQ
(
n
,
comp_op
);
/* comp_op: '<' | '>' | '=' | '>=' | '<=' | '<>' | '!=' | '=='
...
...
@@ -1644,9 +1531,7 @@ cmp_type(n)
}
static
void
com_comparison
(
c
,
n
)
struct
compiling
*
c
;
node
*
n
;
com_comparison
(
struct
compiling
*
c
,
node
*
n
)
{
int
i
;
enum
cmp_op
op
;
...
...
@@ -1723,9 +1608,7 @@ com_comparison(c, n)
}
static
void
com_not_test
(
c
,
n
)
struct
compiling
*
c
;
node
*
n
;
com_not_test
(
struct
compiling
*
c
,
node
*
n
)
{
REQ
(
n
,
not_test
);
/* 'not' not_test | comparison */
if
(
NCH
(
n
)
==
1
)
{
...
...
@@ -1738,9 +1621,7 @@ com_not_test(c, n)
}
static
void
com_and_test
(
c
,
n
)
struct
compiling
*
c
;
node
*
n
;
com_and_test
(
struct
compiling
*
c
,
node
*
n
)
{
int
i
;
int
anchor
;
...
...
@@ -1760,9 +1641,7 @@ com_and_test(c, n)
}
static
void
com_test
(
c
,
n
)
struct
compiling
*
c
;
node
*
n
;
com_test
(
struct
compiling
*
c
,
node
*
n
)
{
REQ
(
n
,
test
);
/* and_test ('or' and_test)* | lambdef */
if
(
NCH
(
n
)
==
1
&&
TYPE
(
CHILD
(
n
,
0
))
==
lambdef
)
{
...
...
@@ -1800,10 +1679,7 @@ com_test(c, n)
}
static
void
com_list
(
c
,
n
,
toplevel
)
struct
compiling
*
c
;
node
*
n
;
int
toplevel
;
/* If nonzero, *always* build a tuple */
com_list
(
struct
compiling
*
c
,
node
*
n
,
int
toplevel
)
{
/* exprlist: expr (',' expr)* [',']; likewise for testlist */
if
(
NCH
(
n
)
==
1
&&
!
toplevel
)
{
...
...
@@ -1827,20 +1703,14 @@ static void com_assign_name(struct compiling *, node *, int);
static
void
com_assign
(
struct
compiling
*
,
node
*
,
int
);
static
void
com_assign_attr
(
c
,
n
,
assigning
)
struct
compiling
*
c
;
node
*
n
;
int
assigning
;
com_assign_attr
(
struct
compiling
*
c
,
node
*
n
,
int
assigning
)
{
com_addopname
(
c
,
assigning
?
STORE_ATTR
:
DELETE_ATTR
,
n
);
com_pop
(
c
,
assigning
?
2
:
1
);
}
static
void
com_assign_trailer
(
c
,
n
,
assigning
)
struct
compiling
*
c
;
node
*
n
;
int
assigning
;
com_assign_trailer
(
struct
compiling
*
c
,
node
*
n
,
int
assigning
)
{
REQ
(
n
,
trailer
);
switch
(
TYPE
(
CHILD
(
n
,
0
)))
{
...
...
@@ -1860,10 +1730,7 @@ com_assign_trailer(c, n, assigning)
}
static
void
com_assign_tuple
(
c
,
n
,
assigning
)
struct
compiling
*
c
;
node
*
n
;
int
assigning
;
com_assign_tuple
(
struct
compiling
*
c
,
node
*
n
,
int
assigning
)
{
int
i
;
if
(
TYPE
(
n
)
!=
testlist
)
...
...
@@ -1878,10 +1745,7 @@ com_assign_tuple(c, n, assigning)
}
static
void
com_assign_list
(
c
,
n
,
assigning
)
struct
compiling
*
c
;
node
*
n
;
int
assigning
;
com_assign_list
(
struct
compiling
*
c
,
node
*
n
,
int
assigning
)
{
int
i
;
if
(
assigning
)
{
...
...
@@ -1894,10 +1758,7 @@ com_assign_list(c, n, assigning)
}
static
void
com_assign_name
(
c
,
n
,
assigning
)
struct
compiling
*
c
;
node
*
n
;
int
assigning
;
com_assign_name
(
struct
compiling
*
c
,
node
*
n
,
int
assigning
)
{
REQ
(
n
,
NAME
);
com_addopname
(
c
,
assigning
?
STORE_NAME
:
DELETE_NAME
,
n
);
...
...
@@ -1906,10 +1767,7 @@ com_assign_name(c, n, assigning)
}
static
void
com_assign
(
c
,
n
,
assigning
)
struct
compiling
*
c
;
node
*
n
;
int
assigning
;
com_assign
(
struct
compiling
*
c
,
node
*
n
,
int
assigning
)
{
/* Loop to avoid trivial recursion */
for
(;;)
{
...
...
@@ -2016,9 +1874,7 @@ com_assign(c, n, assigning)
/* Forward */
static
node
*
get_rawdocstring
(
node
*
);
static
void
com_expr_stmt
(
c
,
n
)
struct
compiling
*
c
;
node
*
n
;
com_expr_stmt
(
struct
compiling
*
c
,
node
*
n
)
{
REQ
(
n
,
expr_stmt
);
/* testlist ('=' testlist)* */
/* Forget it if we have just a doc string here */
...
...
@@ -2045,9 +1901,7 @@ com_expr_stmt(c, n)
}
static
void
com_assert_stmt
(
c
,
n
)
struct
compiling
*
c
;
node
*
n
;
com_assert_stmt
(
struct
compiling
*
c
,
node
*
n
)
{
int
a
=
0
,
b
=
0
;
int
i
;
...
...
@@ -2087,9 +1941,7 @@ com_assert_stmt(c, n)
}
static
void
com_print_stmt
(
c
,
n
)
struct
compiling
*
c
;
node
*
n
;
com_print_stmt
(
struct
compiling
*
c
,
node
*
n
)
{
int
i
;
REQ
(
n
,
print_stmt
);
/* 'print' (test ',')* [test] */
...
...
@@ -2104,9 +1956,7 @@ com_print_stmt(c, n)
}
static
void
com_return_stmt
(
c
,
n
)
struct
compiling
*
c
;
node
*
n
;
com_return_stmt
(
struct
compiling
*
c
,
node
*
n
)
{
REQ
(
n
,
return_stmt
);
/* 'return' [testlist] */
if
(
!
c
->
c_infunction
)
{
...
...
@@ -2123,9 +1973,7 @@ com_return_stmt(c, n)
}
static
void
com_raise_stmt
(
c
,
n
)
struct
compiling
*
c
;
node
*
n
;
com_raise_stmt
(
struct
compiling
*
c
,
node
*
n
)
{
int
i
;
REQ
(
n
,
raise_stmt
);
/* 'raise' [test [',' test [',' test]]] */
...
...
@@ -2143,9 +1991,7 @@ com_raise_stmt(c, n)
}
static
void
com_import_stmt
(
c
,
n
)
struct
compiling
*
c
;
node
*
n
;
com_import_stmt
(
struct
compiling
*
c
,
node
*
n
)
{
int
i
;
REQ
(
n
,
import_stmt
);
...
...
@@ -2174,9 +2020,7 @@ com_import_stmt(c, n)
}
static
void
com_global_stmt
(
c
,
n
)
struct
compiling
*
c
;
node
*
n
;
com_global_stmt
(
struct
compiling
*
c
,
node
*
n
)
{
int
i
;
REQ
(
n
,
global_stmt
);
...
...
@@ -2200,9 +2044,7 @@ com_global_stmt(c, n)
}
static
int
com_newlocal_o
(
c
,
nameval
)
struct
compiling
*
c
;
PyObject
*
nameval
;
com_newlocal_o
(
struct
compiling
*
c
,
PyObject
*
nameval
)
{
int
i
;
PyObject
*
ival
;
...
...
@@ -2226,9 +2068,7 @@ com_newlocal_o(c, nameval)
}
static
int
com_addlocal_o
(
c
,
nameval
)
struct
compiling
*
c
;
PyObject
*
nameval
;
com_addlocal_o
(
struct
compiling
*
c
,
PyObject
*
nameval
)
{
PyObject
*
ival
=
PyDict_GetItem
(
c
->
c_locals
,
nameval
);
if
(
ival
!=
NULL
)
...
...
@@ -2237,9 +2077,7 @@ com_addlocal_o(c, nameval)
}
static
int
com_newlocal
(
c
,
name
)
struct
compiling
*
c
;
char
*
name
;
com_newlocal
(
struct
compiling
*
c
,
char
*
name
)
{
PyObject
*
nameval
=
PyString_InternFromString
(
name
);
int
i
;
...
...
@@ -2253,9 +2091,7 @@ com_newlocal(c, name)
}
static
void
com_exec_stmt
(
c
,
n
)
struct
compiling
*
c
;
node
*
n
;
com_exec_stmt
(
struct
compiling
*
c
,
node
*
n
)
{
REQ
(
n
,
exec_stmt
);
/* exec_stmt: 'exec' expr ['in' expr [',' expr]] */
...
...
@@ -2277,9 +2113,7 @@ com_exec_stmt(c, n)
}
static
int
is_constant_false
(
c
,
n
)
struct
compiling
*
c
;
node
*
n
;
is_constant_false
(
struct
compiling
*
c
,
node
*
n
)
{
PyObject
*
v
;
int
i
;
...
...
@@ -2361,9 +2195,7 @@ is_constant_false(c, n)
}
static
void
com_if_stmt
(
c
,
n
)
struct
compiling
*
c
;
node
*
n
;
com_if_stmt
(
struct
compiling
*
c
,
node
*
n
)
{
int
i
;
int
anchor
=
0
;
...
...
@@ -2393,9 +2225,7 @@ com_if_stmt(c, n)
}
static
void
com_while_stmt
(
c
,
n
)
struct
compiling
*
c
;
node
*
n
;
com_while_stmt
(
struct
compiling
*
c
,
node
*
n
)
{
int
break_anchor
=
0
;
int
anchor
=
0
;
...
...
@@ -2425,9 +2255,7 @@ com_while_stmt(c, n)
}
static
void
com_for_stmt
(
c
,
n
)
struct
compiling
*
c
;
node
*
n
;
com_for_stmt
(
struct
compiling
*
c
,
node
*
n
)
{
PyObject
*
v
;
int
break_anchor
=
0
;
...
...
@@ -2530,9 +2358,7 @@ com_for_stmt(c, n)
*/
static
void
com_try_except
(
c
,
n
)
struct
compiling
*
c
;
node
*
n
;
com_try_except
(
struct
compiling
*
c
,
node
*
n
)
{
int
except_anchor
=
0
;
int
end_anchor
=
0
;
...
...
@@ -2601,9 +2427,7 @@ com_try_except(c, n)
}
static
void
com_try_finally
(
c
,
n
)
struct
compiling
*
c
;
node
*
n
;
com_try_finally
(
struct
compiling
*
c
,
node
*
n
)
{
int
finally_anchor
=
0
;
node
*
ch
;
...
...
@@ -2630,9 +2454,7 @@ com_try_finally(c, n)
}
static
void
com_try_stmt
(
c
,
n
)
struct
compiling
*
c
;
node
*
n
;
com_try_stmt
(
struct
compiling
*
c
,
node
*
n
)
{
REQ
(
n
,
try_stmt
);
/* 'try' ':' suite (except_clause ':' suite)+ ['else' ':' suite]
...
...
@@ -2644,8 +2466,7 @@ com_try_stmt(c, n)
}
static
node
*
get_rawdocstring
(
n
)
node
*
n
;
get_rawdocstring
(
node
*
n
)
{
int
i
;
...
...
@@ -2705,8 +2526,7 @@ get_rawdocstring(n)
}
static
PyObject
*
get_docstring
(
n
)
node
*
n
;
get_docstring
(
node
*
n
)
{
/* Don't generate doc-strings if run with -OO */
if
(
Py_OptimizeFlag
>
1
)
...
...
@@ -2718,9 +2538,7 @@ get_docstring(n)
}
static
void
com_suite
(
c
,
n
)
struct
compiling
*
c
;
node
*
n
;
com_suite
(
struct
compiling
*
c
,
node
*
n
)
{
REQ
(
n
,
suite
);
/* simple_stmt | NEWLINE INDENT NEWLINE* (stmt NEWLINE*)+ DEDENT */
...
...
@@ -2739,9 +2557,7 @@ com_suite(c, n)
/* ARGSUSED */
static
void
com_continue_stmt
(
c
,
n
)
struct
compiling
*
c
;
node
*
n
;
/* Not used, but passed for consistency */
com_continue_stmt
(
struct
compiling
*
c
,
node
*
n
)
{
int
i
=
c
->
c_nblocks
;
if
(
i
--
>
0
&&
c
->
c_block
[
i
]
==
SETUP_LOOP
)
{
...
...
@@ -2756,9 +2572,7 @@ com_continue_stmt(c, n)
}
static
int
com_argdefs
(
c
,
n
)
struct
compiling
*
c
;
node
*
n
;
com_argdefs
(
struct
compiling
*
c
,
node
*
n
)
{
int
i
,
nch
,
nargs
,
ndefs
;
if
(
TYPE
(
n
)
==
lambdef
)
{
...
...
@@ -2812,9 +2626,7 @@ com_argdefs(c, n)
}
static
void
com_funcdef
(
c
,
n
)
struct
compiling
*
c
;
node
*
n
;
com_funcdef
(
struct
compiling
*
c
,
node
*
n
)
{
PyObject
*
v
;
REQ
(
n
,
funcdef
);
/* funcdef: 'def' NAME parameters ':' suite */
...
...
@@ -2835,9 +2647,7 @@ com_funcdef(c, n)
}
static
void
com_bases
(
c
,
n
)
struct
compiling
*
c
;
node
*
n
;
com_bases
(
struct
compiling
*
c
,
node
*
n
)
{
int
i
;
REQ
(
n
,
testlist
);
...
...
@@ -2850,9 +2660,7 @@ com_bases(c, n)
}
static
void
com_classdef
(
c
,
n
)
struct
compiling
*
c
;
node
*
n
;
com_classdef
(
struct
compiling
*
c
,
node
*
n
)
{
int
i
;
PyObject
*
v
;
...
...
@@ -2891,9 +2699,7 @@ com_classdef(c, n)
}
static
void
com_node
(
c
,
n
)
struct
compiling
*
c
;
node
*
n
;
com_node
(
struct
compiling
*
c
,
node
*
n
)
{
switch
(
TYPE
(
n
))
{
...
...
@@ -3044,9 +2850,7 @@ com_node(c, n)
static
void
com_fplist
(
struct
compiling
*
,
node
*
);
static
void
com_fpdef
(
c
,
n
)
struct
compiling
*
c
;
node
*
n
;
com_fpdef
(
struct
compiling
*
c
,
node
*
n
)
{
REQ
(
n
,
fpdef
);
/* fpdef: NAME | '(' fplist ')' */
if
(
TYPE
(
CHILD
(
n
,
0
))
==
LPAR
)
...
...
@@ -3058,9 +2862,7 @@ com_fpdef(c, n)
}
static
void
com_fplist
(
c
,
n
)
struct
compiling
*
c
;
node
*
n
;
com_fplist
(
struct
compiling
*
c
,
node
*
n
)
{
REQ
(
n
,
fplist
);
/* fplist: fpdef (',' fpdef)* [','] */
if
(
NCH
(
n
)
==
1
)
{
...
...
@@ -3076,9 +2878,7 @@ com_fplist(c, n)
}
static
void
com_arglist
(
c
,
n
)
struct
compiling
*
c
;
node
*
n
;
com_arglist
(
struct
compiling
*
c
,
node
*
n
)
{
int
nch
,
i
;
int
complex
=
0
;
...
...
@@ -3181,9 +2981,7 @@ com_arglist(c, n)
}
static
void
com_file_input
(
c
,
n
)
struct
compiling
*
c
;
node
*
n
;
com_file_input
(
struct
compiling
*
c
,
node
*
n
)
{
int
i
;
PyObject
*
doc
;
...
...
@@ -3207,9 +3005,7 @@ com_file_input(c, n)
/* Top-level compile-node interface */
static
void
compile_funcdef
(
c
,
n
)
struct
compiling
*
c
;
node
*
n
;
compile_funcdef
(
struct
compiling
*
c
,
node
*
n
)
{
PyObject
*
doc
;
node
*
ch
;
...
...
@@ -3236,9 +3032,7 @@ compile_funcdef(c, n)
}
static
void
compile_lambdef
(
c
,
n
)
struct
compiling
*
c
;
node
*
n
;
compile_lambdef
(
struct
compiling
*
c
,
node
*
n
)
{
node
*
ch
;
REQ
(
n
,
lambdef
);
/* lambdef: 'lambda' [varargslist] ':' test */
...
...
@@ -3258,9 +3052,7 @@ compile_lambdef(c, n)
}
static
void
compile_classdef
(
c
,
n
)
struct
compiling
*
c
;
node
*
n
;
compile_classdef
(
struct
compiling
*
c
,
node
*
n
)
{
node
*
ch
;
PyObject
*
doc
;
...
...
@@ -3290,9 +3082,7 @@ compile_classdef(c, n)
}
static
void
compile_node
(
c
,
n
)
struct
compiling
*
c
;
node
*
n
;
compile_node
(
struct
compiling
*
c
,
node
*
n
)
{
com_addoparg
(
c
,
SET_LINENO
,
n
->
n_lineno
);
...
...
@@ -3369,8 +3159,7 @@ compile_node(c, n)
NB: this modifies the string object c->c_code! */
static
void
optimize
(
c
)
struct
compiling
*
c
;
optimize
(
struct
compiling
*
c
)
{
unsigned
char
*
next_instr
,
*
cur_instr
;
int
opcode
;
...
...
@@ -3446,26 +3235,19 @@ optimize(c)
}
PyCodeObject
*
PyNode_Compile
(
n
,
filename
)
node
*
n
;
char
*
filename
;
PyNode_Compile
(
node
*
n
,
char
*
filename
)
{
return
jcompile
(
n
,
filename
,
NULL
);
}
static
PyCodeObject
*
icompile
(
n
,
base
)
node
*
n
;
struct
compiling
*
base
;
icompile
(
node
*
n
,
struct
compiling
*
base
)
{
return
jcompile
(
n
,
base
->
c_filename
,
base
);
}
static
PyCodeObject
*
jcompile
(
n
,
filename
,
base
)
node
*
n
;
char
*
filename
;
struct
compiling
*
base
;
jcompile
(
node
*
n
,
char
*
filename
,
struct
compiling
*
base
)
{
struct
compiling
sc
;
PyCodeObject
*
co
;
...
...
@@ -3517,9 +3299,7 @@ jcompile(n, filename, base)
}
int
PyCode_Addr2Line
(
co
,
addrq
)
PyCodeObject
*
co
;
int
addrq
;
PyCode_Addr2Line
(
PyCodeObject
*
co
,
int
addrq
)
{
int
size
=
PyString_Size
(
co
->
co_lnotab
)
/
2
;
unsigned
char
*
p
=
(
unsigned
char
*
)
PyString_AsString
(
co
->
co_lnotab
);
...
...
Python/dup2.c
View file @
709fe068
...
...
@@ -16,8 +16,7 @@
#define BADEXIT -1
int
dup2
(
fd1
,
fd2
)
int
fd1
,
fd2
;
dup2
(
int
fd1
,
int
fd2
)
{
if
(
fd1
!=
fd2
)
{
if
(
fcntl
(
fd1
,
F_GETFL
)
<
0
)
...
...
Python/dynload_aix.c
View file @
709fe068
...
...
@@ -42,8 +42,7 @@ const struct filedescr _PyImport_DynLoadFiletab[] = {
};
static
int
aix_getoldmodules
(
modlistptr
)
void
**
modlistptr
;
aix_getoldmodules
(
void
**
modlistptr
)
{
register
ModulePtr
modptr
,
prevmodptr
;
register
struct
ld_info
*
ldiptr
;
...
...
@@ -115,9 +114,7 @@ aix_getoldmodules(modlistptr)
}
static
int
aix_bindnewmodule
(
newmoduleptr
,
modlistptr
)
void
*
newmoduleptr
;
void
*
modlistptr
;
aix_bindnewmodule
(
void
*
newmoduleptr
,
void
*
modlistptr
)
{
register
ModulePtr
modptr
;
...
...
@@ -131,8 +128,7 @@ aix_bindnewmodule(newmoduleptr, modlistptr)
}
static
void
aix_loaderror
(
pathname
)
char
*
pathname
;
aix_loaderror
(
char
*
pathname
)
{
char
*
message
[
1024
],
errbuf
[
1024
];
...
...
Python/errors.c
View file @
709fe068
...
...
@@ -30,10 +30,7 @@ extern char *strerror(int);
#endif
void
PyErr_Restore
(
type
,
value
,
traceback
)
PyObject
*
type
;
PyObject
*
value
;
PyObject
*
traceback
;
PyErr_Restore
(
PyObject
*
type
,
PyObject
*
value
,
PyObject
*
traceback
)
{
PyThreadState
*
tstate
=
PyThreadState_GET
();
PyObject
*
oldtype
,
*
oldvalue
,
*
oldtraceback
;
...
...
@@ -60,9 +57,7 @@ PyErr_Restore(type, value, traceback)
}
void
PyErr_SetObject
(
exception
,
value
)
PyObject
*
exception
;
PyObject
*
value
;
PyErr_SetObject
(
PyObject
*
exception
,
PyObject
*
value
)
{
Py_XINCREF
(
exception
);
Py_XINCREF
(
value
);
...
...
@@ -70,16 +65,13 @@ PyErr_SetObject(exception, value)
}
void
PyErr_SetNone
(
exception
)
PyObject
*
exception
;
PyErr_SetNone
(
PyObject
*
exception
)
{
PyErr_SetObject
(
exception
,
(
PyObject
*
)
NULL
);
}
void
PyErr_SetString
(
exception
,
string
)
PyObject
*
exception
;
const
char
*
string
;
PyErr_SetString
(
PyObject
*
exception
,
const
char
*
string
)
{
PyObject
*
value
=
PyString_FromString
(
string
);
PyErr_SetObject
(
exception
,
value
);
...
...
@@ -88,7 +80,7 @@ PyErr_SetString(exception, string)
PyObject
*
PyErr_Occurred
()
PyErr_Occurred
(
void
)
{
PyThreadState
*
tstate
=
PyThreadState_Get
();
...
...
@@ -97,8 +89,7 @@ PyErr_Occurred()
int
PyErr_GivenExceptionMatches
(
err
,
exc
)
PyObject
*
err
,
*
exc
;
PyErr_GivenExceptionMatches
(
PyObject
*
err
,
PyObject
*
exc
)
{
if
(
err
==
NULL
||
exc
==
NULL
)
{
/* maybe caused by "import exceptions" that failed early on */
...
...
@@ -129,8 +120,7 @@ PyErr_GivenExceptionMatches(err, exc)
int
PyErr_ExceptionMatches
(
exc
)
PyObject
*
exc
;
PyErr_ExceptionMatches
(
PyObject
*
exc
)
{
return
PyErr_GivenExceptionMatches
(
PyErr_Occurred
(),
exc
);
}
...
...
@@ -140,10 +130,7 @@ PyErr_ExceptionMatches(exc)
eval_code2(), do_raise(), and PyErr_Print()
*/
void
PyErr_NormalizeException
(
exc
,
val
,
tb
)
PyObject
**
exc
;
PyObject
**
val
;
PyObject
**
tb
;
PyErr_NormalizeException
(
PyObject
**
exc
,
PyObject
**
val
,
PyObject
**
tb
)
{
PyObject
*
type
=
*
exc
;
PyObject
*
value
=
*
val
;
...
...
@@ -213,10 +200,7 @@ finally:
void
PyErr_Fetch
(
p_type
,
p_value
,
p_traceback
)
PyObject
**
p_type
;
PyObject
**
p_value
;
PyObject
**
p_traceback
;
PyErr_Fetch
(
PyObject
**
p_type
,
PyObject
**
p_value
,
PyObject
**
p_traceback
)
{
PyThreadState
*
tstate
=
PyThreadState_Get
();
...
...
@@ -230,7 +214,7 @@ PyErr_Fetch(p_type, p_value, p_traceback)
}
void
PyErr_Clear
()
PyErr_Clear
(
void
)
{
PyErr_Restore
(
NULL
,
NULL
,
NULL
);
}
...
...
@@ -238,7 +222,7 @@ PyErr_Clear()
/* Convenience functions to set a type error exception and return 0 */
int
PyErr_BadArgument
()
PyErr_BadArgument
(
void
)
{
PyErr_SetString
(
PyExc_TypeError
,
"illegal argument type for built-in operation"
);
...
...
@@ -246,7 +230,7 @@ PyErr_BadArgument()
}
PyObject
*
PyErr_NoMemory
()
PyErr_NoMemory
(
void
)
{
/* raise the pre-allocated instance if it still exists */
if
(
PyExc_MemoryErrorInst
)
...
...
@@ -261,9 +245,7 @@ PyErr_NoMemory()
}
PyObject
*
PyErr_SetFromErrnoWithFilename
(
exc
,
filename
)
PyObject
*
exc
;
char
*
filename
;
PyErr_SetFromErrnoWithFilename
(
PyObject
*
exc
,
char
*
filename
)
{
PyObject
*
v
;
char
*
s
;
...
...
@@ -326,8 +308,7 @@ PyErr_SetFromErrnoWithFilename(exc, filename)
PyObject
*
PyErr_SetFromErrno
(
exc
)
PyObject
*
exc
;
PyErr_SetFromErrno
(
PyObject
*
exc
)
{
return
PyErr_SetFromErrnoWithFilename
(
exc
,
NULL
);
}
...
...
@@ -335,7 +316,7 @@ PyErr_SetFromErrno(exc)
#ifdef MS_WINDOWS
/* Windows specific error code handling */
PyObject
*
PyErr_SetFromWindowsErrWithFilename
(
int
ierr
,
int
ierr
,
const
char
*
filename
)
{
int
len
;
...
...
@@ -378,32 +359,20 @@ PyObject *PyErr_SetFromWindowsErr(int ierr)
#endif
/* MS_WINDOWS */
void
PyErr_BadInternalCall
()
PyErr_BadInternalCall
(
void
)
{
PyErr_SetString
(
PyExc_SystemError
,
"bad argument to internal function"
);
}
#ifdef HAVE_STDARG_PROTOTYPES
PyObject
*
PyErr_Format
(
PyObject
*
exception
,
const
char
*
format
,
...)
#else
PyObject
*
PyErr_Format
(
exception
,
format
,
va_alist
)
PyObject
*
exception
;
const
char
*
format
;
va_dcl
#endif
{
va_list
vargs
;
char
buffer
[
500
];
/* Caller is responsible for limiting the format */
#ifdef HAVE_STDARG_PROTOTYPES
va_start
(
vargs
,
format
);
#else
va_start
(
vargs
);
#endif
vsprintf
(
buffer
,
format
,
vargs
);
PyErr_SetString
(
exception
,
buffer
);
...
...
@@ -412,10 +381,7 @@ PyErr_Format(exception, format, va_alist)
PyObject
*
PyErr_NewException
(
name
,
base
,
dict
)
char
*
name
;
/* modulename.classname */
PyObject
*
base
;
PyObject
*
dict
;
PyErr_NewException
(
char
*
name
,
PyObject
*
base
,
PyObject
*
dict
)
{
char
*
dot
;
PyObject
*
modulename
=
NULL
;
...
...
Python/frozenmain.c
View file @
709fe068
...
...
@@ -30,9 +30,7 @@ extern int PyInitFrozenExtensions();
/* Main program */
int
Py_FrozenMain
(
argc
,
argv
)
int
argc
;
char
**
argv
;
Py_FrozenMain
(
int
argc
,
char
**
argv
)
{
char
*
p
;
int
n
,
sts
;
...
...
Python/getargs.c
View file @
709fe068
...
...
@@ -43,54 +43,24 @@ static int vgetargskeywords(PyObject *, PyObject *,
char
*
,
char
**
,
va_list
*
);
static
char
*
skipitem
(
char
**
,
va_list
*
);
#ifdef HAVE_STDARG_PROTOTYPES
/* VARARGS2 */
int
PyArg_Parse
(
PyObject
*
args
,
char
*
format
,
...)
#else
/* VARARGS */
int
PyArg_Parse
(
va_alist
)
va_dcl
#endif
{
int
retval
;
va_list
va
;
#ifdef HAVE_STDARG_PROTOTYPES
va_start
(
va
,
format
);
#else
PyObject
*
args
;
char
*
format
;
va_start
(
va
);
args
=
va_arg
(
va
,
PyObject
*
);
format
=
va_arg
(
va
,
char
*
);
#endif
retval
=
vgetargs1
(
args
,
format
,
&
va
,
1
);
va_end
(
va
);
return
retval
;
}
#ifdef HAVE_STDARG_PROTOTYPES
/* VARARGS2 */
int
PyArg_ParseTuple
(
PyObject
*
args
,
char
*
format
,
...)
#else
/* VARARGS */
int
PyArg_ParseTuple
(
va_alist
)
va_dcl
#endif
{
int
retval
;
va_list
va
;
#ifdef HAVE_STDARG_PROTOTYPES
va_start
(
va
,
format
);
#else
PyObject
*
args
;
char
*
format
;
va_start
(
va
);
args
=
va_arg
(
va
,
PyObject
*
);
format
=
va_arg
(
va
,
char
*
);
#endif
retval
=
vgetargs1
(
args
,
format
,
&
va
,
0
);
va_end
(
va
);
return
retval
;
...
...
@@ -98,10 +68,7 @@ int PyArg_ParseTuple(va_alist) va_dcl
int
PyArg_VaParse
(
args
,
format
,
va
)
PyObject
*
args
;
char
*
format
;
va_list
va
;
PyArg_VaParse
(
PyObject
*
args
,
char
*
format
,
va_list
va
)
{
va_list
lva
;
...
...
@@ -116,11 +83,7 @@ PyArg_VaParse(args, format, va)
static
int
vgetargs1
(
args
,
format
,
p_va
,
compat
)
PyObject
*
args
;
char
*
format
;
va_list
*
p_va
;
int
compat
;
vgetargs1
(
PyObject
*
args
,
char
*
format
,
va_list
*
p_va
,
int
compat
)
{
char
msgbuf
[
256
];
int
levels
[
32
];
...
...
@@ -254,12 +217,7 @@ vgetargs1(args, format, p_va, compat)
static
void
seterror
(
iarg
,
msg
,
levels
,
fname
,
message
)
int
iarg
;
char
*
msg
;
int
*
levels
;
char
*
fname
;
char
*
message
;
seterror
(
int
iarg
,
char
*
msg
,
int
*
levels
,
char
*
fname
,
char
*
message
)
{
char
buf
[
256
];
int
i
;
...
...
@@ -309,13 +267,8 @@ seterror(iarg, msg, levels, fname, message)
*/
static
char
*
converttuple
(
arg
,
p_format
,
p_va
,
levels
,
msgbuf
,
toplevel
)
PyObject
*
arg
;
char
**
p_format
;
va_list
*
p_va
;
int
*
levels
;
char
*
msgbuf
;
int
toplevel
;
converttuple
(
PyObject
*
arg
,
char
**
p_format
,
va_list
*
p_va
,
int
*
levels
,
char
*
msgbuf
,
int
toplevel
)
{
int
level
=
0
;
int
n
=
0
;
...
...
@@ -378,12 +331,8 @@ converttuple(arg, p_format, p_va, levels, msgbuf, toplevel)
/* Convert a single item. */
static
char
*
convertitem
(
arg
,
p_format
,
p_va
,
levels
,
msgbuf
)
PyObject
*
arg
;
char
**
p_format
;
va_list
*
p_va
;
int
*
levels
;
char
*
msgbuf
;
convertitem
(
PyObject
*
arg
,
char
**
p_format
,
va_list
*
p_va
,
int
*
levels
,
char
*
msgbuf
)
{
char
*
msg
;
char
*
format
=
*
p_format
;
...
...
@@ -409,11 +358,7 @@ convertitem(arg, p_format, p_va, levels, msgbuf)
by appending ", <actual argument type>" to error message. */
static
char
*
convertsimple
(
arg
,
p_format
,
p_va
,
msgbuf
)
PyObject
*
arg
;
char
**
p_format
;
va_list
*
p_va
;
char
*
msgbuf
;
convertsimple
(
PyObject
*
arg
,
char
**
p_format
,
va_list
*
p_va
,
char
*
msgbuf
)
{
char
*
msg
=
convertsimple1
(
arg
,
p_format
,
p_va
);
if
(
msg
!=
NULL
)
{
...
...
@@ -436,10 +381,7 @@ PyObject *_PyUnicode_AsUTF8String(PyObject *unicode,
Don't call if a tuple is expected. */
static
char
*
convertsimple1
(
arg
,
p_format
,
p_va
)
PyObject
*
arg
;
char
**
p_format
;
va_list
*
p_va
;
convertsimple1
(
PyObject
*
arg
,
char
**
p_format
,
va_list
*
p_va
)
{
char
*
format
=
*
p_format
;
char
c
=
*
format
++
;
...
...
@@ -961,34 +903,15 @@ convertsimple1(arg, p_format, p_va)
/* Support for keyword arguments donated by
Geoff Philbrick <philbric@delphi.hks.com> */
#ifdef HAVE_STDARG_PROTOTYPES
/* VARARGS2 */
int
PyArg_ParseTupleAndKeywords
(
PyObject
*
args
,
PyObject
*
keywords
,
char
*
format
,
char
**
kwlist
,
...)
#else
/* VARARGS */
int
PyArg_ParseTupleAndKeywords
(
va_alist
)
va_dcl
#endif
{
int
retval
;
va_list
va
;
#ifdef HAVE_STDARG_PROTOTYPES
va_start
(
va
,
kwlist
);
#else
PyObject
*
args
;
PyObject
*
keywords
;
char
*
format
;
char
**
kwlist
;
va_start
(
va
);
args
=
va_arg
(
va
,
PyObject
*
);
keywords
=
va_arg
(
va
,
PyObject
*
);
format
=
va_arg
(
va
,
char
*
);
kwlist
=
va_arg
(
va
,
char
**
);
#endif
retval
=
vgetargskeywords
(
args
,
keywords
,
format
,
kwlist
,
&
va
);
va_end
(
va
);
return
retval
;
...
...
@@ -996,12 +919,8 @@ int PyArg_ParseTupleAndKeywords(va_alist) va_dcl
static
int
vgetargskeywords
(
args
,
keywords
,
format
,
kwlist
,
p_va
)
PyObject
*
args
;
PyObject
*
keywords
;
char
*
format
;
char
**
kwlist
;
va_list
*
p_va
;
vgetargskeywords
(
PyObject
*
args
,
PyObject
*
keywords
,
char
*
format
,
char
**
kwlist
,
va_list
*
p_va
)
{
char
msgbuf
[
256
];
int
levels
[
32
];
...
...
@@ -1204,9 +1123,7 @@ vgetargskeywords(args, keywords, format, kwlist, p_va)
static
char
*
skipitem
(
p_format
,
p_va
)
char
**
p_format
;
va_list
*
p_va
;
skipitem
(
char
**
p_format
,
va_list
*
p_va
)
{
char
*
format
=
*
p_format
;
char
c
=
*
format
++
;
...
...
Python/getcompiler.c
View file @
709fe068
...
...
@@ -31,7 +31,7 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#endif
/* !COMPILER */
const
char
*
Py_GetCompiler
()
Py_GetCompiler
(
void
)
{
return
COMPILER
;
}
Python/getcopyright.c
View file @
709fe068
...
...
@@ -23,7 +23,7 @@ static char cprt[] =
Copyright 1995-2000 Corporation for National Research Initiatives (CNRI)"
;
const
char
*
Py_GetCopyright
()
Py_GetCopyright
(
void
)
{
return
cprt
;
}
Python/getcwd.c
View file @
709fe068
...
...
@@ -26,12 +26,10 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#define MAXPATHLEN 1024
#endif
extern
char
*
getwd
();
extern
char
*
getwd
(
char
*
);
char
*
getcwd
(
buf
,
size
)
char
*
buf
;
int
size
;
getcwd
(
char
*
buf
,
int
size
)
{
char
localbuf
[
MAXPATHLEN
+
1
];
char
*
ret
;
...
...
@@ -62,9 +60,7 @@ getcwd(buf, size)
#endif
char
*
getcwd
(
buf
,
size
)
char
*
buf
;
int
size
;
getcwd
(
char
*
buf
,
int
size
)
{
FILE
*
fp
;
char
*
p
;
...
...
Python/getmtime.c
View file @
709fe068
...
...
@@ -26,9 +26,7 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#endif
time_t
PyOS_GetLastModificationTime
(
path
,
fp
)
char
*
path
;
FILE
*
fp
;
PyOS_GetLastModificationTime
(
char
*
path
,
FILE
*
fp
)
{
struct
stat
st
;
if
(
fstat
(
fileno
(
fp
),
&
st
)
!=
0
)
...
...
Python/getopt.c
View file @
709fe068
...
...
@@ -41,12 +41,9 @@ char * optarg = NULL; /* optional argument */
#ifndef __BEOS__
int
getopt
(
argc
,
argv
,
optstring
)
int
argc
;
char
*
argv
[];
char
optstring
[];
int
getopt
(
int
argc
,
char
*
argv
[],
char
optstring
[])
#else
int
getopt
(
int
argc
,
char
*
const
*
argv
,
const
char
*
optstring
)
int
getopt
(
int
argc
,
char
*
const
*
argv
,
const
char
*
optstring
)
#endif
{
static
char
*
opt_ptr
=
""
;
...
...
Python/getplatform.c
View file @
709fe068
...
...
@@ -15,7 +15,7 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#endif
const
char
*
Py_GetPlatform
()
Py_GetPlatform
(
void
)
{
return
PLATFORM
;
}
Python/getversion.c
View file @
709fe068
...
...
@@ -15,7 +15,7 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#include "patchlevel.h"
const
char
*
Py_GetVersion
()
Py_GetVersion
(
void
)
{
static
char
version
[
250
];
sprintf
(
version
,
"%.80s (%.80s) %.80s"
,
PY_VERSION
,
...
...
Python/hypot.c
View file @
709fe068
...
...
@@ -4,9 +4,7 @@
#include "myproto.h"
#include "mymath.h"
double
hypot
(
x
,
y
)
double
x
;
double
y
;
double
hypot
(
double
x
,
double
y
)
{
double
yx
;
...
...
Python/import.c
View file @
709fe068
...
...
@@ -55,7 +55,8 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#endif
extern
time_t
PyOS_GetLastModificationTime
();
/* In getmtime.c */
extern
time_t
PyOS_GetLastModificationTime
(
char
*
,
FILE
*
);
/* In getmtime.c */
/* Magic word to reject .pyc files generated by other Python versions */
/* Change for each incompatible change */
...
...
@@ -65,7 +66,7 @@ extern time_t PyOS_GetLastModificationTime(); /* In getmtime.c */
/* XXX Perhaps the magic number should be frozen and a version field
added to the .pyc file header? */
/* New way to come up with the magic number: (YEAR-1995), MONTH, DAY */
#define MAGIC (50
428
| ((long)'\r'<<16) | ((long)'\n'<<24))
#define MAGIC (50
715
| ((long)'\r'<<16) | ((long)'\n'<<24))
/* Magic word as global; note that _PyImport_Init() can change the
value of this global to accommodate for alterations of how the
...
...
@@ -91,7 +92,7 @@ static const struct filedescr _PyImport_StandardFiletab[] = {
/* Initialize things */
void
_PyImport_Init
()
_PyImport_Init
(
void
)
{
const
struct
filedescr
*
scan
;
struct
filedescr
*
filetab
;
...
...
@@ -131,7 +132,7 @@ _PyImport_Init()
}
void
_PyImport_Fini
()
_PyImport_Fini
(
void
)
{
Py_XDECREF
(
extensions
);
extensions
=
NULL
;
...
...
@@ -151,7 +152,7 @@ static long import_lock_thread = -1;
static
int
import_lock_level
=
0
;
static
void
lock_import
()
lock_import
(
void
)
{
long
me
=
PyThread_get_thread_ident
();
if
(
me
==
-
1
)
...
...
@@ -172,7 +173,7 @@ lock_import()
}
static
void
unlock_import
()
unlock_import
(
void
)
{
long
me
=
PyThread_get_thread_ident
();
if
(
me
==
-
1
)
...
...
@@ -196,7 +197,7 @@ unlock_import()
/* Helper for sys */
PyObject
*
PyImport_GetModuleDict
()
PyImport_GetModuleDict
(
void
)
{
PyInterpreterState
*
interp
=
PyThreadState_Get
()
->
interp
;
if
(
interp
->
modules
==
NULL
)
...
...
@@ -224,7 +225,7 @@ static char* sys_files[] = {
/* Un-initialize things, as good as we can */
void
PyImport_Cleanup
()
PyImport_Cleanup
(
void
)
{
int
pos
,
ndone
;
char
*
name
;
...
...
@@ -357,7 +358,7 @@ PyImport_Cleanup()
/* Helper for pythonrun.c -- return magic number */
long
PyImport_GetMagicNumber
()
PyImport_GetMagicNumber
(
void
)
{
return
pyc_magic
;
}
...
...
@@ -374,9 +375,7 @@ PyImport_GetMagicNumber()
_PyImport_FindExtension(). */
PyObject
*
_PyImport_FixupExtension
(
name
,
filename
)
char
*
name
;
char
*
filename
;
_PyImport_FixupExtension
(
char
*
name
,
char
*
filename
)
{
PyObject
*
modules
,
*
mod
,
*
dict
,
*
copy
;
if
(
extensions
==
NULL
)
{
...
...
@@ -403,9 +402,7 @@ _PyImport_FixupExtension(name, filename)
}
PyObject
*
_PyImport_FindExtension
(
name
,
filename
)
char
*
name
;
char
*
filename
;
_PyImport_FindExtension
(
char
*
name
,
char
*
filename
)
{
PyObject
*
dict
,
*
mod
,
*
mdict
,
*
result
;
if
(
extensions
==
NULL
)
...
...
@@ -437,8 +434,7 @@ _PyImport_FindExtension(name, filename)
'NEW' REFERENCE! */
PyObject
*
PyImport_AddModule
(
name
)
char
*
name
;
PyImport_AddModule
(
char
*
name
)
{
PyObject
*
modules
=
PyImport_GetModuleDict
();
PyObject
*
m
;
...
...
@@ -463,18 +459,13 @@ PyImport_AddModule(name)
WITH INCREMENTED REFERENCE COUNT */
PyObject
*
PyImport_ExecCodeModule
(
name
,
co
)
char
*
name
;
PyObject
*
co
;
PyImport_ExecCodeModule
(
char
*
name
,
PyObject
*
co
)
{
return
PyImport_ExecCodeModuleEx
(
name
,
co
,
(
char
*
)
NULL
);
}
PyObject
*
PyImport_ExecCodeModuleEx
(
name
,
co
,
pathname
)
char
*
name
;
PyObject
*
co
;
char
*
pathname
;
PyImport_ExecCodeModuleEx
(
char
*
name
,
PyObject
*
co
,
char
*
pathname
)
{
PyObject
*
modules
=
PyImport_GetModuleDict
();
PyObject
*
m
,
*
d
,
*
v
;
...
...
@@ -527,10 +518,7 @@ PyImport_ExecCodeModuleEx(name, co, pathname)
Doesn't set an exception. */
static
char
*
make_compiled_pathname
(
pathname
,
buf
,
buflen
)
char
*
pathname
;
char
*
buf
;
size_t
buflen
;
make_compiled_pathname
(
char
*
pathname
,
char
*
buf
,
size_t
buflen
)
{
size_t
len
;
...
...
@@ -552,10 +540,7 @@ make_compiled_pathname(pathname, buf, buflen)
Doesn't set an exception. */
static
FILE
*
check_compiled_module
(
pathname
,
mtime
,
cpathname
)
char
*
pathname
;
long
mtime
;
char
*
cpathname
;
check_compiled_module
(
char
*
pathname
,
long
mtime
,
char
*
cpathname
)
{
FILE
*
fp
;
long
magic
;
...
...
@@ -587,9 +572,7 @@ check_compiled_module(pathname, mtime, cpathname)
/* Read a code object from a file and check it for validity */
static
PyCodeObject
*
read_compiled_module
(
cpathname
,
fp
)
char
*
cpathname
;
FILE
*
fp
;
read_compiled_module
(
char
*
cpathname
,
FILE
*
fp
)
{
PyObject
*
co
;
...
...
@@ -610,10 +593,7 @@ read_compiled_module(cpathname, fp)
module object WITH INCREMENTED REFERENCE COUNT */
static
PyObject
*
load_compiled_module
(
name
,
cpathname
,
fp
)
char
*
name
;
char
*
cpathname
;
FILE
*
fp
;
load_compiled_module
(
char
*
name
,
char
*
cpathname
,
FILE
*
fp
)
{
long
magic
;
PyCodeObject
*
co
;
...
...
@@ -641,9 +621,7 @@ load_compiled_module(name, cpathname, fp)
/* Parse a source file and return the corresponding code object */
static
PyCodeObject
*
parse_source_module
(
pathname
,
fp
)
char
*
pathname
;
FILE
*
fp
;
parse_source_module
(
char
*
pathname
,
FILE
*
fp
)
{
PyCodeObject
*
co
;
node
*
n
;
...
...
@@ -664,10 +642,7 @@ parse_source_module(pathname, fp)
remove the file. */
static
void
write_compiled_module
(
co
,
cpathname
,
mtime
)
PyCodeObject
*
co
;
char
*
cpathname
;
long
mtime
;
write_compiled_module
(
PyCodeObject
*
co
,
char
*
cpathname
,
long
mtime
)
{
FILE
*
fp
;
...
...
@@ -708,10 +683,7 @@ write_compiled_module(co, cpathname, mtime)
byte-compiled file, use that instead. */
static
PyObject
*
load_source_module
(
name
,
pathname
,
fp
)
char
*
name
;
char
*
pathname
;
FILE
*
fp
;
load_source_module
(
char
*
name
,
char
*
pathname
,
FILE
*
fp
)
{
time_t
mtime
;
FILE
*
fpc
;
...
...
@@ -772,9 +744,7 @@ static struct _frozen *find_frozen(char *name);
REFERENCE COUNT */
static
PyObject
*
load_package
(
name
,
pathname
)
char
*
name
;
char
*
pathname
;
load_package
(
char
*
name
,
char
*
pathname
)
{
PyObject
*
m
,
*
d
,
*
file
,
*
path
;
int
err
;
...
...
@@ -827,8 +797,7 @@ load_package(name, pathname)
/* Helper to test for built-in module */
static
int
is_builtin
(
name
)
char
*
name
;
is_builtin
(
char
*
name
)
{
int
i
;
for
(
i
=
0
;
PyImport_Inittab
[
i
].
name
!=
NULL
;
i
++
)
{
...
...
@@ -858,13 +827,8 @@ static int check_case(char *, int, int, char *);
static
int
find_init_module
(
char
*
);
/* Forward */
static
struct
filedescr
*
find_module
(
realname
,
path
,
buf
,
buflen
,
p_fp
)
char
*
realname
;
PyObject
*
path
;
/* Output parameters: */
char
*
buf
;
size_t
buflen
;
FILE
**
p_fp
;
find_module
(
char
*
realname
,
PyObject
*
path
,
char
*
buf
,
size_t
buflen
,
FILE
**
p_fp
)
{
int
i
,
npath
;
size_t
len
,
namelen
;
...
...
@@ -1037,8 +1001,7 @@ find_module(realname, path, buf, buflen, p_fp)
#include <ctype.h>
static
int
allcaps8x3
(
s
)
char
*
s
;
allcaps8x3
(
char
*
s
)
{
/* Return 1 if s is an 8.3 filename in ALLCAPS */
char
c
;
...
...
@@ -1176,8 +1139,7 @@ check_case(char *buf, int len, int namelen, char *name)
#ifdef HAVE_STAT
/* Helper to look for __init__.py or __init__.py[co] in potential package */
static
int
find_init_module
(
buf
)
char
*
buf
;
find_init_module
(
char
*
buf
)
{
size_t
save_len
=
strlen
(
buf
);
size_t
i
=
save_len
;
...
...
@@ -1212,11 +1174,7 @@ static int init_builtin(char *); /* Forward */
its module object WITH INCREMENTED REFERENCE COUNT */
static
PyObject
*
load_module
(
name
,
fp
,
buf
,
type
)
char
*
name
;
FILE
*
fp
;
char
*
buf
;
int
type
;
load_module
(
char
*
name
,
FILE
*
fp
,
char
*
buf
,
int
type
)
{
PyObject
*
modules
;
PyObject
*
m
;
...
...
@@ -1312,8 +1270,7 @@ load_module(name, fp, buf, type)
an exception set if the initialization failed. */
static
int
init_builtin
(
name
)
char
*
name
;
init_builtin
(
char
*
name
)
{
struct
_inittab
*
p
;
PyObject
*
mod
;
...
...
@@ -1346,8 +1303,7 @@ init_builtin(name)
/* Frozen modules */
static
struct
_frozen
*
find_frozen
(
name
)
char
*
name
;
find_frozen
(
char
*
name
)
{
struct
_frozen
*
p
;
...
...
@@ -1361,8 +1317,7 @@ find_frozen(name)
}
static
PyObject
*
get_frozen_object
(
name
)
char
*
name
;
get_frozen_object
(
char
*
name
)
{
struct
_frozen
*
p
=
find_frozen
(
name
);
int
size
;
...
...
@@ -1385,8 +1340,7 @@ get_frozen_object(name)
This function is also used from frozenmain.c */
int
PyImport_ImportFrozenModule
(
name
)
char
*
name
;
PyImport_ImportFrozenModule
(
char
*
name
)
{
struct
_frozen
*
p
=
find_frozen
(
name
);
PyObject
*
co
;
...
...
@@ -1442,8 +1396,7 @@ PyImport_ImportFrozenModule(name)
its module object WITH INCREMENTED REFERENCE COUNT */
PyObject
*
PyImport_ImportModule
(
name
)
char
*
name
;
PyImport_ImportModule
(
char
*
name
)
{
static
PyObject
*
fromlist
=
NULL
;
if
(
fromlist
==
NULL
&&
strchr
(
name
,
'.'
)
!=
NULL
)
{
...
...
@@ -1466,11 +1419,8 @@ static PyObject * import_submodule(PyObject *mod, char *name, char *fullname);
/* The Magnum Opus of dotted-name import :-) */
static
PyObject
*
import_module_ex
(
name
,
globals
,
locals
,
fromlist
)
char
*
name
;
PyObject
*
globals
;
PyObject
*
locals
;
PyObject
*
fromlist
;
import_module_ex
(
char
*
name
,
PyObject
*
globals
,
PyObject
*
locals
,
PyObject
*
fromlist
)
{
char
buf
[
MAXPATHLEN
+
1
];
int
buflen
=
0
;
...
...
@@ -1516,11 +1466,8 @@ import_module_ex(name, globals, locals, fromlist)
}
PyObject
*
PyImport_ImportModuleEx
(
name
,
globals
,
locals
,
fromlist
)
char
*
name
;
PyObject
*
globals
;
PyObject
*
locals
;
PyObject
*
fromlist
;
PyImport_ImportModuleEx
(
char
*
name
,
PyObject
*
globals
,
PyObject
*
locals
,
PyObject
*
fromlist
)
{
PyObject
*
result
;
lock_import
();
...
...
@@ -1530,10 +1477,7 @@ PyImport_ImportModuleEx(name, globals, locals, fromlist)
}
static
PyObject
*
get_parent
(
globals
,
buf
,
p_buflen
)
PyObject
*
globals
;
char
*
buf
;
int
*
p_buflen
;
get_parent
(
PyObject
*
globals
,
char
*
buf
,
int
*
p_buflen
)
{
static
PyObject
*
namestr
=
NULL
;
static
PyObject
*
pathstr
=
NULL
;
...
...
@@ -1598,13 +1542,10 @@ get_parent(globals, buf, p_buflen)
If this is violated... Who cares? */
}
/* altmod is either None or same as mod */
static
PyObject
*
load_next
(
mod
,
altmod
,
p_name
,
buf
,
p_buflen
)
PyObject
*
mod
;
PyObject
*
altmod
;
/* Either None or same as mod */
char
**
p_name
;
char
*
buf
;
int
*
p_buflen
;
load_next
(
PyObject
*
mod
,
PyObject
*
altmod
,
char
**
p_name
,
char
*
buf
,
int
*
p_buflen
)
{
char
*
name
=
*
p_name
;
char
*
dot
=
strchr
(
name
,
'.'
);
...
...
@@ -1667,20 +1608,15 @@ load_next(mod, altmod, p_name, buf, p_buflen)
}
static
int
mark_miss
(
name
)
char
*
name
;
mark_miss
(
char
*
name
)
{
PyObject
*
modules
=
PyImport_GetModuleDict
();
return
PyDict_SetItemString
(
modules
,
name
,
Py_None
);
}
static
int
ensure_fromlist
(
mod
,
fromlist
,
buf
,
buflen
,
recursive
)
PyObject
*
mod
;
PyObject
*
fromlist
;
char
*
buf
;
int
buflen
;
int
recursive
;
ensure_fromlist
(
PyObject
*
mod
,
PyObject
*
fromlist
,
char
*
buf
,
int
buflen
,
int
recursive
)
{
int
i
;
...
...
@@ -1747,10 +1683,7 @@ ensure_fromlist(mod, fromlist, buf, buflen, recursive)
}
static
PyObject
*
import_submodule
(
mod
,
subname
,
fullname
)
PyObject
*
mod
;
/* May be None */
char
*
subname
;
char
*
fullname
;
import_submodule
(
PyObject
*
mod
,
char
*
subname
,
char
*
fullname
)
{
PyObject
*
modules
=
PyImport_GetModuleDict
();
PyObject
*
m
;
...
...
@@ -1809,8 +1742,7 @@ import_submodule(mod, subname, fullname)
INCREMENTED REFERENCE COUNT */
PyObject
*
PyImport_ReloadModule
(
m
)
PyObject
*
m
;
PyImport_ReloadModule
(
PyObject
*
m
)
{
PyObject
*
modules
=
PyImport_GetModuleDict
();
PyObject
*
path
=
NULL
;
...
...
@@ -1876,8 +1808,7 @@ PyImport_ReloadModule(m)
will return <module "gencache"> instead of <module "win32com">. */
PyObject
*
PyImport_Import
(
module_name
)
PyObject
*
module_name
;
PyImport_Import
(
PyObject
*
module_name
)
{
static
PyObject
*
silly_list
=
NULL
;
static
PyObject
*
builtins_str
=
NULL
;
...
...
@@ -1953,9 +1884,7 @@ PyImport_Import(module_name)
*/
static
PyObject
*
imp_get_magic
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
imp_get_magic
(
PyObject
*
self
,
PyObject
*
args
)
{
char
buf
[
4
];
...
...
@@ -1970,9 +1899,7 @@ imp_get_magic(self, args)
}
static
PyObject
*
imp_get_suffixes
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
imp_get_suffixes
(
PyObject
*
self
,
PyObject
*
args
)
{
PyObject
*
list
;
struct
filedescr
*
fdp
;
...
...
@@ -2000,9 +1927,7 @@ imp_get_suffixes(self, args)
}
static
PyObject
*
call_find_module
(
name
,
path
)
char
*
name
;
PyObject
*
path
;
/* list or None or NULL */
call_find_module
(
char
*
name
,
PyObject
*
path
)
{
extern
int
fclose
(
FILE
*
);
PyObject
*
fob
,
*
ret
;
...
...
@@ -2034,9 +1959,7 @@ call_find_module(name, path)
}
static
PyObject
*
imp_find_module
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
imp_find_module
(
PyObject
*
self
,
PyObject
*
args
)
{
char
*
name
;
PyObject
*
path
=
NULL
;
...
...
@@ -2046,9 +1969,7 @@ imp_find_module(self, args)
}
static
PyObject
*
imp_init_builtin
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
imp_init_builtin
(
PyObject
*
self
,
PyObject
*
args
)
{
char
*
name
;
int
ret
;
...
...
@@ -2068,9 +1989,7 @@ imp_init_builtin(self, args)
}
static
PyObject
*
imp_init_frozen
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
imp_init_frozen
(
PyObject
*
self
,
PyObject
*
args
)
{
char
*
name
;
int
ret
;
...
...
@@ -2090,9 +2009,7 @@ imp_init_frozen(self, args)
}
static
PyObject
*
imp_get_frozen_object
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
imp_get_frozen_object
(
PyObject
*
self
,
PyObject
*
args
)
{
char
*
name
;
...
...
@@ -2102,9 +2019,7 @@ imp_get_frozen_object(self, args)
}
static
PyObject
*
imp_is_builtin
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
imp_is_builtin
(
PyObject
*
self
,
PyObject
*
args
)
{
char
*
name
;
if
(
!
PyArg_ParseTuple
(
args
,
"s:is_builtin"
,
&
name
))
...
...
@@ -2113,9 +2028,7 @@ imp_is_builtin(self, args)
}
static
PyObject
*
imp_is_frozen
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
imp_is_frozen
(
PyObject
*
self
,
PyObject
*
args
)
{
char
*
name
;
struct
_frozen
*
p
;
...
...
@@ -2126,10 +2039,7 @@ imp_is_frozen(self, args)
}
static
FILE
*
get_file
(
pathname
,
fob
,
mode
)
char
*
pathname
;
PyObject
*
fob
;
char
*
mode
;
get_file
(
char
*
pathname
,
PyObject
*
fob
,
char
*
mode
)
{
FILE
*
fp
;
if
(
fob
==
NULL
)
{
...
...
@@ -2147,9 +2057,7 @@ get_file(pathname, fob, mode)
}
static
PyObject
*
imp_load_compiled
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
imp_load_compiled
(
PyObject
*
self
,
PyObject
*
args
)
{
char
*
name
;
char
*
pathname
;
...
...
@@ -2171,9 +2079,7 @@ imp_load_compiled(self, args)
#ifdef HAVE_DYNAMIC_LOADING
static
PyObject
*
imp_load_dynamic
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
imp_load_dynamic
(
PyObject
*
self
,
PyObject
*
args
)
{
char
*
name
;
char
*
pathname
;
...
...
@@ -2195,9 +2101,7 @@ imp_load_dynamic(self, args)
#endif
/* HAVE_DYNAMIC_LOADING */
static
PyObject
*
imp_load_source
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
imp_load_source
(
PyObject
*
self
,
PyObject
*
args
)
{
char
*
name
;
char
*
pathname
;
...
...
@@ -2218,9 +2122,7 @@ imp_load_source(self, args)
#ifdef macintosh
static
PyObject
*
imp_load_resource
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
imp_load_resource
(
PyObject
*
self
,
PyObject
*
args
)
{
char
*
name
;
char
*
pathname
;
...
...
@@ -2234,9 +2136,7 @@ imp_load_resource(self, args)
#endif
/* macintosh */
static
PyObject
*
imp_load_module
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
imp_load_module
(
PyObject
*
self
,
PyObject
*
args
)
{
char
*
name
;
PyObject
*
fob
;
...
...
@@ -2271,9 +2171,7 @@ imp_load_module(self, args)
}
static
PyObject
*
imp_load_package
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
imp_load_package
(
PyObject
*
self
,
PyObject
*
args
)
{
char
*
name
;
char
*
pathname
;
...
...
@@ -2283,9 +2181,7 @@ imp_load_package(self, args)
}
static
PyObject
*
imp_new_module
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
imp_new_module
(
PyObject
*
self
,
PyObject
*
args
)
{
char
*
name
;
if
(
!
PyArg_ParseTuple
(
args
,
"s:new_module"
,
&
name
))
...
...
@@ -2356,10 +2252,7 @@ static PyMethodDef imp_methods[] = {
};
static
int
setint
(
d
,
name
,
value
)
PyObject
*
d
;
char
*
name
;
int
value
;
setint
(
PyObject
*
d
,
char
*
name
,
int
value
)
{
PyObject
*
v
;
int
err
;
...
...
@@ -2371,7 +2264,7 @@ setint(d, name, value)
}
void
initimp
()
initimp
(
void
)
{
PyObject
*
m
,
*
d
;
...
...
@@ -2402,8 +2295,7 @@ initimp()
After a similar function by Just van Rossum. */
int
PyImport_ExtendInittab
(
newtab
)
struct
_inittab
*
newtab
;
PyImport_ExtendInittab
(
struct
_inittab
*
newtab
)
{
static
struct
_inittab
*
our_copy
=
NULL
;
struct
_inittab
*
p
;
...
...
@@ -2435,9 +2327,7 @@ PyImport_ExtendInittab(newtab)
/* Shorthand to add a single entry given a name and a function */
int
PyImport_AppendInittab
(
name
,
initfunc
)
char
*
name
;
void
(
*
initfunc
)();
PyImport_AppendInittab
(
char
*
name
,
void
(
*
initfunc
)(
void
))
{
struct
_inittab
newtab
[
2
];
...
...
Python/importdl.c
View file @
709fe068
...
...
@@ -28,10 +28,7 @@ extern dl_funcptr _PyImport_GetDynLoadFunc(const char *name,
PyObject
*
_PyImport_LoadDynamicModule
(
name
,
pathname
,
fp
)
char
*
name
;
char
*
pathname
;
FILE
*
fp
;
_PyImport_LoadDynamicModule
(
char
*
name
,
char
*
pathname
,
FILE
*
fp
)
{
PyObject
*
m
,
*
d
,
*
s
;
char
*
lastdot
,
*
shortname
,
*
packagecontext
;
...
...
Python/marshal.c
View file @
709fe068
...
...
@@ -55,9 +55,7 @@ typedef struct {
else w_more(c, p)
static
void
w_more
(
c
,
p
)
char
c
;
WFILE
*
p
;
w_more
(
char
c
,
WFILE
*
p
)
{
int
size
,
newsize
;
if
(
p
->
str
==
NULL
)
...
...
@@ -76,10 +74,7 @@ w_more(c, p)
}
static
void
w_string
(
s
,
n
,
p
)
char
*
s
;
int
n
;
WFILE
*
p
;
w_string
(
char
*
s
,
int
n
,
WFILE
*
p
)
{
if
(
p
->
fp
!=
NULL
)
{
fwrite
(
s
,
1
,
n
,
p
->
fp
);
...
...
@@ -93,18 +88,14 @@ w_string(s, n, p)
}
static
void
w_short
(
x
,
p
)
int
x
;
WFILE
*
p
;
w_short
(
int
x
,
WFILE
*
p
)
{
w_byte
(
x
&
0xff
,
p
);
w_byte
((
x
>>
8
)
&
0xff
,
p
);
}
static
void
w_long
(
x
,
p
)
long
x
;
WFILE
*
p
;
w_long
(
long
x
,
WFILE
*
p
)
{
w_byte
((
int
)(
x
&
0xff
),
p
);
w_byte
((
int
)((
x
>>
8
)
&
0xff
),
p
);
...
...
@@ -114,9 +105,7 @@ w_long(x, p)
#if SIZEOF_LONG > 4
static
void
w_long64
(
x
,
p
)
long
x
;
WFILE
*
p
;
w_long64
(
long
x
,
WFILE
*
p
)
{
w_long
(
x
,
p
);
w_long
(
x
>>
32
,
p
);
...
...
@@ -124,9 +113,7 @@ w_long64(x, p)
#endif
static
void
w_object
(
v
,
p
)
PyObject
*
v
;
WFILE
*
p
;
w_object
(
PyObject
*
v
,
WFILE
*
p
)
{
int
i
,
n
;
PyBufferProcs
*
pb
;
...
...
@@ -286,9 +273,7 @@ w_object(v, p)
}
void
PyMarshal_WriteLongToFile
(
x
,
fp
)
long
x
;
FILE
*
fp
;
PyMarshal_WriteLongToFile
(
long
x
,
FILE
*
fp
)
{
WFILE
wf
;
wf
.
fp
=
fp
;
...
...
@@ -298,9 +283,7 @@ PyMarshal_WriteLongToFile(x, fp)
}
void
PyMarshal_WriteObjectToFile
(
x
,
fp
)
PyObject
*
x
;
FILE
*
fp
;
PyMarshal_WriteObjectToFile
(
PyObject
*
x
,
FILE
*
fp
)
{
WFILE
wf
;
wf
.
fp
=
fp
;
...
...
@@ -316,10 +299,7 @@ typedef WFILE RFILE; /* Same struct with different invariants */
#define r_byte(p) ((p)->fp ? getc((p)->fp) : rs_byte(p))
static
int
r_string
(
s
,
n
,
p
)
char
*
s
;
int
n
;
RFILE
*
p
;
r_string
(
char
*
s
,
int
n
,
RFILE
*
p
)
{
if
(
p
->
fp
!=
NULL
)
return
fread
(
s
,
1
,
n
,
p
->
fp
);
...
...
@@ -331,8 +311,7 @@ r_string(s, n, p)
}
static
int
r_short
(
p
)
RFILE
*
p
;
r_short
(
RFILE
*
p
)
{
register
short
x
;
x
=
r_byte
(
p
);
...
...
@@ -342,8 +321,7 @@ r_short(p)
}
static
long
r_long
(
p
)
RFILE
*
p
;
r_long
(
RFILE
*
p
)
{
register
long
x
;
register
FILE
*
fp
=
p
->
fp
;
...
...
@@ -368,8 +346,7 @@ r_long(p)
}
static
long
r_long64
(
p
)
RFILE
*
p
;
r_long64
(
RFILE
*
p
)
{
register
long
x
;
x
=
r_long
(
p
);
...
...
@@ -388,8 +365,7 @@ r_long64(p)
}
static
PyObject
*
r_object
(
p
)
RFILE
*
p
;
r_object
(
RFILE
*
p
)
{
PyObject
*
v
,
*
v2
;
long
i
,
n
;
...
...
@@ -634,8 +610,7 @@ r_object(p)
}
long
PyMarshal_ReadLongFromFile
(
fp
)
FILE
*
fp
;
PyMarshal_ReadLongFromFile
(
FILE
*
fp
)
{
RFILE
rf
;
rf
.
fp
=
fp
;
...
...
@@ -643,8 +618,7 @@ PyMarshal_ReadLongFromFile(fp)
}
PyObject
*
PyMarshal_ReadObjectFromFile
(
fp
)
FILE
*
fp
;
PyMarshal_ReadObjectFromFile
(
FILE
*
fp
)
{
RFILE
rf
;
if
(
PyErr_Occurred
())
{
...
...
@@ -656,9 +630,7 @@ PyMarshal_ReadObjectFromFile(fp)
}
PyObject
*
PyMarshal_ReadObjectFromString
(
str
,
len
)
char
*
str
;
int
len
;
PyMarshal_ReadObjectFromString
(
char
*
str
,
int
len
)
{
RFILE
rf
;
if
(
PyErr_Occurred
())
{
...
...
@@ -673,8 +645,7 @@ PyMarshal_ReadObjectFromString(str, len)
}
PyObject
*
PyMarshal_WriteObjectToString
(
x
)
/* wrs_object() */
PyObject
*
x
;
PyMarshal_WriteObjectToString
(
PyObject
*
x
)
/* wrs_object() */
{
WFILE
wf
;
wf
.
fp
=
NULL
;
...
...
@@ -703,9 +674,7 @@ PyMarshal_WriteObjectToString(x) /* wrs_object() */
/* And an interface for Python programs... */
static
PyObject
*
marshal_dump
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
marshal_dump
(
PyObject
*
self
,
PyObject
*
args
)
{
WFILE
wf
;
PyObject
*
x
;
...
...
@@ -734,9 +703,7 @@ marshal_dump(self, args)
}
static
PyObject
*
marshal_load
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
marshal_load
(
PyObject
*
self
,
PyObject
*
args
)
{
RFILE
rf
;
PyObject
*
f
;
...
...
@@ -761,9 +728,7 @@ marshal_load(self, args)
}
static
PyObject
*
marshal_dumps
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
marshal_dumps
(
PyObject
*
self
,
PyObject
*
args
)
{
PyObject
*
x
;
if
(
!
PyArg_ParseTuple
(
args
,
"O:dumps"
,
&
x
))
...
...
@@ -772,9 +737,7 @@ marshal_dumps(self, args)
}
static
PyObject
*
marshal_loads
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
marshal_loads
(
PyObject
*
self
,
PyObject
*
args
)
{
RFILE
rf
;
PyObject
*
v
;
...
...
@@ -804,7 +767,7 @@ static PyMethodDef marshal_methods[] = {
};
void
PyMarshal_Init
()
PyMarshal_Init
(
void
)
{
(
void
)
Py_InitModule
(
"marshal"
,
marshal_methods
);
}
Python/memmove.c
View file @
709fe068
...
...
@@ -10,13 +10,10 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
/* A perhaps slow but I hope correct implementation of memmove */
extern
char
*
memcpy
();
extern
char
*
memcpy
(
char
*
,
char
*
,
int
);
char
*
memmove
(
dst
,
src
,
n
)
char
*
dst
;
char
*
src
;
int
n
;
memmove
(
char
*
dst
,
char
*
src
,
int
n
)
{
char
*
realdst
=
dst
;
if
(
n
<=
0
)
...
...
Python/modsupport.c
View file @
709fe068
...
...
@@ -42,12 +42,8 @@ static char api_version_warning[] =
This Python has API version %d, module %s has version %d.
\n
"
;
PyObject
*
Py_InitModule4
(
name
,
methods
,
doc
,
passthrough
,
module_api_version
)
char
*
name
;
PyMethodDef
*
methods
;
char
*
doc
;
PyObject
*
passthrough
;
int
module_api_version
;
Py_InitModule4
(
char
*
name
,
PyMethodDef
*
methods
,
char
*
doc
,
PyObject
*
passthrough
,
int
module_api_version
)
{
PyObject
*
m
,
*
d
,
*
v
;
PyMethodDef
*
ml
;
...
...
@@ -84,10 +80,7 @@ Py_InitModule4(name, methods, doc, passthrough, module_api_version)
/* Helper for mkvalue() to scan the length of a format */
static
int
countformat
(
char
*
format
,
int
endchar
);
static
int
countformat
(
format
,
endchar
)
char
*
format
;
int
endchar
;
static
int
countformat
(
char
*
format
,
int
endchar
)
{
int
count
=
0
;
int
level
=
0
;
...
...
@@ -137,11 +130,7 @@ static PyObject *do_mkvalue(char**, va_list *);
static
PyObject
*
do_mkdict
(
p_format
,
p_va
,
endchar
,
n
)
char
**
p_format
;
va_list
*
p_va
;
int
endchar
;
int
n
;
do_mkdict
(
char
**
p_format
,
va_list
*
p_va
,
int
endchar
,
int
n
)
{
PyObject
*
d
;
int
i
;
...
...
@@ -183,11 +172,7 @@ do_mkdict(p_format, p_va, endchar, n)
}
static
PyObject
*
do_mklist
(
p_format
,
p_va
,
endchar
,
n
)
char
**
p_format
;
va_list
*
p_va
;
int
endchar
;
int
n
;
do_mklist
(
char
**
p_format
,
va_list
*
p_va
,
int
endchar
,
int
n
)
{
PyObject
*
v
;
int
i
;
...
...
@@ -224,11 +209,7 @@ _ustrlen(Py_UNICODE *u)
}
static
PyObject
*
do_mktuple
(
p_format
,
p_va
,
endchar
,
n
)
char
**
p_format
;
va_list
*
p_va
;
int
endchar
;
int
n
;
do_mktuple
(
char
**
p_format
,
va_list
*
p_va
,
int
endchar
,
int
n
)
{
PyObject
*
v
;
int
i
;
...
...
@@ -256,9 +237,7 @@ do_mktuple(p_format, p_va, endchar, n)
}
static
PyObject
*
do_mkvalue
(
p_format
,
p_va
)
char
**
p_format
;
va_list
*
p_va
;
do_mkvalue
(
char
**
p_format
,
va_list
*
p_va
)
{
for
(;;)
{
switch
(
*
(
*
p_format
)
++
)
{
...
...
@@ -401,32 +380,18 @@ do_mkvalue(p_format, p_va)
}
#ifdef HAVE_STDARG_PROTOTYPES
/* VARARGS 2 */
PyObject
*
Py_BuildValue
(
char
*
format
,
...)
#else
/* VARARGS */
PyObject
*
Py_BuildValue
(
va_alist
)
va_dcl
#endif
{
va_list
va
;
PyObject
*
retval
;
#ifdef HAVE_STDARG_PROTOTYPES
va_start
(
va
,
format
);
#else
char
*
format
;
va_start
(
va
);
format
=
va_arg
(
va
,
char
*
);
#endif
retval
=
Py_VaBuildValue
(
format
,
va
);
va_end
(
va
);
return
retval
;
}
PyObject
*
Py_VaBuildValue
(
format
,
va
)
char
*
format
;
va_list
va
;
Py_VaBuildValue
(
char
*
format
,
va_list
va
)
{
char
*
f
=
format
;
int
n
=
countformat
(
f
,
'\0'
);
...
...
@@ -450,26 +415,14 @@ Py_VaBuildValue(format, va)
}
#ifdef HAVE_STDARG_PROTOTYPES
PyObject
*
PyEval_CallFunction
(
PyObject
*
obj
,
char
*
format
,
...)
#else
PyObject
*
PyEval_CallFunction
(
obj
,
format
,
va_alist
)
PyObject
*
obj
;
char
*
format
;
va_dcl
#endif
{
va_list
vargs
;
PyObject
*
args
;
PyObject
*
res
;
#ifdef HAVE_STDARG_PROTOTYPES
va_start
(
vargs
,
format
);
#else
va_start
(
vargs
);
#endif
args
=
Py_VaBuildValue
(
format
,
vargs
);
va_end
(
vargs
);
...
...
@@ -484,17 +437,8 @@ PyEval_CallFunction(obj, format, va_alist)
}
#ifdef HAVE_STDARG_PROTOTYPES
PyObject
*
PyEval_CallMethod
(
PyObject
*
obj
,
char
*
methodname
,
char
*
format
,
...)
#else
PyObject
*
PyEval_CallMethod
(
obj
,
methodname
,
format
,
va_alist
)
PyObject
*
obj
;
char
*
methodname
;
char
*
format
;
va_dcl
#endif
{
va_list
vargs
;
PyObject
*
meth
;
...
...
@@ -505,11 +449,7 @@ PyEval_CallMethod(obj, methodname, format, va_alist)
if
(
meth
==
NULL
)
return
NULL
;
#ifdef HAVE_STDARG_PROTOTYPES
va_start
(
vargs
,
format
);
#else
va_start
(
vargs
);
#endif
args
=
Py_VaBuildValue
(
format
,
vargs
);
va_end
(
vargs
);
...
...
Python/mystrtoul.c
View file @
709fe068
...
...
@@ -44,10 +44,7 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#endif
unsigned
long
PyOS_strtoul
(
str
,
ptr
,
base
)
register
char
*
str
;
char
**
ptr
;
int
base
;
PyOS_strtoul
(
register
char
*
str
,
char
**
ptr
,
int
base
)
{
register
unsigned
long
result
;
/* return value of the function */
register
int
c
;
/* current input character */
...
...
@@ -137,10 +134,7 @@ int base;
}
long
PyOS_strtol
(
str
,
ptr
,
base
)
char
*
str
;
char
**
ptr
;
int
base
;
PyOS_strtol
(
char
*
str
,
char
**
ptr
,
int
base
)
{
long
result
;
char
sign
;
...
...
Python/pyfpe.c
View file @
709fe068
...
...
@@ -17,8 +17,7 @@ int PyFPE_counter = 0;
warning when compiling an empty file. */
double
PyFPE_dummy
(
dummy
)
void
*
dummy
;
PyFPE_dummy
(
void
*
dummy
)
{
return
1
.
0
;
}
Python/pystate.c
View file @
709fe068
...
...
@@ -37,7 +37,7 @@ PyThreadState *_PyThreadState_Current = NULL;
PyInterpreterState
*
PyInterpreterState_New
()
PyInterpreterState_New
(
void
)
{
PyInterpreterState
*
interp
=
PyMem_NEW
(
PyInterpreterState
,
1
);
...
...
@@ -58,8 +58,7 @@ PyInterpreterState_New()
void
PyInterpreterState_Clear
(
interp
)
PyInterpreterState
*
interp
;
PyInterpreterState_Clear
(
PyInterpreterState
*
interp
)
{
PyThreadState
*
p
;
HEAD_LOCK
();
...
...
@@ -73,8 +72,7 @@ PyInterpreterState_Clear(interp)
static
void
zapthreads
(
interp
)
PyInterpreterState
*
interp
;
zapthreads
(
PyInterpreterState
*
interp
)
{
PyThreadState
*
p
;
/* No need to lock the mutex here because this should only happen
...
...
@@ -86,8 +84,7 @@ zapthreads(interp)
void
PyInterpreterState_Delete
(
interp
)
PyInterpreterState
*
interp
;
PyInterpreterState_Delete
(
PyInterpreterState
*
interp
)
{
PyInterpreterState
**
p
;
zapthreads
(
interp
);
...
...
@@ -106,8 +103,7 @@ PyInterpreterState_Delete(interp)
PyThreadState
*
PyThreadState_New
(
interp
)
PyInterpreterState
*
interp
;
PyThreadState_New
(
PyInterpreterState
*
interp
)
{
PyThreadState
*
tstate
=
PyMem_NEW
(
PyThreadState
,
1
);
...
...
@@ -143,8 +139,7 @@ PyThreadState_New(interp)
void
PyThreadState_Clear
(
tstate
)
PyThreadState
*
tstate
;
PyThreadState_Clear
(
PyThreadState
*
tstate
)
{
if
(
Py_VerboseFlag
&&
tstate
->
frame
!=
NULL
)
fprintf
(
stderr
,
...
...
@@ -168,8 +163,7 @@ PyThreadState_Clear(tstate)
void
PyThreadState_Delete
(
tstate
)
PyThreadState
*
tstate
;
PyThreadState_Delete
(
PyThreadState
*
tstate
)
{
PyInterpreterState
*
interp
;
PyThreadState
**
p
;
...
...
@@ -195,7 +189,7 @@ PyThreadState_Delete(tstate)
PyThreadState
*
PyThreadState_Get
()
PyThreadState_Get
(
void
)
{
if
(
_PyThreadState_Current
==
NULL
)
Py_FatalError
(
"PyThreadState_Get: no current thread"
);
...
...
@@ -205,8 +199,7 @@ PyThreadState_Get()
PyThreadState
*
PyThreadState_Swap
(
new
)
PyThreadState
*
new
;
PyThreadState_Swap
(
PyThreadState
*
new
)
{
PyThreadState
*
old
=
_PyThreadState_Current
;
...
...
@@ -222,7 +215,7 @@ PyThreadState_Swap(new)
likely MemoryError) and the caller should pass on the exception. */
PyObject
*
PyThreadState_GetDict
()
PyThreadState_GetDict
(
void
)
{
if
(
_PyThreadState_Current
==
NULL
)
Py_FatalError
(
"PyThreadState_GetDict: no current thread"
);
...
...
Python/pythonrun.c
View file @
709fe068
...
...
@@ -37,7 +37,7 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#ifdef macintosh
#include "macglue.h"
#endif
extern
char
*
Py_GetPath
();
extern
char
*
Py_GetPath
(
void
);
extern
grammar
_PyParser_Grammar
;
/* From graminit.c */
...
...
@@ -59,10 +59,10 @@ static void call_ll_exitfuncs(void);
int
_Py_AskYesNo
(
char
*
prompt
);
#endif
extern
void
_PyUnicode_Init
();
extern
void
_PyUnicode_Fini
();
extern
void
_PyCodecRegistry_Init
();
extern
void
_PyCodecRegistry_Fini
();
extern
void
_PyUnicode_Init
(
void
);
extern
void
_PyUnicode_Fini
(
void
);
extern
void
_PyCodecRegistry_Init
(
void
);
extern
void
_PyCodecRegistry_Fini
(
void
);
int
Py_DebugFlag
;
/* Needed by parser.c */
...
...
@@ -78,7 +78,7 @@ static int initialized = 0;
/* API to access the initialized flag -- useful for esoteric use */
int
Py_IsInitialized
()
Py_IsInitialized
(
void
)
{
return
initialized
;
}
...
...
@@ -96,7 +96,7 @@ Py_IsInitialized()
*/
void
Py_Initialize
()
Py_Initialize
(
void
)
{
PyInterpreterState
*
interp
;
PyThreadState
*
tstate
;
...
...
@@ -185,7 +185,7 @@ extern void dump_counts(void);
*/
void
Py_Finalize
()
Py_Finalize
(
void
)
{
PyInterpreterState
*
interp
;
PyThreadState
*
tstate
;
...
...
@@ -283,7 +283,7 @@ Py_Finalize()
*/
PyThreadState
*
Py_NewInterpreter
()
Py_NewInterpreter
(
void
)
{
PyInterpreterState
*
interp
;
PyThreadState
*
tstate
,
*
save_tstate
;
...
...
@@ -352,8 +352,7 @@ Py_NewInterpreter()
*/
void
Py_EndInterpreter
(
tstate
)
PyThreadState
*
tstate
;
Py_EndInterpreter
(
PyThreadState
*
tstate
)
{
PyInterpreterState
*
interp
=
tstate
->
interp
;
...
...
@@ -373,15 +372,14 @@ Py_EndInterpreter(tstate)
static
char
*
progname
=
"python"
;
void
Py_SetProgramName
(
pn
)
char
*
pn
;
Py_SetProgramName
(
char
*
pn
)
{
if
(
pn
&&
*
pn
)
progname
=
pn
;
}
char
*
Py_GetProgramName
()
Py_GetProgramName
(
void
)
{
return
progname
;
}
...
...
@@ -389,14 +387,13 @@ Py_GetProgramName()
static
char
*
default_home
=
NULL
;
void
Py_SetPythonHome
(
home
)
char
*
home
;
Py_SetPythonHome
(
char
*
home
)
{
default_home
=
home
;
}
char
*
Py_GetPythonHome
()
Py_GetPythonHome
(
void
)
{
char
*
home
=
default_home
;
if
(
home
==
NULL
)
...
...
@@ -407,7 +404,7 @@ Py_GetPythonHome()
/* Create __main__ module */
static
void
initmain
()
initmain
(
void
)
{
PyObject
*
m
,
*
d
;
m
=
PyImport_AddModule
(
"__main__"
);
...
...
@@ -426,7 +423,7 @@ initmain()
/* Import the site module (not into __main__ though) */
static
void
initsite
()
initsite
(
void
)
{
PyObject
*
m
,
*
f
;
m
=
PyImport_ImportModule
(
"site"
);
...
...
@@ -451,9 +448,7 @@ initsite()
/* Parse input from a file and execute it */
int
PyRun_AnyFile
(
fp
,
filename
)
FILE
*
fp
;
char
*
filename
;
PyRun_AnyFile
(
FILE
*
fp
,
char
*
filename
)
{
if
(
filename
==
NULL
)
filename
=
"???"
;
...
...
@@ -464,9 +459,7 @@ PyRun_AnyFile(fp, filename)
}
int
PyRun_InteractiveLoop
(
fp
,
filename
)
FILE
*
fp
;
char
*
filename
;
PyRun_InteractiveLoop
(
FILE
*
fp
,
char
*
filename
)
{
PyObject
*
v
;
int
ret
;
...
...
@@ -495,9 +488,7 @@ PyRun_InteractiveLoop(fp, filename)
}
int
PyRun_InteractiveOne
(
fp
,
filename
)
FILE
*
fp
;
char
*
filename
;
PyRun_InteractiveOne
(
FILE
*
fp
,
char
*
filename
)
{
PyObject
*
m
,
*
d
,
*
v
,
*
w
;
node
*
n
;
...
...
@@ -549,9 +540,7 @@ PyRun_InteractiveOne(fp, filename)
}
int
PyRun_SimpleFile
(
fp
,
filename
)
FILE
*
fp
;
char
*
filename
;
PyRun_SimpleFile
(
FILE
*
fp
,
char
*
filename
)
{
PyObject
*
m
,
*
d
,
*
v
;
char
*
ext
;
...
...
@@ -592,8 +581,7 @@ PyRun_SimpleFile(fp, filename)
}
int
PyRun_SimpleString
(
command
)
char
*
command
;
PyRun_SimpleString
(
char
*
command
)
{
PyObject
*
m
,
*
d
,
*
v
;
m
=
PyImport_AddModule
(
"__main__"
);
...
...
@@ -612,13 +600,8 @@ PyRun_SimpleString(command)
}
static
int
parse_syntax_error
(
err
,
message
,
filename
,
lineno
,
offset
,
text
)
PyObject
*
err
;
PyObject
**
message
;
char
**
filename
;
int
*
lineno
;
int
*
offset
;
char
**
text
;
parse_syntax_error
(
PyObject
*
err
,
PyObject
**
message
,
char
**
filename
,
int
*
lineno
,
int
*
offset
,
char
**
text
)
{
long
hold
;
PyObject
*
v
;
...
...
@@ -675,14 +658,13 @@ finally:
}
void
PyErr_Print
()
PyErr_Print
(
void
)
{
PyErr_PrintEx
(
1
);
}
void
PyErr_PrintEx
(
set_sys_last_vars
)
int
set_sys_last_vars
;
PyErr_PrintEx
(
int
set_sys_last_vars
)
{
int
err
=
0
;
PyObject
*
exception
,
*
v
,
*
tb
,
*
f
;
...
...
@@ -853,31 +835,22 @@ PyErr_PrintEx(set_sys_last_vars)
}
PyObject
*
PyRun_String
(
str
,
start
,
globals
,
locals
)
char
*
str
;
int
start
;
PyObject
*
globals
,
*
locals
;
PyRun_String
(
char
*
str
,
int
start
,
PyObject
*
globals
,
PyObject
*
locals
)
{
return
run_err_node
(
PyParser_SimpleParseString
(
str
,
start
),
"<string>"
,
globals
,
locals
);
}
PyObject
*
PyRun_File
(
fp
,
filename
,
start
,
globals
,
locals
)
FILE
*
fp
;
char
*
filename
;
int
start
;
PyObject
*
globals
,
*
locals
;
PyRun_File
(
FILE
*
fp
,
char
*
filename
,
int
start
,
PyObject
*
globals
,
PyObject
*
locals
)
{
return
run_err_node
(
PyParser_SimpleParseFile
(
fp
,
filename
,
start
),
filename
,
globals
,
locals
);
}
static
PyObject
*
run_err_node
(
n
,
filename
,
globals
,
locals
)
node
*
n
;
char
*
filename
;
PyObject
*
globals
,
*
locals
;
run_err_node
(
node
*
n
,
char
*
filename
,
PyObject
*
globals
,
PyObject
*
locals
)
{
if
(
n
==
NULL
)
return
NULL
;
...
...
@@ -885,10 +858,7 @@ run_err_node(n, filename, globals, locals)
}
static
PyObject
*
run_node
(
n
,
filename
,
globals
,
locals
)
node
*
n
;
char
*
filename
;
PyObject
*
globals
,
*
locals
;
run_node
(
node
*
n
,
char
*
filename
,
PyObject
*
globals
,
PyObject
*
locals
)
{
PyCodeObject
*
co
;
PyObject
*
v
;
...
...
@@ -902,10 +872,7 @@ run_node(n, filename, globals, locals)
}
static
PyObject
*
run_pyc_file
(
fp
,
filename
,
globals
,
locals
)
FILE
*
fp
;
char
*
filename
;
PyObject
*
globals
,
*
locals
;
run_pyc_file
(
FILE
*
fp
,
char
*
filename
,
PyObject
*
globals
,
PyObject
*
locals
)
{
PyCodeObject
*
co
;
PyObject
*
v
;
...
...
@@ -934,10 +901,7 @@ run_pyc_file(fp, filename, globals, locals)
}
PyObject
*
Py_CompileString
(
str
,
filename
,
start
)
char
*
str
;
char
*
filename
;
int
start
;
Py_CompileString
(
char
*
str
,
char
*
filename
,
int
start
)
{
node
*
n
;
PyCodeObject
*
co
;
...
...
@@ -952,10 +916,7 @@ Py_CompileString(str, filename, start)
/* Simplified interface to parsefile -- return node or set exception */
node
*
PyParser_SimpleParseFile
(
fp
,
filename
,
start
)
FILE
*
fp
;
char
*
filename
;
int
start
;
PyParser_SimpleParseFile
(
FILE
*
fp
,
char
*
filename
,
int
start
)
{
node
*
n
;
perrdetail
err
;
...
...
@@ -969,9 +930,7 @@ PyParser_SimpleParseFile(fp, filename, start)
/* Simplified interface to parsestring -- return node or set exception */
node
*
PyParser_SimpleParseString
(
str
,
start
)
char
*
str
;
int
start
;
PyParser_SimpleParseString
(
char
*
str
,
int
start
)
{
node
*
n
;
perrdetail
err
;
...
...
@@ -984,8 +943,7 @@ PyParser_SimpleParseString(str, start)
/* Set the error appropriate to the given input error code (see errcode.h) */
static
void
err_input
(
err
)
perrdetail
*
err
;
err_input
(
perrdetail
*
err
)
{
PyObject
*
v
,
*
w
,
*
errtype
;
char
*
msg
=
NULL
;
...
...
@@ -1053,8 +1011,7 @@ err_input(err)
/* Print fatal error message and abort */
void
Py_FatalError
(
msg
)
char
*
msg
;
Py_FatalError
(
char
*
msg
)
{
fprintf
(
stderr
,
"Fatal Python error: %s
\n
"
,
msg
);
#ifdef macintosh
...
...
@@ -1079,11 +1036,10 @@ int _PyThread_Started = 0; /* Set by threadmodule.c and maybe others */
#endif
#define NEXITFUNCS 32
static
void
(
*
exitfuncs
[
NEXITFUNCS
])();
static
void
(
*
exitfuncs
[
NEXITFUNCS
])(
void
);
static
int
nexitfuncs
=
0
;
int
Py_AtExit
(
func
)
void
(
*
func
)(
void
);
int
Py_AtExit
(
void
(
*
func
)(
void
))
{
if
(
nexitfuncs
>=
NEXITFUNCS
)
return
-
1
;
...
...
@@ -1092,7 +1048,7 @@ int Py_AtExit(func)
}
static
void
call_sys_exitfunc
()
call_sys_exitfunc
(
void
)
{
PyObject
*
exitfunc
=
PySys_GetObject
(
"exitfunc"
);
...
...
@@ -1115,7 +1071,7 @@ call_sys_exitfunc()
}
static
void
call_ll_exitfuncs
()
call_ll_exitfuncs
(
void
)
{
while
(
nexitfuncs
>
0
)
(
*
exitfuncs
[
--
nexitfuncs
])();
...
...
@@ -1125,8 +1081,7 @@ call_ll_exitfuncs()
}
void
Py_Exit
(
sts
)
int
sts
;
Py_Exit
(
int
sts
)
{
Py_Finalize
();
...
...
@@ -1138,7 +1093,7 @@ Py_Exit(sts)
}
static
void
initsigs
()
initsigs
(
void
)
{
#ifdef HAVE_SIGNAL_H
#ifdef SIGPIPE
...
...
@@ -1152,8 +1107,7 @@ initsigs()
/* Ask a yes/no question */
int
_Py_AskYesNo
(
prompt
)
char
*
prompt
;
_Py_AskYesNo
(
char
*
prompt
)
{
char
buf
[
256
];
...
...
@@ -1170,8 +1124,7 @@ _Py_AskYesNo(prompt)
Pretend that stdin is always interactive, other files never. */
int
isatty
(
fd
)
int
fd
;
isatty
(
int
fd
)
{
return
fd
==
fileno
(
stdin
);
}
...
...
@@ -1185,9 +1138,7 @@ isatty(fd)
* the descriptor is NULL or "<stdin>" or "???".
*/
int
Py_FdIsInteractive
(
fp
,
filename
)
FILE
*
fp
;
char
*
filename
;
Py_FdIsInteractive
(
FILE
*
fp
,
char
*
filename
)
{
if
(
isatty
((
int
)
fileno
(
fp
)))
return
1
;
...
...
Python/sigcheck.c
View file @
709fe068
...
...
@@ -19,7 +19,7 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
/* ARGSUSED */
int
PyErr_CheckSignals
()
PyErr_CheckSignals
(
void
)
{
if
(
!
PyOS_InterruptOccurred
())
return
0
;
...
...
Python/strdup.c
View file @
709fe068
...
...
@@ -3,8 +3,7 @@
#include "pgenheaders.h"
char
*
strdup
(
str
)
const
char
*
str
;
strdup
(
const
char
*
str
)
{
if
(
str
!=
NULL
)
{
register
char
*
copy
=
malloc
(
strlen
(
str
)
+
1
);
...
...
Python/strerror.c
View file @
709fe068
...
...
@@ -17,8 +17,7 @@ extern int sys_nerr;
extern
char
*
sys_errlist
[];
char
*
strerror
(
err
)
int
err
;
strerror
(
int
err
)
{
static
char
buf
[
20
];
if
(
err
>=
0
&&
err
<
sys_nerr
)
...
...
Python/strtod.c
View file @
709fe068
...
...
@@ -52,17 +52,15 @@ static int MDMAXEXPT = { 309};
static
char
MDMAXFRAC
[]
=
"17976931348623157"
;
static
double
HUGE
=
1.7976931348623157e308
;
extern
double
atof
();
/* Only called when result known to be ok */
extern
double
atof
(
const
char
*
);
/* Only called when result known to be ok */
#ifndef DONT_HAVE_ERRNO_H
#include <errno.h>
#endif
extern
int
errno
;
double
strtod
(
str
,
ptr
)
char
*
str
;
char
**
ptr
;
{
double
strtod
(
char
*
str
,
char
**
ptr
)
{
int
sign
,
scale
,
dotseen
;
int
esign
,
expt
;
char
*
save
;
...
...
@@ -155,4 +153,4 @@ double strtod(str, ptr)
(
void
)
sprintf
(
dp
,
"E%d"
,
expt
);
errno
=
0
;
return
atof
(
buffer
)
*
sign
;
}
}
Python/structmember.c
View file @
709fe068
...
...
@@ -15,8 +15,7 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#include "structmember.h"
static
PyObject
*
listmembers
(
mlist
)
struct
memberlist
*
mlist
;
listmembers
(
struct
memberlist
*
mlist
)
{
int
i
,
n
;
PyObject
*
v
;
...
...
@@ -39,10 +38,7 @@ listmembers(mlist)
}
PyObject
*
PyMember_Get
(
addr
,
mlist
,
name
)
char
*
addr
;
struct
memberlist
*
mlist
;
char
*
name
;
PyMember_Get
(
char
*
addr
,
struct
memberlist
*
mlist
,
char
*
name
)
{
struct
memberlist
*
l
;
...
...
@@ -139,11 +135,7 @@ PyMember_Get(addr, mlist, name)
}
int
PyMember_Set
(
addr
,
mlist
,
name
,
v
)
char
*
addr
;
struct
memberlist
*
mlist
;
char
*
name
;
PyObject
*
v
;
PyMember_Set
(
char
*
addr
,
struct
memberlist
*
mlist
,
char
*
name
,
PyObject
*
v
)
{
struct
memberlist
*
l
;
PyObject
*
oldv
;
...
...
Python/sysmodule.c
View file @
709fe068
...
...
@@ -38,8 +38,7 @@ extern const char *PyWin_DLLVersionString;
#endif
PyObject
*
PySys_GetObject
(
name
)
char
*
name
;
PySys_GetObject
(
char
*
name
)
{
PyThreadState
*
tstate
=
PyThreadState_Get
();
PyObject
*
sd
=
tstate
->
interp
->
sysdict
;
...
...
@@ -49,9 +48,7 @@ PySys_GetObject(name)
}
FILE
*
PySys_GetFile
(
name
,
def
)
char
*
name
;
FILE
*
def
;
PySys_GetFile
(
char
*
name
,
FILE
*
def
)
{
FILE
*
fp
=
NULL
;
PyObject
*
v
=
PySys_GetObject
(
name
);
...
...
@@ -63,9 +60,7 @@ PySys_GetFile(name, def)
}
int
PySys_SetObject
(
name
,
v
)
char
*
name
;
PyObject
*
v
;
PySys_SetObject
(
char
*
name
,
PyObject
*
v
)
{
PyThreadState
*
tstate
=
PyThreadState_Get
();
PyObject
*
sd
=
tstate
->
interp
->
sysdict
;
...
...
@@ -80,9 +75,7 @@ PySys_SetObject(name, v)
}
static
PyObject
*
sys_exc_info
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
sys_exc_info
(
PyObject
*
self
,
PyObject
*
args
)
{
PyThreadState
*
tstate
;
if
(
!
PyArg_ParseTuple
(
args
,
":exc_info"
))
...
...
@@ -103,9 +96,7 @@ Return information about the exception that is currently being handled.\n\
This should be called from inside an except clause only."
;
static
PyObject
*
sys_exit
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
sys_exit
(
PyObject
*
self
,
PyObject
*
args
)
{
/* Raise SystemExit so callers may catch it or clean up. */
PyErr_SetObject
(
PyExc_SystemExit
,
args
);
...
...
@@ -122,9 +113,7 @@ If it is another kind of object, it will be printed and the system\n\
exit status will be one (i.e., failure)."
;
static
PyObject
*
sys_getdefaultencoding
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
sys_getdefaultencoding
(
PyObject
*
self
,
PyObject
*
args
)
{
if
(
!
PyArg_ParseTuple
(
args
,
":getdefaultencoding"
))
return
NULL
;
...
...
@@ -138,9 +127,7 @@ Return the current default string encoding used by the Unicode \n\
implementation."
;
static
PyObject
*
sys_setdefaultencoding
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
sys_setdefaultencoding
(
PyObject
*
self
,
PyObject
*
args
)
{
char
*
encoding
;
if
(
!
PyArg_ParseTuple
(
args
,
"s:setdefaultencoding"
,
&
encoding
))
...
...
@@ -157,9 +144,7 @@ static char setdefaultencoding_doc[] =
Set the current default string encoding used by the Unicode implementation."
;
static
PyObject
*
sys_settrace
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
sys_settrace
(
PyObject
*
self
,
PyObject
*
args
)
{
PyThreadState
*
tstate
=
PyThreadState_Get
();
if
(
args
==
Py_None
)
...
...
@@ -179,9 +164,7 @@ Set the global debug tracing function. It will be called on each\n\
function call. See the debugger chapter in the library manual."
;
static
PyObject
*
sys_setprofile
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
sys_setprofile
(
PyObject
*
self
,
PyObject
*
args
)
{
PyThreadState
*
tstate
=
PyThreadState_Get
();
if
(
args
==
Py_None
)
...
...
@@ -201,9 +184,7 @@ Set the profiling function. It will be called on each function call\n\
and return. See the profiler chapter in the library manual."
;
static
PyObject
*
sys_setcheckinterval
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
sys_setcheckinterval
(
PyObject
*
self
,
PyObject
*
args
)
{
PyThreadState
*
tstate
=
PyThreadState_Get
();
if
(
!
PyArg_ParseTuple
(
args
,
"i:setcheckinterval"
,
&
tstate
->
interp
->
checkinterval
))
...
...
@@ -223,9 +204,7 @@ n instructions. This also affects how often thread switches occur.";
#include <malloc.h>
static
PyObject
*
sys_mdebug
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
sys_mdebug
(
PyObject
*
self
,
PyObject
*
args
)
{
int
flag
;
if
(
!
PyArg_ParseTuple
(
args
,
"i:mdebug"
,
&
flag
))
...
...
@@ -237,9 +216,7 @@ sys_mdebug(self, args)
#endif
/* USE_MALLOPT */
static
PyObject
*
sys_getrefcount
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
sys_getrefcount
(
PyObject
*
self
,
PyObject
*
args
)
{
PyObject
*
arg
;
if
(
!
PyArg_ParseTuple
(
args
,
"O:getrefcount"
,
&
arg
))
...
...
@@ -267,8 +244,7 @@ temporary reference in the argument list, so it is at least 2.";
#ifdef COUNT_ALLOCS
static
PyObject
*
sys_getcounts
(
self
,
args
)
PyObject
*
self
,
*
args
;
sys_getcounts
(
PyObject
*
self
,
PyObject
*
args
)
{
extern
PyObject
*
get_counts
(
void
);
...
...
@@ -315,7 +291,7 @@ static PyMethodDef sys_methods[] = {
};
static
PyObject
*
list_builtin_module_names
()
list_builtin_module_names
(
void
)
{
PyObject
*
list
=
PyList_New
(
0
);
int
i
;
...
...
@@ -407,7 +383,7 @@ settrace() -- set the global debug tracing function\n\
#endif
PyObject
*
_PySys_Init
()
_PySys_Init
(
void
)
{
extern
int
fclose
(
FILE
*
);
PyObject
*
m
,
*
v
,
*
sysdict
;
...
...
@@ -495,9 +471,7 @@ _PySys_Init()
}
static
PyObject
*
makepathobject
(
path
,
delim
)
char
*
path
;
int
delim
;
makepathobject
(
char
*
path
,
int
delim
)
{
int
i
,
n
;
char
*
p
;
...
...
@@ -530,8 +504,7 @@ makepathobject(path, delim)
}
void
PySys_SetPath
(
path
)
char
*
path
;
PySys_SetPath
(
char
*
path
)
{
PyObject
*
v
;
if
((
v
=
makepathobject
(
path
,
DELIM
))
==
NULL
)
...
...
@@ -542,9 +515,7 @@ PySys_SetPath(path)
}
static
PyObject
*
makeargvobject
(
argc
,
argv
)
int
argc
;
char
**
argv
;
makeargvobject
(
int
argc
,
char
**
argv
)
{
PyObject
*
av
;
if
(
argc
<=
0
||
argv
==
NULL
)
{
...
...
@@ -570,9 +541,7 @@ makeargvobject(argc, argv)
}
void
PySys_SetArgv
(
argc
,
argv
)
int
argc
;
char
**
argv
;
PySys_SetArgv
(
int
argc
,
char
**
argv
)
{
PyObject
*
av
=
makeargvobject
(
argc
,
argv
);
PyObject
*
path
=
PySys_GetObject
(
"path"
);
...
...
@@ -674,11 +643,7 @@ PySys_SetArgv(argc, argv)
*/
static
void
mywrite
(
name
,
fp
,
format
,
va
)
char
*
name
;
FILE
*
fp
;
const
char
*
format
;
va_list
va
;
mywrite
(
char
*
name
,
FILE
*
fp
,
const
char
*
format
,
va_list
va
)
{
PyObject
*
file
;
PyObject
*
error_type
,
*
error_value
,
*
error_traceback
;
...
...
@@ -700,43 +665,21 @@ mywrite(name, fp, format, va)
}
void
#ifdef HAVE_STDARG_PROTOTYPES
PySys_WriteStdout
(
const
char
*
format
,
...)
#else
PySys_WriteStdout
(
va_alist
)
va_dcl
#endif
{
va_list
va
;
#ifdef HAVE_STDARG_PROTOTYPES
va_start
(
va
,
format
);
#else
char
*
format
;
va_start
(
va
);
format
=
va_arg
(
va
,
char
*
);
#endif
mywrite
(
"stdout"
,
stdout
,
format
,
va
);
va_end
(
va
);
}
void
#ifdef HAVE_STDARG_PROTOTYPES
PySys_WriteStderr
(
const
char
*
format
,
...)
#else
PySys_WriteStderr
(
va_alist
)
va_dcl
#endif
{
va_list
va
;
#ifdef HAVE_STDARG_PROTOTYPES
va_start
(
va
,
format
);
#else
char
*
format
;
va_start
(
va
);
format
=
va_arg
(
va
,
char
*
);
#endif
mywrite
(
"stderr"
,
stderr
,
format
,
va
);
va_end
(
va
);
}
Python/thread.c
View file @
709fe068
...
...
@@ -29,7 +29,7 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#include <stdlib.h>
#else
#ifdef Py_DEBUG
extern
char
*
getenv
();
extern
char
*
getenv
(
const
char
*
);
#endif
#endif
...
...
@@ -73,17 +73,6 @@ extern char *getenv();
#endif
/* _POSIX_THREADS */
#ifdef __STDC__
#define _P(args) args
#define _P0() (void)
#define _P1(v,t) (t)
#define _P2(v1,t1,v2,t2) (t1,t2)
#else
#define _P(args) ()
#define _P0() ()
#define _P1(v,t) (v) t;
#define _P2(v1,t1,v2,t2) (v1,v2) t1; t2;
#endif
/* __STDC__ */
#ifdef Py_DEBUG
static
int
thread_debug
=
0
;
...
...
@@ -98,7 +87,7 @@ static int initialized;
static
void
PyThread__init_thread
();
/* Forward */
void
PyThread_init_thread
_P0
(
)
void
PyThread_init_thread
(
void
)
{
#ifdef Py_DEBUG
char
*
p
=
getenv
(
"THREADDEBUG"
);
...
...
Python/thread_cthread.h
View file @
709fe068
...
...
@@ -14,7 +14,8 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
/*
* Initialization.
*/
static
void
PyThread__init_thread
_P0
()
static
void
PyThread__init_thread
(
void
)
{
cthread_init
();
}
...
...
@@ -22,7 +23,8 @@ static void PyThread__init_thread _P0()
/*
* Thread support.
*/
int
PyThread_start_new_thread
_P2
(
func
,
void
(
*
func
)
_P
((
void
*
)),
arg
,
void
*
arg
)
int
PyThread_start_new_thread
(
func
,
void
(
*
func
)(
void
*
),
void
*
arg
)
{
int
success
=
0
;
/* init not needed when SOLARIS_THREADS and */
/* C_THREADS implemented properly */
...
...
@@ -37,14 +39,16 @@ int PyThread_start_new_thread _P2(func, void (*func) _P((void *)), arg, void *ar
return
success
<
0
?
0
:
1
;
}
long
PyThread_get_thread_ident
_P0
()
long
PyThread_get_thread_ident
(
void
)
{
if
(
!
initialized
)
PyThread_init_thread
();
return
(
long
)
cthread_self
();
}
static
void
do_PyThread_exit_thread
_P1
(
no_cleanup
,
int
no_cleanup
)
static
void
do_PyThread_exit_thread
(
int
no_cleanup
)
{
dprintf
((
"PyThread_exit_thread called
\n
"
));
if
(
!
initialized
)
...
...
@@ -55,18 +59,21 @@ static void do_PyThread_exit_thread _P1(no_cleanup, int no_cleanup)
cthread_exit
(
0
);
}
void
PyThread_exit_thread
_P0
()
void
PyThread_exit_thread
(
void
)
{
do_PyThread_exit_thread
(
0
);
}
void
PyThread__exit_thread
_P0
()
void
PyThread__exit_thread
(
void
)
{
do_PyThread_exit_thread
(
1
);
}
#ifndef NO_EXIT_PROG
static
void
do_PyThread_exit_prog
_P2
(
status
,
int
status
,
no_cleanup
,
int
no_cleanup
)
static
void
do_PyThread_exit_prog
(
int
status
,
int
no_cleanup
)
{
dprintf
((
"PyThread_exit_prog(%d) called
\n
"
,
status
));
if
(
!
initialized
)
...
...
@@ -80,12 +87,14 @@ static void do_PyThread_exit_prog _P2(status, int status, no_cleanup, int no_cle
exit
(
status
);
}
void
PyThread_exit_prog
_P1
(
status
,
int
status
)
void
PyThread_exit_prog
(
int
status
)
{
do_PyThread_exit_prog
(
status
,
0
);
}
void
PyThread__exit_prog
_P1
(
status
,
int
status
)
void
PyThread__exit_prog
(
int
status
)
{
do_PyThread_exit_prog
(
status
,
1
);
}
...
...
@@ -94,7 +103,8 @@ void PyThread__exit_prog _P1(status, int status)
/*
* Lock support.
*/
PyThread_type_lock
PyThread_allocate_lock
_P0
()
PyThread_type_lock
PyThread_allocate_lock
(
void
)
{
mutex_t
lock
;
...
...
@@ -112,13 +122,15 @@ PyThread_type_lock PyThread_allocate_lock _P0()
return
(
PyThread_type_lock
)
lock
;
}
void
PyThread_free_lock
_P1
(
lock
,
PyThread_type_lock
lock
)
void
PyThread_free_lock
(
PyThread_type_lock
lock
)
{
dprintf
((
"PyThread_free_lock(%p) called
\n
"
,
lock
));
mutex_free
(
lock
);
}
int
PyThread_acquire_lock
_P2
(
lock
,
PyThread_type_lock
lock
,
waitflag
,
int
waitflag
)
int
PyThread_acquire_lock
(
PyThread_type_lock
lock
,
int
waitflag
)
{
int
success
=
FALSE
;
...
...
@@ -133,7 +145,8 @@ int PyThread_acquire_lock _P2(lock, PyThread_type_lock lock, waitflag, int waitf
return
success
;
}
void
PyThread_release_lock
_P1
(
lock
,
PyThread_type_lock
lock
)
void
PyThread_release_lock
(
PyThread_type_lock
lock
)
{
dprintf
((
"PyThread_release_lock(%p) called
\n
"
,
lock
));
mutex_unlock
((
mutex_t
)
lock
);
...
...
@@ -153,7 +166,8 @@ void PyThread_release_lock _P1(lock, PyThread_type_lock lock)
* semaphore using a condition.
*
*/
PyThread_type_sema
PyThread_allocate_sema
_P1
(
value
,
int
value
)
PyThread_type_sema
PyThread_allocate_sema
(
int
value
)
{
char
*
sema
=
0
;
dprintf
((
"PyThread_allocate_sema called
\n
"
));
...
...
@@ -164,19 +178,22 @@ PyThread_type_sema PyThread_allocate_sema _P1(value, int value)
return
(
PyThread_type_sema
)
sema
;
}
void
PyThread_free_sema
_P1
(
sema
,
PyThread_type_sema
sema
)
void
PyThread_free_sema
(
PyThread_type_sema
sema
)
{
dprintf
((
"PyThread_free_sema(%p) called
\n
"
,
sema
));
}
int
PyThread_down_sema
_P2
(
sema
,
PyThread_type_sema
sema
,
waitflag
,
int
waitflag
)
int
PyThread_down_sema
(
PyThread_type_sema
sema
,
int
waitflag
)
{
dprintf
((
"PyThread_down_sema(%p, %d) called
\n
"
,
sema
,
waitflag
));
dprintf
((
"PyThread_down_sema(%p) return
\n
"
,
sema
));
return
-
1
;
}
void
PyThread_up_sema
_P1
(
sema
,
PyThread_type_sema
sema
)
void
PyThread_up_sema
(
PyThread_type_sema
sema
)
{
dprintf
((
"PyThread_up_sema(%p)
\n
"
,
sema
));
}
Python/thread_foobar.h
View file @
709fe068
...
...
@@ -11,14 +11,16 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
/*
* Initialization.
*/
static
void
PyThread__init_thread
_P0
()
static
void
PyThread__init_thread
(
void
)
{
}
/*
* Thread support.
*/
int
PyThread_start_new_thread
_P2
(
func
,
void
(
*
func
)
_P
((
void
*
)),
arg
,
void
*
arg
)
int
PyThread_start_new_thread
(
void
(
*
func
)(
void
*
),
void
*
arg
)
{
int
success
=
0
;
/* init not needed when SOLARIS_THREADS and */
/* C_THREADS implemented properly */
...
...
@@ -29,13 +31,15 @@ int PyThread_start_new_thread _P2(func, void (*func) _P((void *)), arg, void *ar
return
success
<
0
?
0
:
1
;
}
long
PyThread_get_thread_ident
_P0
()
long
PyThread_get_thread_ident
(
void
)
{
if
(
!
initialized
)
PyThread_init_thread
();
}
static
void
do_PyThread_exit_thread
_P1
(
no_cleanup
,
int
no_cleanup
)
static
void
do_PyThread_exit_thread
(
int
no_cleanup
)
{
dprintf
((
"PyThread_exit_thread called
\n
"
));
if
(
!
initialized
)
...
...
@@ -45,18 +49,21 @@ static void do_PyThread_exit_thread _P1(no_cleanup, int no_cleanup)
exit
(
0
);
}
void
PyThread_exit_thread
_P0
()
void
PyThread_exit_thread
(
void
)
{
do_PyThread_exit_thread
(
0
);
}
void
PyThread__exit_thread
_P0
()
void
PyThread__exit_thread
(
void
)
{
do_PyThread_exit_thread
(
1
);
}
#ifndef NO_EXIT_PROG
static
void
do_PyThread_exit_prog
_P2
(
status
,
int
status
,
no_cleanup
,
int
no_cleanup
)
static
void
do_PyThread_exit_prog
(
int
status
,
int
no_cleanup
)
{
dprintf
((
"PyThread_exit_prog(%d) called
\n
"
,
status
));
if
(
!
initialized
)
...
...
@@ -66,12 +73,14 @@ static void do_PyThread_exit_prog _P2(status, int status, no_cleanup, int no_cle
exit
(
status
);
}
void
PyThread_exit_prog
_P1
(
status
,
int
status
)
void
PyThread_exit_prog
(
int
status
)
{
do_PyThread_exit_prog
(
status
,
0
);
}
void
PyThread__exit_prog
_P1
(
status
,
int
status
)
void
PyThread__exit_prog
(
int
status
)
{
do_PyThread_exit_prog
(
status
,
1
);
}
...
...
@@ -80,7 +89,8 @@ void PyThread__exit_prog _P1(status, int status)
/*
* Lock support.
*/
PyThread_type_lock
PyThread_allocate_lock
_P0
()
PyThread_type_lock
PyThread_allocate_lock
(
void
)
{
dprintf
((
"PyThread_allocate_lock called
\n
"
));
...
...
@@ -91,12 +101,14 @@ PyThread_type_lock PyThread_allocate_lock _P0()
return
(
PyThread_type_lock
)
lock
;
}
void
PyThread_free_lock
_P1
(
lock
,
PyThread_type_lock
lock
)
void
PyThread_free_lock
(
PyThread_type_lock
lock
)
{
dprintf
((
"PyThread_free_lock(%p) called
\n
"
,
lock
));
}
int
PyThread_acquire_lock
_P2
(
lock
,
PyThread_type_lock
lock
,
waitflag
,
int
waitflag
)
int
PyThread_acquire_lock
(
PyThread_type_lock
lock
,
int
waitflag
)
{
int
success
;
...
...
@@ -105,7 +117,8 @@ int PyThread_acquire_lock _P2(lock, PyThread_type_lock lock, waitflag, int waitf
return
success
;
}
void
PyThread_release_lock
_P1
(
lock
,
PyThread_type_lock
lock
)
void
PyThread_release_lock
(
PyThread_type_lock
lock
)
{
dprintf
((
"PyThread_release_lock(%p) called
\n
"
,
lock
));
}
...
...
@@ -113,7 +126,8 @@ void PyThread_release_lock _P1(lock, PyThread_type_lock lock)
/*
* Semaphore support.
*/
PyThread_type_sema
PyThread_allocate_sema
_P1
(
value
,
int
value
)
PyThread_type_sema
PyThread_allocate_sema
(
int
value
)
{
dprintf
((
"PyThread_allocate_sema called
\n
"
));
if
(
!
initialized
)
...
...
@@ -123,19 +137,22 @@ PyThread_type_sema PyThread_allocate_sema _P1(value, int value)
return
(
PyThread_type_sema
)
sema
;
}
void
PyThread_free_sema
_P1
(
sema
,
PyThread_type_sema
sema
)
void
PyThread_free_sema
(
PyThread_type_sema
sema
)
{
dprintf
((
"PyThread_free_sema(%p) called
\n
"
,
sema
));
}
int
PyThread_down_sema
_P2
(
sema
,
PyThread_type_sema
sema
,
waitflag
,
int
waitflag
)
int
PyThread_down_sema
(
PyThread_type_sema
sema
,
int
waitflag
)
{
dprintf
((
"PyThread_down_sema(%p, %d) called
\n
"
,
sema
,
waitflag
));
dprintf
((
"PyThread_down_sema(%p) return
\n
"
,
sema
));
return
-
1
;
}
void
PyThread_up_sema
_P1
(
sema
,
PyThread_type_sema
sema
)
void
PyThread_up_sema
(
PyThread_type_sema
sema
)
{
dprintf
((
"PyThread_up_sema(%p)
\n
"
,
sema
));
}
Python/thread_lwp.h
View file @
709fe068
...
...
@@ -25,7 +25,7 @@ struct lock {
/*
* Initialization.
*/
static
void
PyThread__init_thread
_P0
(
)
static
void
PyThread__init_thread
(
void
)
{
lwp_setstkcache
(
STACKSIZE
,
NSTACKS
);
}
...
...
@@ -35,7 +35,7 @@ static void PyThread__init_thread _P0()
*/
int
PyThread_start_new_thread
_P2
(
func
,
void
(
*
func
)
_P
((
void
*
)),
arg
,
void
*
arg
)
int
PyThread_start_new_thread
(
void
(
*
func
)(
void
*
)
,
void
*
arg
)
{
thread_t
tid
;
int
success
;
...
...
@@ -46,7 +46,7 @@ int PyThread_start_new_thread _P2(func, void (*func) _P((void *)), arg, void *ar
return
success
<
0
?
0
:
1
;
}
long
PyThread_get_thread_ident
_P0
(
)
long
PyThread_get_thread_ident
(
void
)
{
thread_t
tid
;
if
(
!
initialized
)
...
...
@@ -56,7 +56,7 @@ long PyThread_get_thread_ident _P0()
return
tid
.
thread_id
;
}
static
void
do_PyThread_exit_thread
_P1
(
no_cleanup
,
int
no_cleanup
)
static
void
do_PyThread_exit_thread
(
int
no_cleanup
)
{
dprintf
((
"PyThread_exit_thread called
\n
"
));
if
(
!
initialized
)
...
...
@@ -67,18 +67,18 @@ static void do_PyThread_exit_thread _P1(no_cleanup, int no_cleanup)
lwp_destroy
(
SELF
);
}
void
PyThread_exit_thread
_P0
(
)
void
PyThread_exit_thread
(
void
)
{
do_PyThread_exit_thread
(
0
);
}
void
PyThread__exit_thread
_P0
(
)
void
PyThread__exit_thread
(
void
)
{
do_PyThread_exit_thread
(
1
);
}
#ifndef NO_EXIT_PROG
static
void
do_PyThread_exit_prog
_P2
(
status
,
int
status
,
no_cleanup
,
int
no_cleanup
)
static
void
do_PyThread_exit_prog
(
int
status
,
int
no_cleanup
)
{
dprintf
((
"PyThread_exit_prog(%d) called
\n
"
,
status
));
if
(
!
initialized
)
...
...
@@ -89,12 +89,12 @@ static void do_PyThread_exit_prog _P2(status, int status, no_cleanup, int no_cle
pod_exit
(
status
);
}
void
PyThread_exit_prog
_P1
(
status
,
int
status
)
void
PyThread_exit_prog
(
int
status
)
{
do_PyThread_exit_prog
(
status
,
0
);
}
void
PyThread__exit_prog
_P1
(
status
,
int
status
)
void
PyThread__exit_prog
(
int
status
)
{
do_PyThread_exit_prog
(
status
,
1
);
}
...
...
@@ -103,7 +103,7 @@ void PyThread__exit_prog _P1(status, int status)
/*
* Lock support.
*/
PyThread_type_lock
PyThread_allocate_lock
_P0
(
)
PyThread_type_lock
PyThread_allocate_lock
(
void
)
{
struct
lock
*
lock
;
extern
char
*
malloc
();
...
...
@@ -120,14 +120,14 @@ PyThread_type_lock PyThread_allocate_lock _P0()
return
(
PyThread_type_lock
)
lock
;
}
void
PyThread_free_lock
_P1
(
lock
,
PyThread_type_lock
lock
)
void
PyThread_free_lock
(
PyThread_type_lock
lock
)
{
dprintf
((
"PyThread_free_lock(%p) called
\n
"
,
lock
));
mon_destroy
(((
struct
lock
*
)
lock
)
->
lock_monitor
);
free
((
char
*
)
lock
);
}
int
PyThread_acquire_lock
_P2
(
lock
,
PyThread_type_lock
lock
,
waitflag
,
int
waitflag
)
int
PyThread_acquire_lock
(
PyThread_type_lock
lock
,
int
waitflag
)
{
int
success
;
...
...
@@ -148,7 +148,7 @@ int PyThread_acquire_lock _P2(lock, PyThread_type_lock lock, waitflag, int waitf
return
success
;
}
void
PyThread_release_lock
_P1
(
lock
,
PyThread_type_lock
lock
)
void
PyThread_release_lock
(
PyThread_type_lock
lock
)
{
dprintf
((
"PyThread_release_lock(%p) called
\n
"
,
lock
));
(
void
)
mon_enter
(((
struct
lock
*
)
lock
)
->
lock_monitor
);
...
...
@@ -160,7 +160,7 @@ void PyThread_release_lock _P1(lock, PyThread_type_lock lock)
/*
* Semaphore support.
*/
PyThread_type_sema
PyThread_allocate_sema
_P1
(
value
,
int
value
)
PyThread_type_sema
PyThread_allocate_sema
(
int
value
)
{
PyThread_type_sema
sema
=
0
;
dprintf
((
"PyThread_allocate_sema called
\n
"
));
...
...
@@ -171,19 +171,19 @@ PyThread_type_sema PyThread_allocate_sema _P1(value, int value)
return
(
PyThread_type_sema
)
sema
;
}
void
PyThread_free_sema
_P1
(
sema
,
PyThread_type_sema
sema
)
void
PyThread_free_sema
(
PyThread_type_sema
sema
)
{
dprintf
((
"PyThread_free_sema(%p) called
\n
"
,
sema
));
}
int
PyThread_down_sema
_P2
(
sema
,
PyThread_type_sema
sema
,
waitflag
,
int
waitflag
)
int
PyThread_down_sema
(
PyThread_type_sema
sema
,
int
waitflag
)
{
dprintf
((
"PyThread_down_sema(%p, %d) called
\n
"
,
sema
,
waitflag
));
dprintf
((
"PyThread_down_sema(%p) return
\n
"
,
sema
));
return
-
1
;
}
void
PyThread_up_sema
_P1
(
sema
,
PyThread_type_sema
sema
)
void
PyThread_up_sema
(
PyThread_type_sema
sema
)
{
dprintf
((
"PyThread_up_sema(%p)
\n
"
,
sema
));
}
Python/thread_nt.h
View file @
709fe068
...
...
@@ -122,7 +122,7 @@ BOOL LeaveNonRecursiveMutex(PNRMUTEX mutex)
SetEvent
(
mutex
->
hevent
)
;
/* Other threads are waiting, wake one on them up */
}
PNRMUTEX
AllocNonRecursiveMutex
()
PNRMUTEX
AllocNonRecursiveMutex
(
void
)
{
PNRMUTEX
mutex
=
(
PNRMUTEX
)
malloc
(
sizeof
(
NRMUTEX
))
;
if
(
mutex
&&
!
InitializeNonRecursiveMutex
(
mutex
))
...
...
@@ -231,7 +231,7 @@ void PyThread_exit_prog(int status)
do_PyThread_exit_prog
(
status
,
0
);
}
void
PyThread__exit_prog
_P1
(
int
status
)
void
PyThread__exit_prog
(
int
status
)
{
do_PyThread_exit_prog
(
status
,
1
);
}
...
...
Python/thread_os2.h
View file @
709fe068
...
...
@@ -29,14 +29,16 @@ long PyThread_get_thread_ident(void);
/*
* Initialization of the C package, should not be needed.
*/
static
void
PyThread__init_thread
(
void
)
static
void
PyThread__init_thread
(
void
)
{
}
/*
* Thread support.
*/
int
PyThread_start_new_thread
(
void
(
*
func
)(
void
*
),
void
*
arg
)
int
PyThread_start_new_thread
(
void
(
*
func
)(
void
*
),
void
*
arg
)
{
int
aThread
;
int
success
=
1
;
...
...
@@ -52,7 +54,8 @@ int PyThread_start_new_thread(void (*func)(void *), void *arg)
return
success
;
}
long
PyThread_get_thread_ident
(
void
)
long
PyThread_get_thread_ident
(
void
)
{
PPIB
pib
;
PTIB
tib
;
...
...
@@ -64,7 +67,8 @@ long PyThread_get_thread_ident(void)
return
tib
->
tib_ptib2
->
tib2_ultid
;
}
static
void
do_PyThread_exit_thread
(
int
no_cleanup
)
static
void
do_PyThread_exit_thread
(
int
no_cleanup
)
{
dprintf
((
"%ld: PyThread_exit_thread called
\n
"
,
PyThread_get_thread_ident
()));
if
(
!
initialized
)
...
...
@@ -75,18 +79,21 @@ static void do_PyThread_exit_thread(int no_cleanup)
_endthread
();
}
void
PyThread_exit_thread
(
void
)
void
PyThread_exit_thread
(
void
)
{
do_PyThread_exit_thread
(
0
);
}
void
PyThread__exit_thread
(
void
)
void
PyThread__exit_thread
(
void
)
{
do_PyThread_exit_thread
(
1
);
}
#ifndef NO_EXIT_PROG
static
void
do_PyThread_exit_prog
(
int
status
,
int
no_cleanup
)
static
void
do_PyThread_exit_prog
(
int
status
,
int
no_cleanup
)
{
dprintf
((
"PyThread_exit_prog(%d) called
\n
"
,
status
));
if
(
!
initialized
)
...
...
@@ -96,12 +103,14 @@ static void do_PyThread_exit_prog(int status, int no_cleanup)
exit
(
status
);
}
void
PyThread_exit_prog
(
int
status
)
void
PyThread_exit_prog
(
int
status
)
{
do_PyThread_exit_prog
(
status
,
0
);
}
void
PyThread__exit_prog
_P1
(
int
status
)
void
PyThread__exit_prog
(
int
status
)
{
do_PyThread_exit_prog
(
status
,
1
);
}
...
...
@@ -112,7 +121,8 @@ void PyThread__exit_prog _P1(int status)
* I [Dag] tried to implement it with mutex but I could find a way to
* tell whether a thread already own the lock or not.
*/
PyThread_type_lock
PyThread_allocate_lock
(
void
)
PyThread_type_lock
PyThread_allocate_lock
(
void
)
{
HMTX
aLock
;
APIRET
rc
;
...
...
@@ -131,7 +141,8 @@ PyThread_type_lock PyThread_allocate_lock(void)
return
(
PyThread_type_lock
)
aLock
;
}
void
PyThread_free_lock
(
PyThread_type_lock
aLock
)
void
PyThread_free_lock
(
PyThread_type_lock
aLock
)
{
dprintf
((
"%ld: PyThread_free_lock(%p) called
\n
"
,
PyThread_get_thread_ident
(),
aLock
));
...
...
@@ -144,7 +155,8 @@ void PyThread_free_lock(PyThread_type_lock aLock)
* and 0 if the lock was not acquired. This means a 0 is returned
* if the lock has already been acquired by this thread!
*/
int
PyThread_acquire_lock
(
PyThread_type_lock
aLock
,
int
waitflag
)
int
PyThread_acquire_lock
(
PyThread_type_lock
aLock
,
int
waitflag
)
{
int
success
=
1
;
ULONG
rc
,
count
;
...
...
@@ -172,7 +184,8 @@ int PyThread_acquire_lock(PyThread_type_lock aLock, int waitflag)
return
success
;
}
void
PyThread_release_lock
(
PyThread_type_lock
aLock
)
void
PyThread_release_lock
(
PyThread_type_lock
aLock
)
{
dprintf
((
"%ld: PyThread_release_lock(%p) called
\n
"
,
PyThread_get_thread_ident
(),
aLock
));
...
...
@@ -185,22 +198,26 @@ void PyThread_release_lock(PyThread_type_lock aLock)
/*
* Semaphore support.
*/
PyThread_type_sema
PyThread_allocate_sema
(
int
value
)
PyThread_type_sema
PyThread_allocate_sema
(
int
value
)
{
return
(
PyThread_type_sema
)
0
;
}
void
PyThread_free_sema
(
PyThread_type_sema
aSemaphore
)
void
PyThread_free_sema
(
PyThread_type_sema
aSemaphore
)
{
}
int
PyThread_down_sema
(
PyThread_type_sema
aSemaphore
,
int
waitflag
)
int
PyThread_down_sema
(
PyThread_type_sema
aSemaphore
,
int
waitflag
)
{
return
-
1
;
}
void
PyThread_up_sema
(
PyThread_type_sema
aSemaphore
)
void
PyThread_up_sema
(
PyThread_type_sema
aSemaphore
)
{
dprintf
((
"%ld: PyThread_up_sema(%p)
\n
"
,
PyThread_get_thread_ident
(),
aSemaphore
));
}
Python/thread_pth.h
View file @
709fe068
...
...
@@ -43,7 +43,7 @@ typedef struct {
* Initialization.
*/
static
void
PyThread__init_thread
_P0
(
)
static
void
PyThread__init_thread
(
void
)
{
pth_init
();
}
...
...
@@ -53,7 +53,7 @@ static void PyThread__init_thread _P0()
*/
int
PyThread_start_new_thread
_P2
(
func
,
void
(
*
func
)
_P
((
void
*
)),
arg
,
void
*
arg
)
int
PyThread_start_new_thread
(
void
(
*
func
)(
void
*
)
,
void
*
arg
)
{
pth_t
th
;
int
success
;
...
...
@@ -62,14 +62,14 @@ int PyThread_start_new_thread _P2(func, void (*func) _P((void *)), arg, void *ar
PyThread_init_thread
();
th
=
pth_spawn
(
PTH_ATTR_DEFAULT
,
(
void
*
(
*
)
_P
((
void
*
)
))
func
,
(
void
*
(
*
)
(
void
*
))
func
,
(
void
*
)
arg
);
return
th
==
NULL
?
0
:
1
;
}
long
PyThread_get_thread_ident
_P0
(
)
long
PyThread_get_thread_ident
(
void
)
{
volatile
pth_t
threadid
;
if
(
!
initialized
)
...
...
@@ -79,7 +79,7 @@ long PyThread_get_thread_ident _P0()
return
(
long
)
*
(
long
*
)
&
threadid
;
}
static
void
do_PyThread_exit_thread
_P1
(
no_cleanup
,
int
no_cleanup
)
static
void
do_PyThread_exit_thread
(
int
no_cleanup
)
{
dprintf
((
"PyThread_exit_thread called
\n
"
));
if
(
!
initialized
)
{
...
...
@@ -90,18 +90,18 @@ static void do_PyThread_exit_thread _P1(no_cleanup, int no_cleanup)
}
}
void
PyThread_exit_thread
_P0
(
)
void
PyThread_exit_thread
(
void
)
{
do_PyThread_exit_thread
(
0
);
}
void
PyThread__exit_thread
_P0
(
)
void
PyThread__exit_thread
(
void
)
{
do_PyThread_exit_thread
(
1
);
}
#ifndef NO_EXIT_PROG
static
void
do_PyThread_exit_prog
_P2
(
status
,
int
status
,
no_cleanup
,
int
no_cleanup
)
static
void
do_PyThread_exit_prog
(
int
status
,
int
no_cleanup
)
{
dprintf
((
"PyThread_exit_prog(%d) called
\n
"
,
status
));
if
(
!
initialized
)
...
...
@@ -111,12 +111,12 @@ static void do_PyThread_exit_prog _P2(status, int status, no_cleanup, int no_cle
exit
(
status
);
}
void
PyThread_exit_prog
_P1
(
status
,
int
status
)
void
PyThread_exit_prog
(
int
status
)
{
do_PyThread_exit_prog
(
status
,
0
);
}
void
PyThread__exit_prog
_P1
(
status
,
int
status
)
void
PyThread__exit_prog
(
int
status
)
{
do_PyThread_exit_prog
(
status
,
1
);
}
...
...
@@ -125,7 +125,7 @@ void PyThread__exit_prog _P1(status, int status)
/*
* Lock support.
*/
PyThread_type_lock
PyThread_allocate_lock
_P0
(
)
PyThread_type_lock
PyThread_allocate_lock
(
void
)
{
pth_lock
*
lock
;
int
status
,
error
=
0
;
...
...
@@ -151,7 +151,7 @@ PyThread_type_lock PyThread_allocate_lock _P0()
return
(
PyThread_type_lock
)
lock
;
}
void
PyThread_free_lock
_P1
(
lock
,
PyThread_type_lock
lock
)
void
PyThread_free_lock
(
PyThread_type_lock
lock
)
{
pth_lock
*
thelock
=
(
pth_lock
*
)
lock
;
int
status
,
error
=
0
;
...
...
@@ -161,7 +161,7 @@ void PyThread_free_lock _P1(lock, PyThread_type_lock lock)
free
((
void
*
)
thelock
);
}
int
PyThread_acquire_lock
_P2
(
lock
,
PyThread_type_lock
lock
,
waitflag
,
int
waitflag
)
int
PyThread_acquire_lock
(
PyThread_type_lock
lock
,
int
waitflag
)
{
int
success
;
pth_lock
*
thelock
=
(
pth_lock
*
)
lock
;
...
...
@@ -198,7 +198,7 @@ int PyThread_acquire_lock _P2(lock, PyThread_type_lock lock, waitflag, int waitf
return
success
;
}
void
PyThread_release_lock
_P1
(
lock
,
PyThread_type_lock
lock
)
void
PyThread_release_lock
(
PyThread_type_lock
lock
)
{
pth_lock
*
thelock
=
(
pth_lock
*
)
lock
;
int
status
,
error
=
0
;
...
...
@@ -228,7 +228,7 @@ struct semaphore {
int
value
;
};
PyThread_type_sema
PyThread_allocate_sema
_P1
(
value
,
int
value
)
PyThread_type_sema
PyThread_allocate_sema
(
int
value
)
{
struct
semaphore
*
sema
;
int
status
,
error
=
0
;
...
...
@@ -253,7 +253,7 @@ PyThread_type_sema PyThread_allocate_sema _P1(value, int value)
return
(
PyThread_type_sema
)
sema
;
}
void
PyThread_free_sema
_P1
(
sema
,
PyThread_type_sema
sema
)
void
PyThread_free_sema
(
PyThread_type_sema
sema
)
{
int
status
,
error
=
0
;
struct
semaphore
*
thesema
=
(
struct
semaphore
*
)
sema
;
...
...
@@ -262,7 +262,7 @@ void PyThread_free_sema _P1(sema, PyThread_type_sema sema)
free
((
void
*
)
thesema
);
}
int
PyThread_down_sema
_P2
(
sema
,
PyThread_type_sema
sema
,
waitflag
,
int
waitflag
)
int
PyThread_down_sema
(
PyThread_type_sema
sema
,
int
waitflag
)
{
int
status
,
error
=
0
,
success
;
struct
semaphore
*
thesema
=
(
struct
semaphore
*
)
sema
;
...
...
@@ -291,7 +291,7 @@ int PyThread_down_sema _P2(sema, PyThread_type_sema sema, waitflag, int waitflag
return
success
;
}
void
PyThread_up_sema
_P1
(
sema
,
PyThread_type_sema
sema
)
void
PyThread_up_sema
(
PyThread_type_sema
sema
)
{
int
status
,
error
=
0
;
struct
semaphore
*
thesema
=
(
struct
semaphore
*
)
sema
;
...
...
Python/thread_pthread.h
View file @
709fe068
...
...
@@ -100,11 +100,13 @@ typedef struct {
*/
#ifdef _HAVE_BSDI
static
void
_noop
()
static
void
_noop
(
void
)
{
}
static
void
PyThread__init_thread
_P0
()
static
void
PyThread__init_thread
(
void
)
{
/* DO AN INIT BY STARTING THE THREAD */
static
int
dummy
=
0
;
...
...
@@ -115,7 +117,8 @@ static void PyThread__init_thread _P0()
#else
/* !_HAVE_BSDI */
static
void
PyThread__init_thread
_P0
()
static
void
PyThread__init_thread
(
void
)
{
#if defined(_AIX) && defined(__GNUC__)
pthread_init
();
...
...
@@ -129,7 +132,8 @@ static void PyThread__init_thread _P0()
*/
int
PyThread_start_new_thread
_P2
(
func
,
void
(
*
func
)
_P
((
void
*
)),
arg
,
void
*
arg
)
int
PyThread_start_new_thread
(
void
(
*
func
)(
void
*
),
void
*
arg
)
{
pthread_t
th
;
int
success
;
...
...
@@ -144,7 +148,7 @@ int PyThread_start_new_thread _P2(func, void (*func) _P((void *)), arg, void *ar
(
pthread_addr_t
)
arg
#elif defined(PY_PTHREAD_D6)
pthread_attr_default
,
(
void
*
(
*
)
_P
((
void
*
)
))
func
,
(
void
*
(
*
)
(
void
*
))
func
,
arg
#elif defined(PY_PTHREAD_D7)
pthread_attr_default
,
...
...
@@ -152,7 +156,7 @@ int PyThread_start_new_thread _P2(func, void (*func) _P((void *)), arg, void *ar
arg
#elif defined(PY_PTHREAD_STD)
(
pthread_attr_t
*
)
NULL
,
(
void
*
(
*
)
_P
((
void
*
)
))
func
,
(
void
*
(
*
)
(
void
*
))
func
,
(
void
*
)
arg
#endif
);
...
...
@@ -167,7 +171,8 @@ int PyThread_start_new_thread _P2(func, void (*func) _P((void *)), arg, void *ar
return
success
!=
0
?
0
:
1
;
}
long
PyThread_get_thread_ident
_P0
()
long
PyThread_get_thread_ident
(
void
)
{
volatile
pthread_t
threadid
;
if
(
!
initialized
)
...
...
@@ -177,7 +182,8 @@ long PyThread_get_thread_ident _P0()
return
(
long
)
*
(
long
*
)
&
threadid
;
}
static
void
do_PyThread_exit_thread
_P1
(
no_cleanup
,
int
no_cleanup
)
static
void
do_PyThread_exit_thread
(
int
no_cleanup
)
{
dprintf
((
"PyThread_exit_thread called
\n
"
));
if
(
!
initialized
)
{
...
...
@@ -188,18 +194,21 @@ static void do_PyThread_exit_thread _P1(no_cleanup, int no_cleanup)
}
}
void
PyThread_exit_thread
_P0
()
void
PyThread_exit_thread
(
void
)
{
do_PyThread_exit_thread
(
0
);
}
void
PyThread__exit_thread
_P0
()
void
PyThread__exit_thread
(
void
)
{
do_PyThread_exit_thread
(
1
);
}
#ifndef NO_EXIT_PROG
static
void
do_PyThread_exit_prog
_P2
(
status
,
int
status
,
no_cleanup
,
int
no_cleanup
)
static
void
do_PyThread_exit_prog
(
int
status
,
int
no_cleanup
)
{
dprintf
((
"PyThread_exit_prog(%d) called
\n
"
,
status
));
if
(
!
initialized
)
...
...
@@ -209,12 +218,14 @@ static void do_PyThread_exit_prog _P2(status, int status, no_cleanup, int no_cle
exit
(
status
);
}
void
PyThread_exit_prog
_P1
(
status
,
int
status
)
void
PyThread_exit_prog
(
int
status
)
{
do_PyThread_exit_prog
(
status
,
0
);
}
void
PyThread__exit_prog
_P1
(
status
,
int
status
)
void
PyThread__exit_prog
(
int
status
)
{
do_PyThread_exit_prog
(
status
,
1
);
}
...
...
@@ -223,7 +234,8 @@ void PyThread__exit_prog _P1(status, int status)
/*
* Lock support.
*/
PyThread_type_lock
PyThread_allocate_lock
_P0
()
PyThread_type_lock
PyThread_allocate_lock
(
void
)
{
pthread_lock
*
lock
;
int
status
,
error
=
0
;
...
...
@@ -255,7 +267,8 @@ PyThread_type_lock PyThread_allocate_lock _P0()
return
(
PyThread_type_lock
)
lock
;
}
void
PyThread_free_lock
_P1
(
lock
,
PyThread_type_lock
lock
)
void
PyThread_free_lock
(
PyThread_type_lock
lock
)
{
pthread_lock
*
thelock
=
(
pthread_lock
*
)
lock
;
int
status
,
error
=
0
;
...
...
@@ -271,7 +284,8 @@ void PyThread_free_lock _P1(lock, PyThread_type_lock lock)
free
((
void
*
)
thelock
);
}
int
PyThread_acquire_lock
_P2
(
lock
,
PyThread_type_lock
lock
,
waitflag
,
int
waitflag
)
int
PyThread_acquire_lock
(
PyThread_type_lock
lock
,
int
waitflag
)
{
int
success
;
pthread_lock
*
thelock
=
(
pthread_lock
*
)
lock
;
...
...
@@ -308,7 +322,8 @@ int PyThread_acquire_lock _P2(lock, PyThread_type_lock lock, waitflag, int waitf
return
success
;
}
void
PyThread_release_lock
_P1
(
lock
,
PyThread_type_lock
lock
)
void
PyThread_release_lock
(
PyThread_type_lock
lock
)
{
pthread_lock
*
thelock
=
(
pthread_lock
*
)
lock
;
int
status
,
error
=
0
;
...
...
@@ -338,7 +353,8 @@ struct semaphore {
int
value
;
};
PyThread_type_sema
PyThread_allocate_sema
_P1
(
value
,
int
value
)
PyThread_type_sema
PyThread_allocate_sema
(
int
value
)
{
struct
semaphore
*
sema
;
int
status
,
error
=
0
;
...
...
@@ -365,7 +381,8 @@ PyThread_type_sema PyThread_allocate_sema _P1(value, int value)
return
(
PyThread_type_sema
)
sema
;
}
void
PyThread_free_sema
_P1
(
sema
,
PyThread_type_sema
sema
)
void
PyThread_free_sema
(
PyThread_type_sema
sema
)
{
int
status
,
error
=
0
;
struct
semaphore
*
thesema
=
(
struct
semaphore
*
)
sema
;
...
...
@@ -378,7 +395,8 @@ void PyThread_free_sema _P1(sema, PyThread_type_sema sema)
free
((
void
*
)
thesema
);
}
int
PyThread_down_sema
_P2
(
sema
,
PyThread_type_sema
sema
,
waitflag
,
int
waitflag
)
int
PyThread_down_sema
(
PyThread_type_sema
sema
,
int
waitflag
)
{
int
status
,
error
=
0
,
success
;
struct
semaphore
*
thesema
=
(
struct
semaphore
*
)
sema
;
...
...
@@ -407,7 +425,8 @@ int PyThread_down_sema _P2(sema, PyThread_type_sema sema, waitflag, int waitflag
return
success
;
}
void
PyThread_up_sema
_P1
(
sema
,
PyThread_type_sema
sema
)
void
PyThread_up_sema
(
PyThread_type_sema
sema
)
{
int
status
,
error
=
0
;
struct
semaphore
*
thesema
=
(
struct
semaphore
*
)
sema
;
...
...
Python/thread_sgi.h
View file @
709fe068
...
...
@@ -47,7 +47,7 @@ static int maxpidindex; /* # of PIDs in pidlist */
* exits. When that happens, we must see whether we have to exit as
* well (because of an PyThread_exit_prog()) or whether we should continue on.
*/
static
void
exit_sig
_P0
(
)
static
void
exit_sig
(
void
)
{
d2printf
((
"exit_sig called
\n
"
));
if
(
exiting
&&
getpid
()
==
my_pid
)
{
...
...
@@ -68,7 +68,7 @@ static void exit_sig _P0()
* This routine is called when a process calls exit(). If that wasn't
* done from the library, we do as if an PyThread_exit_prog() was intended.
*/
static
void
maybe_exit
_P0
(
)
static
void
maybe_exit
(
void
)
{
dprintf
((
"maybe_exit called
\n
"
));
if
(
exiting
)
{
...
...
@@ -82,7 +82,7 @@ static void maybe_exit _P0()
/*
* Initialization.
*/
static
void
PyThread__init_thread
_P0
(
)
static
void
PyThread__init_thread
(
void
)
{
#ifndef NO_EXIT_PROG
struct
sigaction
s
;
...
...
@@ -143,7 +143,7 @@ static void PyThread__init_thread _P0()
* Thread support.
*/
static
void
clean_threads
_P0
(
)
static
void
clean_threads
(
void
)
{
int
i
,
j
;
pid_t
mypid
,
pid
;
...
...
@@ -177,7 +177,7 @@ static void clean_threads _P0()
}
}
int
PyThread_start_new_thread
_P2
(
func
,
void
(
*
func
)
_P
((
void
*
)),
arg
,
void
*
arg
)
int
PyThread_start_new_thread
(
void
(
*
func
)(
void
*
)
,
void
*
arg
)
{
#ifdef USE_DL
long
addr
,
size
;
...
...
@@ -235,12 +235,12 @@ int PyThread_start_new_thread _P2(func, void (*func) _P((void *)), arg, void *ar
return
success
<
0
?
0
:
1
;
}
long
PyThread_get_thread_ident
_P0
(
)
long
PyThread_get_thread_ident
(
void
)
{
return
getpid
();
}
static
void
do_PyThread_exit_thread
_P1
(
no_cleanup
,
int
no_cleanup
)
static
void
do_PyThread_exit_thread
(
int
no_cleanup
)
{
dprintf
((
"PyThread_exit_thread called
\n
"
));
if
(
!
initialized
)
...
...
@@ -305,18 +305,18 @@ static void do_PyThread_exit_thread _P1(no_cleanup, int no_cleanup)
_exit
(
0
);
}
void
PyThread_exit_thread
_P0
(
)
void
PyThread_exit_thread
(
void
)
{
do_PyThread_exit_thread
(
0
);
}
void
PyThread__exit_thread
_P0
(
)
void
PyThread__exit_thread
(
void
)
{
do_PyThread_exit_thread
(
1
);
}
#ifndef NO_EXIT_PROG
static
void
do_PyThread_exit_prog
_P2
(
status
,
int
status
,
no_cleanup
,
int
no_cleanup
)
static
void
do_PyThread_exit_prog
(
int
status
,
int
no_cleanup
)
{
dprintf
((
"PyThread_exit_prog(%d) called
\n
"
,
status
));
if
(
!
initialized
)
...
...
@@ -329,12 +329,12 @@ static void do_PyThread_exit_prog _P2(status, int status, no_cleanup, int no_cle
do_PyThread_exit_thread
(
no_cleanup
);
}
void
PyThread_exit_prog
_P1
(
status
,
int
status
)
void
PyThread_exit_prog
(
int
status
)
{
do_PyThread_exit_prog
(
status
,
0
);
}
void
PyThread__exit_prog
_P1
(
status
,
int
status
)
void
PyThread__exit_prog
(
int
status
)
{
do_PyThread_exit_prog
(
status
,
1
);
}
...
...
@@ -343,7 +343,7 @@ void PyThread__exit_prog _P1(status, int status)
/*
* Lock support.
*/
PyThread_type_lock
PyThread_allocate_lock
_P0
(
)
PyThread_type_lock
PyThread_allocate_lock
(
void
)
{
ulock_t
lock
;
...
...
@@ -358,13 +358,13 @@ PyThread_type_lock PyThread_allocate_lock _P0()
return
(
PyThread_type_lock
)
lock
;
}
void
PyThread_free_lock
_P1
(
lock
,
PyThread_type_lock
lock
)
void
PyThread_free_lock
(
PyThread_type_lock
lock
)
{
dprintf
((
"PyThread_free_lock(%p) called
\n
"
,
lock
));
usfreelock
((
ulock_t
)
lock
,
shared_arena
);
}
int
PyThread_acquire_lock
_P2
(
lock
,
PyThread_type_lock
lock
,
waitflag
,
int
waitflag
)
int
PyThread_acquire_lock
(
PyThread_type_lock
lock
,
int
waitflag
)
{
int
success
;
...
...
@@ -380,7 +380,7 @@ int PyThread_acquire_lock _P2(lock, PyThread_type_lock lock, waitflag, int waitf
return
success
;
}
void
PyThread_release_lock
_P1
(
lock
,
PyThread_type_lock
lock
)
void
PyThread_release_lock
(
PyThread_type_lock
lock
)
{
dprintf
((
"PyThread_release_lock(%p) called
\n
"
,
lock
));
if
(
usunsetlock
((
ulock_t
)
lock
)
<
0
)
...
...
@@ -390,7 +390,7 @@ void PyThread_release_lock _P1(lock, PyThread_type_lock lock)
/*
* Semaphore support.
*/
PyThread_type_sema
PyThread_allocate_sema
_P1
(
value
,
int
value
)
PyThread_type_sema
PyThread_allocate_sema
(
int
value
)
{
usema_t
*
sema
;
dprintf
((
"PyThread_allocate_sema called
\n
"
));
...
...
@@ -403,13 +403,13 @@ PyThread_type_sema PyThread_allocate_sema _P1(value, int value)
return
(
PyThread_type_sema
)
sema
;
}
void
PyThread_free_sema
_P1
(
sema
,
PyThread_type_sema
sema
)
void
PyThread_free_sema
(
PyThread_type_sema
sema
)
{
dprintf
((
"PyThread_free_sema(%p) called
\n
"
,
sema
));
usfreesema
((
usema_t
*
)
sema
,
shared_arena
);
}
int
PyThread_down_sema
_P2
(
sema
,
PyThread_type_sema
sema
,
waitflag
,
int
waitflag
)
int
PyThread_down_sema
(
PyThread_type_sema
sema
,
int
waitflag
)
{
int
success
;
...
...
@@ -424,7 +424,7 @@ int PyThread_down_sema _P2(sema, PyThread_type_sema sema, waitflag, int waitflag
return
success
;
}
void
PyThread_up_sema
_P1
(
sema
,
PyThread_type_sema
sema
)
void
PyThread_up_sema
(
PyThread_type_sema
sema
)
{
dprintf
((
"PyThread_up_sema(%p)
\n
"
,
sema
));
if
(
usvsema
((
usema_t
*
)
sema
)
<
0
)
...
...
@@ -446,7 +446,7 @@ static struct key *keyhead = NULL;
static
int
nkeys
=
0
;
static
PyThread_type_lock
keymutex
=
NULL
;
static
struct
key
*
find_key
_P2
(
key
,
int
key
,
value
,
void
*
value
)
static
struct
key
*
find_key
(
int
key
,
void
*
value
)
{
struct
key
*
p
;
long
id
=
PyThread_get_thread_ident
();
...
...
@@ -469,14 +469,14 @@ static struct key *find_key _P2(key, int key, value, void *value)
return
p
;
}
int
PyThread_create_key
_P0
(
)
int
PyThread_create_key
(
void
)
{
if
(
keymutex
==
NULL
)
keymutex
=
PyThread_allocate_lock
();
return
++
nkeys
;
}
void
PyThread_delete_key
_P1
(
key
,
int
key
)
void
PyThread_delete_key
(
int
key
)
{
struct
key
*
p
,
**
q
;
PyThread_acquire_lock
(
keymutex
,
1
);
...
...
@@ -493,7 +493,7 @@ void PyThread_delete_key _P1(key, int key)
PyThread_release_lock
(
keymutex
);
}
int
PyThread_set_key_value
_P2
(
key
,
int
key
,
value
,
void
*
value
)
int
PyThread_set_key_value
(
int
key
,
void
*
value
)
{
struct
key
*
p
=
find_key
(
key
,
value
);
if
(
p
==
NULL
)
...
...
@@ -502,7 +502,7 @@ int PyThread_set_key_value _P2(key, int key, value, void *value)
return
0
;
}
void
*
PyThread_get_key_value
_P1
(
key
,
int
key
)
void
*
PyThread_get_key_value
(
int
key
)
{
struct
key
*
p
=
find_key
(
key
,
NULL
);
if
(
p
==
NULL
)
...
...
Python/thread_solaris.h
View file @
709fe068
...
...
@@ -19,7 +19,7 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
/*
* Initialization.
*/
static
void
PyThread__init_thread
_P0
(
)
static
void
PyThread__init_thread
(
void
)
{
}
...
...
@@ -27,13 +27,14 @@ static void PyThread__init_thread _P0()
* Thread support.
*/
struct
func_arg
{
void
(
*
func
)
_P
((
void
*
)
);
void
(
*
func
)
(
void
*
);
void
*
arg
;
};
static
void
*
new_func
_P1
(
funcarg
,
void
*
funcarg
)
static
void
*
new_func
(
void
*
funcarg
)
{
void
(
*
func
)
_P
((
void
*
)
);
void
(
*
func
)
(
void
*
);
void
*
arg
;
func
=
((
struct
func_arg
*
)
funcarg
)
->
func
;
...
...
@@ -44,7 +45,8 @@ static void *new_func _P1(funcarg, void *funcarg)
}
int
PyThread_start_new_thread
_P2
(
func
,
void
(
*
func
)
_P
((
void
*
)),
arg
,
void
*
arg
)
int
PyThread_start_new_thread
(
void
(
*
func
)(
void
*
),
void
*
arg
)
{
struct
func_arg
*
funcarg
;
int
success
=
0
;
/* init not needed when SOLARIS_THREADS and */
...
...
@@ -65,14 +67,16 @@ int PyThread_start_new_thread _P2(func, void (*func) _P((void *)), arg, void *ar
return
success
<
0
?
0
:
1
;
}
long
PyThread_get_thread_ident
_P0
()
long
PyThread_get_thread_ident
(
void
)
{
if
(
!
initialized
)
PyThread_init_thread
();
return
thr_self
();
}
static
void
do_PyThread_exit_thread
_P1
(
no_cleanup
,
int
no_cleanup
)
static
void
do_PyThread_exit_thread
(
int
no_cleanup
)
{
dprintf
((
"PyThread_exit_thread called
\n
"
));
if
(
!
initialized
)
...
...
@@ -83,18 +87,21 @@ static void do_PyThread_exit_thread _P1(no_cleanup, int no_cleanup)
thr_exit
(
0
);
}
void
PyThread_exit_thread
_P0
()
void
PyThread_exit_thread
(
void
)
{
do_PyThread_exit_thread
(
0
);
}
void
PyThread__exit_thread
_P0
()
void
PyThread__exit_thread
(
void
)
{
do_PyThread_exit_thread
(
1
);
}
#ifndef NO_EXIT_PROG
static
void
do_PyThread_exit_prog
_P2
(
status
,
int
status
,
no_cleanup
,
int
no_cleanup
)
static
void
do_PyThread_exit_prog
(
int
status
,
int
no_cleanup
)
{
dprintf
((
"PyThread_exit_prog(%d) called
\n
"
,
status
));
if
(
!
initialized
)
...
...
@@ -108,12 +115,14 @@ static void do_PyThread_exit_prog _P2(status, int status, no_cleanup, int no_cle
exit
(
status
);
}
void
PyThread_exit_prog
_P1
(
status
,
int
status
)
void
PyThread_exit_prog
(
int
status
)
{
do_PyThread_exit_prog
(
status
,
0
);
}
void
PyThread__exit_prog
_P1
(
status
,
int
status
)
void
PyThread__exit_prog
(
int
status
)
{
do_PyThread_exit_prog
(
status
,
1
);
}
...
...
@@ -122,7 +131,8 @@ void PyThread__exit_prog _P1(status, int status)
/*
* Lock support.
*/
PyThread_type_lock
PyThread_allocate_lock
_P0
()
PyThread_type_lock
PyThread_allocate_lock
(
void
)
{
mutex_t
*
lock
;
...
...
@@ -140,14 +150,16 @@ PyThread_type_lock PyThread_allocate_lock _P0()
return
(
PyThread_type_lock
)
lock
;
}
void
PyThread_free_lock
_P1
(
lock
,
PyThread_type_lock
lock
)
void
PyThread_free_lock
(
PyThread_type_lock
lock
)
{
dprintf
((
"PyThread_free_lock(%p) called
\n
"
,
lock
));
mutex_destroy
((
mutex_t
*
)
lock
);
free
((
void
*
)
lock
);
}
int
PyThread_acquire_lock
_P2
(
lock
,
PyThread_type_lock
lock
,
waitflag
,
int
waitflag
)
int
PyThread_acquire_lock
(
PyThread_type_lock
lock
,
int
waitflag
)
{
int
success
;
...
...
@@ -164,7 +176,8 @@ int PyThread_acquire_lock _P2(lock, PyThread_type_lock lock, waitflag, int waitf
return
success
;
}
void
PyThread_release_lock
_P1
(
lock
,
PyThread_type_lock
lock
)
void
PyThread_release_lock
(
PyThread_type_lock
lock
)
{
dprintf
((
"PyThread_release_lock(%p) called
\n
"
,
lock
));
if
(
mutex_unlock
((
mutex_t
*
)
lock
))
...
...
@@ -174,7 +187,8 @@ void PyThread_release_lock _P1(lock, PyThread_type_lock lock)
/*
* Semaphore support.
*/
PyThread_type_sema
PyThread_allocate_sema
_P1
(
value
,
int
value
)
PyThread_type_sema
PyThread_allocate_sema
(
int
value
)
{
sema_t
*
sema
;
dprintf
((
"PyThread_allocate_sema called
\n
"
));
...
...
@@ -191,7 +205,8 @@ PyThread_type_sema PyThread_allocate_sema _P1(value, int value)
return
(
PyThread_type_sema
)
sema
;
}
void
PyThread_free_sema
_P1
(
sema
,
PyThread_type_sema
sema
)
void
PyThread_free_sema
(
PyThread_type_sema
sema
)
{
dprintf
((
"PyThread_free_sema(%p) called
\n
"
,
sema
));
if
(
sema_destroy
((
sema_t
*
)
sema
))
...
...
@@ -199,7 +214,8 @@ void PyThread_free_sema _P1(sema, PyThread_type_sema sema)
free
((
void
*
)
sema
);
}
int
PyThread_down_sema
_P2
(
sema
,
PyThread_type_sema
sema
,
waitflag
,
int
waitflag
)
int
PyThread_down_sema
(
PyThread_type_sema
sema
,
int
waitflag
)
{
int
success
;
...
...
@@ -220,7 +236,8 @@ int PyThread_down_sema _P2(sema, PyThread_type_sema sema, waitflag, int waitflag
return
success
;
}
void
PyThread_up_sema
_P1
(
sema
,
PyThread_type_sema
sema
)
void
PyThread_up_sema
(
PyThread_type_sema
sema
)
{
dprintf
((
"PyThread_up_sema(%p)
\n
"
,
sema
));
if
(
sema_post
((
sema_t
*
)
sema
))
...
...
Python/thread_wince.h
View file @
709fe068
...
...
@@ -99,7 +99,7 @@ void PyThread_exit_prog(int status)
do_PyThread_exit_prog
(
status
,
0
);
}
void
PyThread__exit_prog
_P1
(
int
status
)
void
PyThread__exit_prog
(
int
status
)
{
do_PyThread_exit_prog
(
status
,
1
);
}
...
...
Python/traceback.c
View file @
709fe068
...
...
@@ -36,16 +36,13 @@ static struct memberlist tb_memberlist[] = {
};
static
PyObject
*
tb_getattr
(
tb
,
name
)
tracebackobject
*
tb
;
char
*
name
;
tb_getattr
(
tracebackobject
*
tb
,
char
*
name
)
{
return
PyMember_Get
((
char
*
)
tb
,
tb_memberlist
,
name
);
}
static
void
tb_dealloc
(
tb
)
tracebackobject
*
tb
;
tb_dealloc
(
tracebackobject
*
tb
)
{
Py_TRASHCAN_SAFE_BEGIN
(
tb
)
Py_XDECREF
(
tb
->
tb_next
);
...
...
@@ -75,10 +72,8 @@ PyTypeObject Tracebacktype = {
};
static
tracebackobject
*
newtracebackobject
(
next
,
frame
,
lasti
,
lineno
)
tracebackobject
*
next
;
PyFrameObject
*
frame
;
int
lasti
,
lineno
;
newtracebackobject
(
tracebackobject
*
next
,
PyFrameObject
*
frame
,
int
lasti
,
int
lineno
)
{
tracebackobject
*
tb
;
if
((
next
!=
NULL
&&
!
is_tracebackobject
(
next
))
||
...
...
@@ -99,8 +94,7 @@ newtracebackobject(next, frame, lasti, lineno)
}
int
PyTraceBack_Here
(
frame
)
PyFrameObject
*
frame
;
PyTraceBack_Here
(
PyFrameObject
*
frame
)
{
PyThreadState
*
tstate
=
frame
->
f_tstate
;
tracebackobject
*
oldtb
=
(
tracebackobject
*
)
tstate
->
curexc_traceback
;
...
...
@@ -114,11 +108,7 @@ PyTraceBack_Here(frame)
}
static
int
tb_displayline
(
f
,
filename
,
lineno
,
name
)
PyObject
*
f
;
char
*
filename
;
int
lineno
;
char
*
name
;
tb_displayline
(
PyObject
*
f
,
char
*
filename
,
int
lineno
,
char
*
name
)
{
int
err
=
0
;
FILE
*
xfp
;
...
...
@@ -206,10 +196,7 @@ tb_displayline(f, filename, lineno, name)
}
static
int
tb_printinternal
(
tb
,
f
,
limit
)
tracebackobject
*
tb
;
PyObject
*
f
;
int
limit
;
tb_printinternal
(
tracebackobject
*
tb
,
PyObject
*
f
,
int
limit
)
{
int
err
=
0
;
int
depth
=
0
;
...
...
@@ -238,9 +225,7 @@ tb_printinternal(tb, f, limit)
}
int
PyTraceBack_Print
(
v
,
f
)
PyObject
*
v
;
PyObject
*
f
;
PyTraceBack_Print
(
PyObject
*
v
,
PyObject
*
f
)
{
int
err
;
PyObject
*
limitv
;
...
...
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