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
3a6f9785
Commit
3a6f9785
authored
Mar 25, 2002
by
Neal Norwitz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove many uses of PyArg_NoArgs macro, change METH_OLDARGS to METH_NOARGS.
parent
57f8e06e
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
65 additions
and
122 deletions
+65
-122
Include/Python.h
Include/Python.h
+3
-0
Modules/_curses_panel.c
Modules/_curses_panel.c
+7
-12
Modules/_localemodule.c
Modules/_localemodule.c
+5
-11
Modules/bsddbmodule.c
Modules/bsddbmodule.c
+20
-30
Modules/md5module.c
Modules/md5module.c
+6
-15
Modules/pwdmodule.c
Modules/pwdmodule.c
+2
-4
Modules/readline.c
Modules/readline.c
+10
-23
Modules/signalmodule.c
Modules/signalmodule.c
+2
-5
Modules/threadmodule.c
Modules/threadmodule.c
+10
-22
No files found.
Include/Python.h
View file @
3a6f9785
...
...
@@ -118,6 +118,9 @@
#include "abstract.h"
#define PyArg_GetInt(v, a) PyArg_Parse((v), "i", (a))
/* PyArg_NoArgs should not be necessary.
Set ml_flags in the PyMethodDef to METH_NOARGS. */
#define PyArg_NoArgs(v) PyArg_Parse(v, "")
/* Convert a possibly signed character to a nonnegative int */
...
...
Modules/_curses_panel.c
View file @
3a6f9785
...
...
@@ -355,14 +355,12 @@ PyTypeObject PyCursesPanel_Type = {
panel.above() *requires* a panel object in the first place which
may be undesirable. */
static
PyObject
*
PyCurses_bottom_panel
(
PyObject
*
self
,
PyObject
*
args
)
PyCurses_bottom_panel
(
PyObject
*
self
)
{
PANEL
*
pan
;
PyCursesPanelObject
*
po
;
PyCursesInitialised
;
if
(
!
PyArg_NoArgs
(
args
))
return
NULL
;
pan
=
panel_above
(
NULL
);
...
...
@@ -403,14 +401,12 @@ PyCurses_new_panel(PyObject *self, PyObject *args)
*requires* a panel object in the first place which may be
undesirable. */
static
PyObject
*
PyCurses_top_panel
(
PyObject
*
self
,
PyObject
*
args
)
PyCurses_top_panel
(
PyObject
*
self
)
{
PANEL
*
pan
;
PyCursesPanelObject
*
po
;
PyCursesInitialised
;
if
(
!
PyArg_NoArgs
(
args
))
return
NULL
;
pan
=
panel_below
(
NULL
);
...
...
@@ -429,10 +425,9 @@ PyCurses_top_panel(PyObject *self, PyObject *args)
return
(
PyObject
*
)
po
;
}
static
PyObject
*
PyCurses_update_panels
(
PyObject
*
self
,
PyObject
*
args
)
static
PyObject
*
PyCurses_update_panels
(
PyObject
*
self
)
{
PyCursesInitialised
;
if
(
!
PyArg_NoArgs
(
args
))
return
NULL
;
update_panels
();
Py_INCREF
(
Py_None
);
return
Py_None
;
...
...
@@ -442,10 +437,10 @@ static PyObject *PyCurses_update_panels(PyObject *self, PyObject *args)
/* List of functions defined in the module */
static
PyMethodDef
PyCurses_methods
[]
=
{
{
"bottom_panel"
,
(
PyCFunction
)
PyCurses_bottom_panel
},
{
"new_panel"
,
(
PyCFunction
)
PyCurses_new_panel
,
METH_VARARGS
},
{
"top_panel"
,
(
PyCFunction
)
PyCurses_top_panel
},
{
"update_panels"
,
(
PyCFunction
)
PyCurses_update_panels
},
{
"bottom_panel"
,
(
PyCFunction
)
PyCurses_bottom_panel
,
METH_NOARGS
},
{
"new_panel"
,
(
PyCFunction
)
PyCurses_new_panel
,
METH_VARARGS
},
{
"top_panel"
,
(
PyCFunction
)
PyCurses_top_panel
,
METH_NOARGS
},
{
"update_panels"
,
(
PyCFunction
)
PyCurses_update_panels
,
METH_NOARGS
},
{
NULL
,
NULL
}
/* sentinel */
};
...
...
Modules/_localemodule.c
View file @
3a6f9785
...
...
@@ -245,15 +245,12 @@ static char localeconv__doc__[] =
;
static
PyObject
*
PyLocale_localeconv
(
PyObject
*
self
,
PyObject
*
args
)
PyLocale_localeconv
(
PyObject
*
self
)
{
PyObject
*
result
;
struct
lconv
*
l
;
PyObject
*
x
;
if
(
!
PyArg_NoArgs
(
args
))
return
NULL
;
result
=
PyDict_New
();
if
(
!
result
)
return
NULL
;
...
...
@@ -368,14 +365,11 @@ PyLocale_strxfrm(PyObject* self, PyObject* args)
#if defined(MS_WIN32)
static
PyObject
*
PyLocale_getdefaultlocale
(
PyObject
*
self
,
PyObject
*
args
)
PyLocale_getdefaultlocale
(
PyObject
*
self
)
{
char
encoding
[
100
];
char
locale
[
100
];
if
(
!
PyArg_NoArgs
(
args
))
return
NULL
;
PyOS_snprintf
(
encoding
,
sizeof
(
encoding
),
"cp%d"
,
GetACP
());
if
(
GetLocaleInfo
(
LOCALE_USER_DEFAULT
,
...
...
@@ -408,7 +402,7 @@ PyLocale_getdefaultlocale(PyObject* self, PyObject* args)
#if defined(macintosh)
static
PyObject
*
PyLocale_getdefaultlocale
(
PyObject
*
self
,
PyObject
*
args
)
PyLocale_getdefaultlocale
(
PyObject
*
self
)
{
return
Py_BuildValue
(
"Os"
,
Py_None
,
PyMac_getscript
());
}
...
...
@@ -530,13 +524,13 @@ static struct PyMethodDef PyLocale_Methods[] = {
{
"setlocale"
,
(
PyCFunction
)
PyLocale_setlocale
,
METH_VARARGS
,
setlocale__doc__
},
{
"localeconv"
,
(
PyCFunction
)
PyLocale_localeconv
,
0
,
localeconv__doc__
},
METH_NOARGS
,
localeconv__doc__
},
{
"strcoll"
,
(
PyCFunction
)
PyLocale_strcoll
,
METH_VARARGS
,
strcoll__doc__
},
{
"strxfrm"
,
(
PyCFunction
)
PyLocale_strxfrm
,
METH_VARARGS
,
strxfrm__doc__
},
#if defined(MS_WIN32) || defined(macintosh)
{
"_getdefaultlocale"
,
(
PyCFunction
)
PyLocale_getdefaultlocale
,
0
},
{
"_getdefaultlocale"
,
(
PyCFunction
)
PyLocale_getdefaultlocale
,
METH_NOARGS
},
#endif
#ifdef HAVE_LANGINFO_H
{
"nl_langinfo"
,
(
PyCFunction
)
PyLocale_nl_langinfo
,
...
...
Modules/bsddbmodule.c
View file @
3a6f9785
...
...
@@ -380,10 +380,8 @@ static PyMappingMethods bsddb_as_mapping = {
};
static
PyObject
*
bsddb_close
(
bsddbobject
*
dp
,
PyObject
*
args
)
bsddb_close
(
bsddbobject
*
dp
)
{
if
(
!
PyArg_NoArgs
(
args
))
return
NULL
;
if
(
dp
->
di_bsddb
!=
NULL
)
{
int
status
;
BSDDB_BGN_SAVE
(
dp
)
...
...
@@ -401,7 +399,7 @@ bsddb_close(bsddbobject *dp, PyObject *args)
}
static
PyObject
*
bsddb_keys
(
bsddbobject
*
dp
,
PyObject
*
args
)
bsddb_keys
(
bsddbobject
*
dp
)
{
PyObject
*
list
,
*
item
=
NULL
;
DBT
krec
,
drec
;
...
...
@@ -409,8 +407,6 @@ bsddb_keys(bsddbobject *dp, PyObject *args)
int
status
;
int
err
;
if
(
!
PyArg_NoArgs
(
args
))
return
NULL
;
check_bsddbobject_open
(
dp
,
NULL
);
list
=
PyList_New
(
0
);
if
(
list
==
NULL
)
...
...
@@ -562,7 +558,7 @@ bsddb_set_location(bsddbobject *dp, PyObject *key)
}
static
PyObject
*
bsddb_seq
(
bsddbobject
*
dp
,
PyObject
*
args
,
int
sequence_request
)
bsddb_seq
(
bsddbobject
*
dp
,
int
sequence_request
)
{
int
status
;
DBT
krec
,
drec
;
...
...
@@ -570,9 +566,6 @@ bsddb_seq(bsddbobject *dp, PyObject *args, int sequence_request)
char
*
ddata
=
NULL
,
dbuf
[
4096
];
PyObject
*
result
;
if
(
!
PyArg_NoArgs
(
args
))
return
NULL
;
check_bsddbobject_open
(
dp
,
NULL
);
krec
.
data
=
0
;
krec
.
size
=
0
;
...
...
@@ -598,11 +591,10 @@ bsddb_seq(bsddbobject *dp, PyObject *args, int sequence_request)
if
(
status
<
0
)
PyErr_SetFromErrno
(
BsddbError
);
else
PyErr_Set
Object
(
PyExc_KeyError
,
args
);
PyErr_Set
String
(
PyExc_KeyError
,
"no key/data pairs"
);
return
NULL
;
}
if
(
dp
->
di_type
==
DB_RECNO
)
result
=
Py_BuildValue
(
"is#"
,
*
((
int
*
)
kdata
),
ddata
,
drec
.
size
);
...
...
@@ -615,32 +607,30 @@ bsddb_seq(bsddbobject *dp, PyObject *args, int sequence_request)
}
static
PyObject
*
bsddb_next
(
bsddbobject
*
dp
,
PyObject
*
key
)
bsddb_next
(
bsddbobject
*
dp
)
{
return
bsddb_seq
(
dp
,
key
,
R_NEXT
);
return
bsddb_seq
(
dp
,
R_NEXT
);
}
static
PyObject
*
bsddb_previous
(
bsddbobject
*
dp
,
PyObject
*
key
)
bsddb_previous
(
bsddbobject
*
dp
)
{
return
bsddb_seq
(
dp
,
key
,
R_PREV
);
return
bsddb_seq
(
dp
,
R_PREV
);
}
static
PyObject
*
bsddb_first
(
bsddbobject
*
dp
,
PyObject
*
key
)
bsddb_first
(
bsddbobject
*
dp
)
{
return
bsddb_seq
(
dp
,
key
,
R_FIRST
);
return
bsddb_seq
(
dp
,
R_FIRST
);
}
static
PyObject
*
bsddb_last
(
bsddbobject
*
dp
,
PyObject
*
key
)
bsddb_last
(
bsddbobject
*
dp
)
{
return
bsddb_seq
(
dp
,
key
,
R_LAST
);
return
bsddb_seq
(
dp
,
R_LAST
);
}
static
PyObject
*
bsddb_sync
(
bsddbobject
*
dp
,
PyObject
*
args
)
bsddb_sync
(
bsddbobject
*
dp
)
{
int
status
;
if
(
!
PyArg_NoArgs
(
args
))
return
NULL
;
check_bsddbobject_open
(
dp
,
NULL
);
BSDDB_BGN_SAVE
(
dp
)
status
=
(
dp
->
di_bsddb
->
sync
)(
dp
->
di_bsddb
,
0
);
...
...
@@ -652,15 +642,15 @@ bsddb_sync(bsddbobject *dp, PyObject *args)
return
PyInt_FromLong
(
status
=
0
);
}
static
PyMethodDef
bsddb_methods
[]
=
{
{
"close"
,
(
PyCFunction
)
bsddb_close
,
METH_
OLD
ARGS
},
{
"keys"
,
(
PyCFunction
)
bsddb_keys
,
METH_
OLD
ARGS
},
{
"close"
,
(
PyCFunction
)
bsddb_close
,
METH_
NO
ARGS
},
{
"keys"
,
(
PyCFunction
)
bsddb_keys
,
METH_
NO
ARGS
},
{
"has_key"
,
(
PyCFunction
)
bsddb_has_key
,
METH_OLDARGS
},
{
"set_location"
,
(
PyCFunction
)
bsddb_set_location
,
METH_OLDARGS
},
{
"next"
,
(
PyCFunction
)
bsddb_next
,
METH_
OLD
ARGS
},
{
"previous"
,
(
PyCFunction
)
bsddb_previous
,
METH_
OLD
ARGS
},
{
"first"
,
(
PyCFunction
)
bsddb_first
,
METH_
OLD
ARGS
},
{
"last"
,
(
PyCFunction
)
bsddb_last
,
METH_
OLD
ARGS
},
{
"sync"
,
(
PyCFunction
)
bsddb_sync
,
METH_
OLD
ARGS
},
{
"next"
,
(
PyCFunction
)
bsddb_next
,
METH_
NO
ARGS
},
{
"previous"
,
(
PyCFunction
)
bsddb_previous
,
METH_
NO
ARGS
},
{
"first"
,
(
PyCFunction
)
bsddb_first
,
METH_
NO
ARGS
},
{
"last"
,
(
PyCFunction
)
bsddb_last
,
METH_
NO
ARGS
},
{
"sync"
,
(
PyCFunction
)
bsddb_sync
,
METH_
NO
ARGS
},
{
NULL
,
NULL
}
/* sentinel */
};
...
...
Modules/md5module.c
View file @
3a6f9785
...
...
@@ -70,14 +70,11 @@ arguments.";
static
PyObject
*
md5_digest
(
md5object
*
self
,
PyObject
*
args
)
md5_digest
(
md5object
*
self
)
{
MD5_CTX
mdContext
;
unsigned
char
aDigest
[
16
];
if
(
!
PyArg_NoArgs
(
args
))
return
NULL
;
/* make a temporary copy, and perform the final */
mdContext
=
self
->
md5
;
MD5Final
(
aDigest
,
&
mdContext
);
...
...
@@ -94,16 +91,13 @@ including null bytes.";
static
PyObject
*
md5_hexdigest
(
md5object
*
self
,
PyObject
*
args
)
md5_hexdigest
(
md5object
*
self
)
{
MD5_CTX
mdContext
;
unsigned
char
digest
[
16
];
unsigned
char
hexdigest
[
32
];
int
i
,
j
;
if
(
!
PyArg_NoArgs
(
args
))
return
NULL
;
/* make a temporary copy, and perform the final */
mdContext
=
self
->
md5
;
MD5Final
(
digest
,
&
mdContext
);
...
...
@@ -129,13 +123,10 @@ Like digest(), but returns the digest as a string of hexadecimal digits.";
static
PyObject
*
md5_copy
(
md5object
*
self
,
PyObject
*
args
)
md5_copy
(
md5object
*
self
)
{
md5object
*
md5p
;
if
(
!
PyArg_NoArgs
(
args
))
return
NULL
;
if
((
md5p
=
newmd5object
())
==
NULL
)
return
NULL
;
...
...
@@ -152,9 +143,9 @@ Return a copy (``clone'') of the md5 object.";
static
PyMethodDef
md5_methods
[]
=
{
{
"update"
,
(
PyCFunction
)
md5_update
,
METH_OLDARGS
,
update_doc
},
{
"digest"
,
(
PyCFunction
)
md5_digest
,
METH_
OLDARGS
,
digest_doc
},
{
"hexdigest"
,
(
PyCFunction
)
md5_hexdigest
,
METH_
OLDARGS
,
hexdigest_doc
},
{
"copy"
,
(
PyCFunction
)
md5_copy
,
METH_
OLDARGS
,
copy_doc
},
{
"digest"
,
(
PyCFunction
)
md5_digest
,
METH_
NOARGS
,
digest_doc
},
{
"hexdigest"
,
(
PyCFunction
)
md5_hexdigest
,
METH_
NOARGS
,
hexdigest_doc
},
{
"copy"
,
(
PyCFunction
)
md5_copy
,
METH_
NOARGS
,
copy_doc
},
{
NULL
,
NULL
}
/* sentinel */
};
...
...
Modules/pwdmodule.c
View file @
3a6f9785
...
...
@@ -120,12 +120,10 @@ in arbitrary order.\n\
See pwd.__doc__ for more on password database entries."
;
static
PyObject
*
pwd_getpwall
(
PyObject
*
self
,
PyObject
*
args
)
pwd_getpwall
(
PyObject
*
self
)
{
PyObject
*
d
;
struct
passwd
*
p
;
if
(
!
PyArg_NoArgs
(
args
))
return
NULL
;
if
((
d
=
PyList_New
(
0
))
==
NULL
)
return
NULL
;
#if defined(PYOS_OS2) && defined(PYCC_GCC)
...
...
@@ -151,7 +149,7 @@ static PyMethodDef pwd_methods[] = {
{
"getpwuid"
,
pwd_getpwuid
,
METH_OLDARGS
,
pwd_getpwuid__doc__
},
{
"getpwnam"
,
pwd_getpwnam
,
METH_OLDARGS
,
pwd_getpwnam__doc__
},
#ifdef HAVE_GETPWENT
{
"getpwall"
,
pwd_getpwall
,
METH_
OLDARGS
,
pwd_getpwall__doc__
},
{
"getpwall"
,
pwd_getpwall
,
METH_
NOARGS
,
pwd_getpwall__doc__
},
#endif
{
NULL
,
NULL
}
/* sentinel */
};
...
...
Modules/readline.c
View file @
3a6f9785
...
...
@@ -237,11 +237,8 @@ static PyObject *endidx = NULL;
/* get the beginning index for the scope of the tab-completion */
static
PyObject
*
get_begidx
(
PyObject
*
self
,
PyObject
*
args
)
get_begidx
(
PyObject
*
self
)
{
if
(
!
PyArg_NoArgs
(
args
))
{
return
NULL
;
}
Py_INCREF
(
begidx
);
return
begidx
;
}
...
...
@@ -252,11 +249,8 @@ get the beginning index of the readline tab-completion scope";
/* get the ending index for the scope of the tab-completion */
static
PyObject
*
get_endidx
(
PyObject
*
self
,
PyObject
*
args
)
get_endidx
(
PyObject
*
self
)
{
if
(
!
PyArg_NoArgs
(
args
))
{
return
NULL
;
}
Py_INCREF
(
endidx
);
return
endidx
;
}
...
...
@@ -307,11 +301,8 @@ add a line to the history buffer";
/* get the tab-completion word-delimiters that readline uses */
static
PyObject
*
get_completer_delims
(
PyObject
*
self
,
PyObject
*
args
)
get_completer_delims
(
PyObject
*
self
)
{
if
(
!
PyArg_NoArgs
(
args
))
{
return
NULL
;
}
return
PyString_FromString
(
rl_completer_word_break_characters
);
}
...
...
@@ -359,12 +350,10 @@ return the current contents of history item at index.\
/* Exported function to get current length of history */
static
PyObject
*
get_current_history_length
(
PyObject
*
self
,
PyObject
*
args
)
get_current_history_length
(
PyObject
*
self
)
{
HISTORY_STATE
*
hist_st
;
if
(
!
PyArg_NoArgs
(
args
))
return
NULL
;
hist_st
=
history_get_history_state
();
return
PyInt_FromLong
(
hist_st
?
(
long
)
hist_st
->
length
:
(
long
)
0
);
}
...
...
@@ -377,10 +366,8 @@ return the current (not the maximum) length of history.\
/* Exported function to read the current line buffer */
static
PyObject
*
get_line_buffer
(
PyObject
*
self
,
PyObject
*
args
)
get_line_buffer
(
PyObject
*
self
)
{
if
(
!
PyArg_NoArgs
(
args
))
return
NULL
;
return
PyString_FromString
(
rl_line_buffer
);
}
...
...
@@ -427,7 +414,7 @@ static struct PyMethodDef readline_methods[] =
{
{
"parse_and_bind"
,
parse_and_bind
,
METH_VARARGS
,
doc_parse_and_bind
},
{
"get_line_buffer"
,
get_line_buffer
,
METH_
OLD
ARGS
,
doc_get_line_buffer
},
METH_
NO
ARGS
,
doc_get_line_buffer
},
{
"insert_text"
,
insert_text
,
METH_VARARGS
,
doc_insert_text
},
{
"redisplay"
,
(
PyCFunction
)
redisplay
,
METH_NOARGS
,
doc_redisplay
},
{
"read_init_file"
,
read_init_file
,
METH_VARARGS
,
doc_read_init_file
},
...
...
@@ -438,20 +425,20 @@ static struct PyMethodDef readline_methods[] =
{
"get_history_item"
,
get_history_item
,
METH_VARARGS
,
doc_get_history_item
},
{
"get_current_history_length"
,
get_current_history_length
,
METH_
OLD
ARGS
,
doc_get_current_history_length
},
METH_
NO
ARGS
,
doc_get_current_history_length
},
{
"set_history_length"
,
set_history_length
,
METH_VARARGS
,
set_history_length_doc
},
{
"get_history_length"
,
get_history_length
,
METH_VARARGS
,
get_history_length_doc
},
{
"set_completer"
,
set_completer
,
METH_VARARGS
,
doc_set_completer
},
{
"get_begidx"
,
get_begidx
,
METH_
OLD
ARGS
,
doc_get_begidx
},
{
"get_endidx"
,
get_endidx
,
METH_
OLD
ARGS
,
doc_get_endidx
},
{
"get_begidx"
,
get_begidx
,
METH_
NO
ARGS
,
doc_get_begidx
},
{
"get_endidx"
,
get_endidx
,
METH_
NO
ARGS
,
doc_get_endidx
},
{
"set_completer_delims"
,
set_completer_delims
,
METH_VARARGS
,
doc_set_completer_delims
},
{
"add_history"
,
py_add_history
,
METH_VARARGS
,
doc_add_history
},
{
"get_completer_delims"
,
get_completer_delims
,
METH_
OLD
ARGS
,
doc_get_completer_delims
},
METH_
NO
ARGS
,
doc_get_completer_delims
},
{
"set_startup_hook"
,
set_startup_hook
,
METH_VARARGS
,
doc_set_startup_hook
},
#ifdef HAVE_RL_PRE_INPUT_HOOK
...
...
Modules/signalmodule.c
View file @
3a6f9785
...
...
@@ -163,11 +163,8 @@ Arrange for SIGALRM to arrive after the given number of seconds.";
#ifdef HAVE_PAUSE
static
PyObject
*
signal_pause
(
PyObject
*
self
,
PyObject
*
args
)
signal_pause
(
PyObject
*
self
)
{
if
(
!
PyArg_NoArgs
(
args
))
return
NULL
;
Py_BEGIN_ALLOW_THREADS
(
void
)
pause
();
Py_END_ALLOW_THREADS
...
...
@@ -282,7 +279,7 @@ static PyMethodDef signal_methods[] = {
{
"signal"
,
signal_signal
,
METH_OLDARGS
,
signal_doc
},
{
"getsignal"
,
signal_getsignal
,
METH_OLDARGS
,
getsignal_doc
},
#ifdef HAVE_PAUSE
{
"pause"
,
signal_pause
,
METH_
OLD
ARGS
,
pause_doc
},
{
"pause"
,
signal_pause
,
METH_
NO
ARGS
,
pause_doc
},
#endif
{
"default_int_handler"
,
signal_default_int_handler
,
METH_OLDARGS
,
default_int_handler_doc
},
...
...
Modules/threadmodule.c
View file @
3a6f9785
...
...
@@ -87,11 +87,8 @@ and the return value reflects whether the lock is acquired.\n\
The blocking operation is not interruptible."
;
static
PyObject
*
lock_PyThread_release_lock
(
lockobject
*
self
,
PyObject
*
args
)
lock_PyThread_release_lock
(
lockobject
*
self
)
{
if
(
!
PyArg_NoArgs
(
args
))
return
NULL
;
/* Sanity check: the lock must be locked */
if
(
PyThread_acquire_lock
(
self
->
lock_lock
,
0
))
{
PyThread_release_lock
(
self
->
lock_lock
);
...
...
@@ -113,11 +110,8 @@ the lock to acquire the lock. The lock must be in the locked state,\n\
but it needn't be locked by the same thread that unlocks it."
;
static
PyObject
*
lock_locked_lock
(
lockobject
*
self
,
PyObject
*
args
)
lock_locked_lock
(
lockobject
*
self
)
{
if
(
!
PyArg_NoArgs
(
args
))
return
NULL
;
if
(
PyThread_acquire_lock
(
self
->
lock_lock
,
0
))
{
PyThread_release_lock
(
self
->
lock_lock
);
return
PyInt_FromLong
(
0L
);
...
...
@@ -137,11 +131,11 @@ static PyMethodDef lock_methods[] = {
{
"acquire"
,
(
PyCFunction
)
lock_PyThread_acquire_lock
,
METH_OLDARGS
,
acquire_doc
},
{
"release_lock"
,
(
PyCFunction
)
lock_PyThread_release_lock
,
METH_
OLD
ARGS
,
release_doc
},
METH_
NO
ARGS
,
release_doc
},
{
"release"
,
(
PyCFunction
)
lock_PyThread_release_lock
,
METH_OLDARGS
,
release_doc
},
{
"locked_lock"
,
(
PyCFunction
)
lock_locked_lock
,
METH_
OLD
ARGS
,
locked_doc
},
METH_
NO
ARGS
,
locked_doc
},
{
"locked"
,
(
PyCFunction
)
lock_locked_lock
,
METH_OLDARGS
,
locked_doc
},
{
NULL
,
NULL
}
/* sentinel */
...
...
@@ -267,10 +261,8 @@ when the function raises an unhandled exception; a stack trace will be\n\
printed unless the exception is SystemExit.
\n
"
;
static
PyObject
*
thread_PyThread_exit_thread
(
PyObject
*
self
,
PyObject
*
args
)
thread_PyThread_exit_thread
(
PyObject
*
self
)
{
if
(
!
PyArg_NoArgs
(
args
))
return
NULL
;
PyErr_SetNone
(
PyExc_SystemExit
);
return
NULL
;
}
...
...
@@ -295,10 +287,8 @@ thread_PyThread_exit_prog(PyObject *self, PyObject *args)
#endif
static
PyObject
*
thread_PyThread_allocate_lock
(
PyObject
*
self
,
PyObject
*
args
)
thread_PyThread_allocate_lock
(
PyObject
*
self
)
{
if
(
!
PyArg_NoArgs
(
args
))
return
NULL
;
return
(
PyObject
*
)
newlockobject
();
}
...
...
@@ -309,11 +299,9 @@ static char allocate_doc[] =
Create a new lock object. See LockType.__doc__ for information about locks."
;
static
PyObject
*
thread_get_ident
(
PyObject
*
self
,
PyObject
*
args
)
thread_get_ident
(
PyObject
*
self
)
{
long
ident
;
if
(
!
PyArg_NoArgs
(
args
))
return
NULL
;
ident
=
PyThread_get_thread_ident
();
if
(
ident
==
-
1
)
{
PyErr_SetString
(
ThreadError
,
"no current thread ident"
);
...
...
@@ -341,15 +329,15 @@ static PyMethodDef thread_methods[] = {
METH_VARARGS
,
start_new_doc
},
{
"allocate_lock"
,
(
PyCFunction
)
thread_PyThread_allocate_lock
,
METH_
OLD
ARGS
,
allocate_doc
},
METH_
NO
ARGS
,
allocate_doc
},
{
"allocate"
,
(
PyCFunction
)
thread_PyThread_allocate_lock
,
METH_OLDARGS
,
allocate_doc
},
{
"exit_thread"
,
(
PyCFunction
)
thread_PyThread_exit_thread
,
METH_
OLD
ARGS
,
exit_doc
},
METH_
NO
ARGS
,
exit_doc
},
{
"exit"
,
(
PyCFunction
)
thread_PyThread_exit_thread
,
METH_OLDARGS
,
exit_doc
},
{
"get_ident"
,
(
PyCFunction
)
thread_get_ident
,
METH_
OLD
ARGS
,
get_ident_doc
},
METH_
NO
ARGS
,
get_ident_doc
},
#ifndef NO_EXIT_PROG
{
"exit_prog"
,
(
PyCFunction
)
thread_PyThread_exit_prog
},
#endif
...
...
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