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
968f8cba
Commit
968f8cba
authored
Oct 01, 1998
by
Barry Warsaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
builtin_apply(): Second argument type check is relaxed to allow any sequence.
parent
566373e9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
6 deletions
+18
-6
Python/bltinmodule.c
Python/bltinmodule.c
+18
-6
No files found.
Python/bltinmodule.c
View file @
968f8cba
...
...
@@ -101,20 +101,32 @@ builtin_apply(self, args)
PyObject
*
args
;
{
PyObject
*
func
,
*
alist
=
NULL
,
*
kwdict
=
NULL
;
PyObject
*
t
=
NULL
,
*
retval
=
NULL
;
if
(
!
PyArg_ParseTuple
(
args
,
"O|OO:apply"
,
&
func
,
&
alist
,
&
kwdict
))
return
NULL
;
if
(
alist
!=
NULL
&&
!
PyTuple_Check
(
alist
))
{
PyErr_SetString
(
PyExc_TypeError
,
"apply() 2nd argument must be tuple"
);
return
NULL
;
if
(
alist
!=
NULL
)
{
if
(
!
PyTuple_Check
(
alist
))
{
if
(
!
PySequence_Check
(
alist
))
{
PyErr_SetString
(
PyExc_TypeError
,
"apply() 2nd argument must be a sequence"
);
return
NULL
;
}
t
=
PySequence_Tuple
(
alist
);
if
(
t
==
NULL
)
return
NULL
;
alist
=
t
;
}
}
if
(
kwdict
!=
NULL
&&
!
PyDict_Check
(
kwdict
))
{
PyErr_SetString
(
PyExc_TypeError
,
"apply() 3rd argument must be dictionary"
);
return
NULL
;
goto
finally
;
}
return
PyEval_CallObjectWithKeywords
(
func
,
alist
,
kwdict
);
retval
=
PyEval_CallObjectWithKeywords
(
func
,
alist
,
kwdict
);
finally:
Py_XDECREF
(
t
);
return
retval
;
}
static
char
apply_doc
[]
=
...
...
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