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
5c643a02
Commit
5c643a02
authored
Mar 19, 2017
by
Serhiy Storchaka
Committed by
GitHub
Mar 19, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-20185: Convert typeobject.c to Argument Clinic. (#544)
Based on patch by Vajrasky Kok.
parent
bdf6b910
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
391 additions
and
76 deletions
+391
-76
Objects/clinic/typeobject.c.h
Objects/clinic/typeobject.c.h
+259
-0
Objects/typeobject.c
Objects/typeobject.c
+132
-76
No files found.
Objects/clinic/typeobject.c.h
0 → 100644
View file @
5c643a02
/*[clinic input]
preserve
[clinic start generated code]*/
PyDoc_STRVAR
(
type___instancecheck____doc__
,
"__instancecheck__($self, instance, /)
\n
"
"--
\n
"
"
\n
"
"Check if an object is an instance."
);
#define TYPE___INSTANCECHECK___METHODDEF \
{"__instancecheck__", (PyCFunction)type___instancecheck__, METH_O, type___instancecheck____doc__},
static
int
type___instancecheck___impl
(
PyTypeObject
*
self
,
PyObject
*
instance
);
static
PyObject
*
type___instancecheck__
(
PyTypeObject
*
self
,
PyObject
*
instance
)
{
PyObject
*
return_value
=
NULL
;
int
_return_value
;
_return_value
=
type___instancecheck___impl
(
self
,
instance
);
if
((
_return_value
==
-
1
)
&&
PyErr_Occurred
())
{
goto
exit
;
}
return_value
=
PyBool_FromLong
((
long
)
_return_value
);
exit:
return
return_value
;
}
PyDoc_STRVAR
(
type___subclasscheck____doc__
,
"__subclasscheck__($self, subclass, /)
\n
"
"--
\n
"
"
\n
"
"Check if a class is a subclass."
);
#define TYPE___SUBCLASSCHECK___METHODDEF \
{"__subclasscheck__", (PyCFunction)type___subclasscheck__, METH_O, type___subclasscheck____doc__},
static
int
type___subclasscheck___impl
(
PyTypeObject
*
self
,
PyObject
*
subclass
);
static
PyObject
*
type___subclasscheck__
(
PyTypeObject
*
self
,
PyObject
*
subclass
)
{
PyObject
*
return_value
=
NULL
;
int
_return_value
;
_return_value
=
type___subclasscheck___impl
(
self
,
subclass
);
if
((
_return_value
==
-
1
)
&&
PyErr_Occurred
())
{
goto
exit
;
}
return_value
=
PyBool_FromLong
((
long
)
_return_value
);
exit:
return
return_value
;
}
PyDoc_STRVAR
(
type_mro__doc__
,
"mro($self, /)
\n
"
"--
\n
"
"
\n
"
"Return a type
\'
s method resolution order."
);
#define TYPE_MRO_METHODDEF \
{"mro", (PyCFunction)type_mro, METH_NOARGS, type_mro__doc__},
static
PyObject
*
type_mro_impl
(
PyTypeObject
*
self
);
static
PyObject
*
type_mro
(
PyTypeObject
*
self
,
PyObject
*
Py_UNUSED
(
ignored
))
{
return
type_mro_impl
(
self
);
}
PyDoc_STRVAR
(
type___subclasses____doc__
,
"__subclasses__($self, /)
\n
"
"--
\n
"
"
\n
"
"Return a list of immediate subclasses."
);
#define TYPE___SUBCLASSES___METHODDEF \
{"__subclasses__", (PyCFunction)type___subclasses__, METH_NOARGS, type___subclasses____doc__},
static
PyObject
*
type___subclasses___impl
(
PyTypeObject
*
self
);
static
PyObject
*
type___subclasses__
(
PyTypeObject
*
self
,
PyObject
*
Py_UNUSED
(
ignored
))
{
return
type___subclasses___impl
(
self
);
}
PyDoc_STRVAR
(
type___dir____doc__
,
"__dir__($self, /)
\n
"
"--
\n
"
"
\n
"
"Specialized __dir__ implementation for types."
);
#define TYPE___DIR___METHODDEF \
{"__dir__", (PyCFunction)type___dir__, METH_NOARGS, type___dir____doc__},
static
PyObject
*
type___dir___impl
(
PyTypeObject
*
self
);
static
PyObject
*
type___dir__
(
PyTypeObject
*
self
,
PyObject
*
Py_UNUSED
(
ignored
))
{
return
type___dir___impl
(
self
);
}
PyDoc_STRVAR
(
type___sizeof____doc__
,
"__sizeof__($self, /)
\n
"
"--
\n
"
"
\n
"
"Return memory consumption of the type object."
);
#define TYPE___SIZEOF___METHODDEF \
{"__sizeof__", (PyCFunction)type___sizeof__, METH_NOARGS, type___sizeof____doc__},
static
PyObject
*
type___sizeof___impl
(
PyTypeObject
*
self
);
static
PyObject
*
type___sizeof__
(
PyTypeObject
*
self
,
PyObject
*
Py_UNUSED
(
ignored
))
{
return
type___sizeof___impl
(
self
);
}
PyDoc_STRVAR
(
object___reduce____doc__
,
"__reduce__($self, protocol=0, /)
\n
"
"--
\n
"
"
\n
"
"Helper for pickle."
);
#define OBJECT___REDUCE___METHODDEF \
{"__reduce__", (PyCFunction)object___reduce__, METH_FASTCALL, object___reduce____doc__},
static
PyObject
*
object___reduce___impl
(
PyObject
*
self
,
int
protocol
);
static
PyObject
*
object___reduce__
(
PyObject
*
self
,
PyObject
**
args
,
Py_ssize_t
nargs
,
PyObject
*
kwnames
)
{
PyObject
*
return_value
=
NULL
;
int
protocol
=
0
;
if
(
!
_PyArg_ParseStack
(
args
,
nargs
,
"|i:__reduce__"
,
&
protocol
))
{
goto
exit
;
}
if
(
!
_PyArg_NoStackKeywords
(
"__reduce__"
,
kwnames
))
{
goto
exit
;
}
return_value
=
object___reduce___impl
(
self
,
protocol
);
exit:
return
return_value
;
}
PyDoc_STRVAR
(
object___reduce_ex____doc__
,
"__reduce_ex__($self, protocol=0, /)
\n
"
"--
\n
"
"
\n
"
"Helper for pickle."
);
#define OBJECT___REDUCE_EX___METHODDEF \
{"__reduce_ex__", (PyCFunction)object___reduce_ex__, METH_FASTCALL, object___reduce_ex____doc__},
static
PyObject
*
object___reduce_ex___impl
(
PyObject
*
self
,
int
protocol
);
static
PyObject
*
object___reduce_ex__
(
PyObject
*
self
,
PyObject
**
args
,
Py_ssize_t
nargs
,
PyObject
*
kwnames
)
{
PyObject
*
return_value
=
NULL
;
int
protocol
=
0
;
if
(
!
_PyArg_ParseStack
(
args
,
nargs
,
"|i:__reduce_ex__"
,
&
protocol
))
{
goto
exit
;
}
if
(
!
_PyArg_NoStackKeywords
(
"__reduce_ex__"
,
kwnames
))
{
goto
exit
;
}
return_value
=
object___reduce_ex___impl
(
self
,
protocol
);
exit:
return
return_value
;
}
PyDoc_STRVAR
(
object___format____doc__
,
"__format__($self, format_spec, /)
\n
"
"--
\n
"
"
\n
"
"Default object formatter."
);
#define OBJECT___FORMAT___METHODDEF \
{"__format__", (PyCFunction)object___format__, METH_O, object___format____doc__},
static
PyObject
*
object___format___impl
(
PyObject
*
self
,
PyObject
*
format_spec
);
static
PyObject
*
object___format__
(
PyObject
*
self
,
PyObject
*
arg
)
{
PyObject
*
return_value
=
NULL
;
PyObject
*
format_spec
;
if
(
!
PyArg_Parse
(
arg
,
"U:__format__"
,
&
format_spec
))
{
goto
exit
;
}
return_value
=
object___format___impl
(
self
,
format_spec
);
exit:
return
return_value
;
}
PyDoc_STRVAR
(
object___sizeof____doc__
,
"__sizeof__($self, /)
\n
"
"--
\n
"
"
\n
"
"Size of object in memory, in bytes."
);
#define OBJECT___SIZEOF___METHODDEF \
{"__sizeof__", (PyCFunction)object___sizeof__, METH_NOARGS, object___sizeof____doc__},
static
PyObject
*
object___sizeof___impl
(
PyObject
*
self
);
static
PyObject
*
object___sizeof__
(
PyObject
*
self
,
PyObject
*
Py_UNUSED
(
ignored
))
{
return
object___sizeof___impl
(
self
);
}
PyDoc_STRVAR
(
object___dir____doc__
,
"__dir__($self, /)
\n
"
"--
\n
"
"
\n
"
"Default dir() implementation."
);
#define OBJECT___DIR___METHODDEF \
{"__dir__", (PyCFunction)object___dir__, METH_NOARGS, object___dir____doc__},
static
PyObject
*
object___dir___impl
(
PyObject
*
self
);
static
PyObject
*
object___dir__
(
PyObject
*
self
,
PyObject
*
Py_UNUSED
(
ignored
))
{
return
object___dir___impl
(
self
);
}
/*[clinic end generated code: output=ce354e436e2360a0 input=a9049054013a1b77]*/
Objects/typeobject.c
View file @
5c643a02
This diff is collapsed.
Click to expand it.
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