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
b916faf6
Commit
b916faf6
authored
Nov 21, 1996
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upgraded new.function() contributed by Tommy. Also got rid of #if 0'ed code.
parent
40a172c7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
25 deletions
+8
-25
Modules/newmodule.c
Modules/newmodule.c
+8
-25
No files found.
Modules/newmodule.c
View file @
b916faf6
...
@@ -79,11 +79,8 @@ new_instancemethod(unused, args)
...
@@ -79,11 +79,8 @@ new_instancemethod(unused, args)
return
newinstancemethodobject
(
func
,
self
,
classObj
);
return
newinstancemethodobject
(
func
,
self
,
classObj
);
}
}
/* XXX These internal interfaces have changed -- who'll fix this code? */
#if 0
static
char
new_function_doc
[]
=
static
char
new_function_doc
[]
=
"Create a function object from (CODE, GLOBALS, [NAME, ARG
COUNT, ARG
DEFS]).";
"Create a function object from (CODE, GLOBALS, [NAME, ARGDEFS])."
;
static
object
*
static
object
*
new_function
(
unused
,
args
)
new_function
(
unused
,
args
)
...
@@ -93,16 +90,14 @@ new_function(unused, args)
...
@@ -93,16 +90,14 @@ new_function(unused, args)
object
*
code
;
object
*
code
;
object
*
globals
;
object
*
globals
;
object
*
name
=
None
;
object
*
name
=
None
;
int argcount = -1;
object
*
defaults
=
None
;
object* argdefs = None;
funcobject
*
newfunc
;
funcobject
*
newfunc
;
if (!newgetargs(args, "O!O!|S
i
O!",
if
(
!
newgetargs
(
args
,
"O!O!|SO!"
,
&
Codetype
,
&
code
,
&
Codetype
,
&
code
,
&
Mappingtype
,
&
globals
,
&
Mappingtype
,
&
globals
,
&
name
,
&
name
,
&argcount,
&
Tupletype
,
&
defaults
))
&Tupletype, &argdefs))
return
NULL
;
return
NULL
;
newfunc
=
(
funcobject
*
)
newfuncobject
(
code
,
globals
);
newfunc
=
(
funcobject
*
)
newfuncobject
(
code
,
globals
);
...
@@ -114,16 +109,14 @@ new_function(unused, args)
...
@@ -114,16 +109,14 @@ new_function(unused, args)
XDECREF
(
newfunc
->
func_name
);
XDECREF
(
newfunc
->
func_name
);
newfunc
->
func_name
=
name
;
newfunc
->
func_name
=
name
;
}
}
newfunc->func_argcount = argcount;
if
(
defaults
!=
NULL
)
{
if (argdefs != NULL) {
XINCREF
(
defaults
);
XINCREF(argdefs);
XDECREF
(
newfunc
->
func_defaults
);
XDECREF(newfunc->func_argdefs);
newfunc
->
func_defaults
=
defaults
;
newfunc->func_argdefs = argdefs;
}
}
return
(
object
*
)
newfunc
;
return
(
object
*
)
newfunc
;
}
}
#endif
static
char
new_code_doc
[]
=
static
char
new_code_doc
[]
=
"Create a code object from (ARGCOUNT, NLOCALS, FLAGS, CODESTRING, CONSTANTS, NAMES, VARNAMES, FILENAME, NAME)."
;
"Create a code object from (ARGCOUNT, NLOCALS, FLAGS, CODESTRING, CONSTANTS, NAMES, VARNAMES, FILENAME, NAME)."
;
...
@@ -143,13 +136,6 @@ new_code(unused, args)
...
@@ -143,13 +136,6 @@ new_code(unused, args)
object
*
filename
;
object
*
filename
;
object
*
name
;
object
*
name
;
#if 0
if (!newgetargs(args, "SO!O!SS",
&code, &Tupletype, &consts, &Tupletype, &names,
&filename, &name))
return NULL;
return (object *)newcodeobject(code, consts, names, filename, name);
#else
if
(
!
newgetargs
(
args
,
"iiiSO!O!O!SS"
,
if
(
!
newgetargs
(
args
,
"iiiSO!O!O!SS"
,
&
argcount
,
&
nlocals
,
&
flags
,
/* These are new */
&
argcount
,
&
nlocals
,
&
flags
,
/* These are new */
&
code
,
&
Tupletype
,
&
consts
,
&
Tupletype
,
&
names
,
&
code
,
&
Tupletype
,
&
consts
,
&
Tupletype
,
&
names
,
...
@@ -158,7 +144,6 @@ new_code(unused, args)
...
@@ -158,7 +144,6 @@ new_code(unused, args)
return
NULL
;
return
NULL
;
return
(
object
*
)
newcodeobject
(
argcount
,
nlocals
,
flags
,
return
(
object
*
)
newcodeobject
(
argcount
,
nlocals
,
flags
,
code
,
consts
,
names
,
varnames
,
filename
,
name
);
code
,
consts
,
names
,
varnames
,
filename
,
name
);
#endif
}
}
static
char
new_module_doc
[]
=
static
char
new_module_doc
[]
=
...
@@ -197,9 +182,7 @@ new_class(unused, args)
...
@@ -197,9 +182,7 @@ new_class(unused, args)
static
struct
methodlist
new_methods
[]
=
{
static
struct
methodlist
new_methods
[]
=
{
{
"instance"
,
new_instance
,
1
,
new_instance_doc
},
{
"instance"
,
new_instance
,
1
,
new_instance_doc
},
{
"instancemethod"
,
new_instancemethod
,
1
,
new_im_doc
},
{
"instancemethod"
,
new_instancemethod
,
1
,
new_im_doc
},
#if 0
{
"function"
,
new_function
,
1
,
new_function_doc
},
{
"function"
,
new_function
,
1
,
new_function_doc
},
#endif
{
"code"
,
new_code
,
1
,
new_code_doc
},
{
"code"
,
new_code
,
1
,
new_code_doc
},
{
"module"
,
new_module
,
1
,
new_module_doc
},
{
"module"
,
new_module
,
1
,
new_module_doc
},
{
"classobj"
,
new_class
,
1
,
new_class_doc
},
{
"classobj"
,
new_class
,
1
,
new_class_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