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
3b7073d2
Commit
3b7073d2
authored
Jul 18, 1995
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
keyword arguments and faster calls
parent
baea1c3b
Changes
7
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
771 additions
and
594 deletions
+771
-594
Python/bltinmodule.c
Python/bltinmodule.c
+10
-6
Python/ceval.c
Python/ceval.c
+459
-364
Python/compile.c
Python/compile.c
+280
-206
Python/import.c
Python/import.c
+2
-2
Python/marshal.c
Python/marshal.c
+13
-3
Python/pythonrun.c
Python/pythonrun.c
+3
-10
Python/traceback.c
Python/traceback.c
+4
-3
No files found.
Python/bltinmodule.c
View file @
3b7073d2
...
...
@@ -80,15 +80,20 @@ builtin_apply(self, args)
object
*
self
;
object
*
args
;
{
object
*
func
,
*
alist
;
object
*
func
,
*
alist
,
*
kwdict
=
NULL
;
if
(
!
newgetargs
(
args
,
"O
O:apply"
,
&
func
,
&
alis
t
))
if
(
!
newgetargs
(
args
,
"O
|OO:apply"
,
&
func
,
&
alist
,
&
kwdic
t
))
return
NULL
;
if
(
!
is_tupleobject
(
alist
))
{
if
(
alist
!=
NULL
&&
!
is_tupleobject
(
alist
))
{
err_setstr
(
TypeError
,
"apply() 2nd argument must be tuple"
);
return
NULL
;
}
return
call_object
(
func
,
alist
);
if
(
kwdict
!=
NULL
&&
!
is_dictobject
(
kwdict
))
{
err_setstr
(
TypeError
,
"apply() 3rd argument must be dictionary"
);
return
NULL
;
}
return
PyEval_CallObjectWithKeywords
(
func
,
alist
,
kwdict
);
}
static
object
*
...
...
@@ -373,8 +378,7 @@ builtin_eval(self, args)
return
NULL
;
}
if
(
is_codeobject
(
cmd
))
return
eval_code
((
codeobject
*
)
cmd
,
globals
,
locals
,
(
object
*
)
NULL
,
(
object
*
)
NULL
);
return
eval_code
((
codeobject
*
)
cmd
,
globals
,
locals
);
if
(
!
is_stringobject
(
cmd
))
{
err_setstr
(
TypeError
,
"eval() argument 1 must be string or code object"
);
...
...
Python/ceval.c
View file @
3b7073d2
This diff is collapsed.
Click to expand it.
Python/compile.c
View file @
3b7073d2
This diff is collapsed.
Click to expand it.
Python/import.c
View file @
3b7073d2
...
...
@@ -54,7 +54,7 @@ extern long getmtime(); /* In getmtime.c */
Apple MPW compiler swaps their values, botching string constants */
/* XXX Perhaps the magic number should be frozen and a version field
added to the .pyc file header? */
#define MAGIC (
0x4127L
| ((long)'\r'<<16) | ((long)'\n'<<24))
#define MAGIC (
11913
| ((long)'\r'<<16) | ((long)'\n'<<24))
object
*
import_modules
;
/* This becomes sys.modules */
...
...
@@ -159,7 +159,7 @@ exec_code_module(name, co)
if
(
dictinsert
(
d
,
"__builtins__"
,
getbuiltins
())
!=
0
)
return
NULL
;
}
v
=
eval_code
((
codeobject
*
)
co
,
d
,
d
,
d
,
(
object
*
)
NULL
);
v
=
eval_code
((
codeobject
*
)
co
,
d
,
d
);
/* XXX owner? */
if
(
v
==
NULL
)
return
NULL
;
DECREF
(
v
);
...
...
Python/marshal.c
View file @
3b7073d2
...
...
@@ -44,7 +44,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#define TYPE_TUPLE '('
#define TYPE_LIST '['
#define TYPE_DICT '{'
#define TYPE_CODE '
C
'
#define TYPE_CODE '
c
'
#define TYPE_UNKNOWN '?'
typedef
struct
{
...
...
@@ -187,9 +187,13 @@ w_object(v, p)
else
if
(
is_codeobject
(
v
))
{
codeobject
*
co
=
(
codeobject
*
)
v
;
w_byte
(
TYPE_CODE
,
p
);
w_short
(
co
->
co_argcount
,
p
);
w_short
(
co
->
co_nlocals
,
p
);
w_short
(
co
->
co_flags
,
p
);
w_object
((
object
*
)
co
->
co_code
,
p
);
w_object
(
co
->
co_consts
,
p
);
w_object
(
co
->
co_names
,
p
);
w_object
(
co
->
co_varnames
,
p
);
w_object
(
co
->
co_filename
,
p
);
w_object
(
co
->
co_name
,
p
);
}
...
...
@@ -374,14 +378,20 @@ r_object(p)
case
TYPE_CODE
:
{
int
argcount
=
r_short
(
p
);
int
nlocals
=
r_short
(
p
);
int
flags
=
r_short
(
p
);
object
*
code
=
r_object
(
p
);
object
*
consts
=
r_object
(
p
);
object
*
names
=
r_object
(
p
);
object
*
varnames
=
r_object
(
p
);
object
*
filename
=
r_object
(
p
);
object
*
name
=
r_object
(
p
);
if
(
!
err_occurred
())
{
v
=
(
object
*
)
newcodeobject
(
code
,
consts
,
names
,
filename
,
name
);
v
=
(
object
*
)
newcodeobject
(
argcount
,
nlocals
,
flags
,
code
,
consts
,
names
,
varnames
,
filename
,
name
);
}
else
v
=
NULL
;
...
...
Python/pythonrun.c
View file @
3b7073d2
...
...
@@ -430,7 +430,7 @@ run_node(n, filename, globals, locals)
freetree
(
n
);
if
(
co
==
NULL
)
return
NULL
;
v
=
eval_code
(
co
,
globals
,
locals
,
(
object
*
)
NULL
,
(
object
*
)
NULL
);
v
=
eval_code
(
co
,
globals
,
locals
);
DECREF
(
co
);
return
v
;
}
...
...
@@ -462,7 +462,7 @@ run_pyc_file(fp, filename, globals, locals)
return
NULL
;
}
co
=
(
codeobject
*
)
v
;
v
=
eval_code
(
co
,
globals
,
locals
,
(
object
*
)
NULL
,
(
object
*
)
NULL
);
v
=
eval_code
(
co
,
globals
,
locals
);
DECREF
(
co
);
return
v
;
}
...
...
@@ -603,16 +603,9 @@ cleanup()
object
*
exitfunc
=
sysget
(
"exitfunc"
);
if
(
exitfunc
)
{
object
*
arg
;
object
*
res
;
sysset
(
"exitfunc"
,
(
object
*
)
NULL
);
arg
=
newtupleobject
(
0
);
if
(
arg
==
NULL
)
res
=
NULL
;
else
{
res
=
call_object
(
exitfunc
,
arg
);
DECREF
(
arg
);
}
res
=
call_object
(
exitfunc
,
(
object
*
)
NULL
);
if
(
res
==
NULL
)
{
fprintf
(
stderr
,
"Error in sys.exitfunc:
\n
"
);
print_error
();
...
...
Python/traceback.c
View file @
3b7073d2
...
...
@@ -68,7 +68,10 @@ tb_dealloc(tb)
DEL
(
tb
);
}
static
typeobject
Tracebacktype
=
{
#define Tracebacktype PyTraceback_Type
#define is_tracebackobject PyTraceback_Check
typeobject
Tracebacktype
=
{
OB_HEAD_INIT
(
&
Typetype
)
0
,
"traceback"
,
...
...
@@ -85,8 +88,6 @@ static typeobject Tracebacktype = {
0
,
/*tp_as_mapping*/
};
#define is_tracebackobject(v) ((v)->ob_type == &Tracebacktype)
static
tracebackobject
*
newtracebackobject
(
next
,
frame
,
lasti
,
lineno
)
tracebackobject
*
next
;
...
...
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