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
5432a9ad
Commit
5432a9ad
authored
Jun 17, 1996
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added new.instance(class, dict).
parent
eac2e858
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
0 deletions
+26
-0
Modules/newmodule.c
Modules/newmodule.c
+26
-0
No files found.
Modules/newmodule.c
View file @
5432a9ad
...
@@ -27,6 +27,31 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
...
@@ -27,6 +27,31 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "allobjects.h"
#include "allobjects.h"
#include "compile.h"
#include "compile.h"
static
char
new_instance_doc
[]
=
"Create an instance object from (CLASS, DICT) without calling its __init__()."
;
static
object
*
new_instance
(
unused
,
args
)
object
*
unused
;
object
*
args
;
{
object
*
klass
;
object
*
dict
;
instanceobject
*
inst
;
if
(
!
newgetargs
(
args
,
"O!O!"
,
&
Classtype
,
&
klass
,
&
Dicttype
,
&
dict
))
return
NULL
;
inst
=
NEWOBJ
(
instanceobject
,
&
Instancetype
);
if
(
inst
==
NULL
)
return
NULL
;
INCREF
(
klass
);
INCREF
(
dict
);
inst
->
in_class
=
(
classobject
*
)
klass
;
inst
->
in_dict
=
dict
;
return
(
object
*
)
inst
;
}
static
char
new_im_doc
[]
=
static
char
new_im_doc
[]
=
"Create a instance method object from (FUNCTION, INSTANCE, CLASS)."
;
"Create a instance method object from (FUNCTION, INSTANCE, CLASS)."
;
...
@@ -163,6 +188,7 @@ new_class(unused, args)
...
@@ -163,6 +188,7 @@ new_class(unused, args)
}
}
static
struct
methodlist
new_methods
[]
=
{
static
struct
methodlist
new_methods
[]
=
{
{
"instance"
,
new_instance
,
1
,
new_instance_doc
},
{
"instancemethod"
,
new_instancemethod
,
1
,
new_im_doc
},
{
"instancemethod"
,
new_instancemethod
,
1
,
new_im_doc
},
#if 0
#if 0
{"function", new_function, 1, new_function_doc},
{"function", new_function, 1, new_function_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