Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
fdd42c48
Kaydet (Commit)
fdd42c48
authored
Mar 11, 2017
tarafından
Serhiy Storchaka
Kaydeden (comit)
GitHub
Mar 11, 2017
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-20185: Convert list object implementation to Argument Clinic. (#542)
üst
0710d754
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
304 additions
and
4 deletions
+304
-4
test_calltips.py
Lib/idlelib/idle_test/test_calltips.py
+4
-4
listobject.c.h
Objects/clinic/listobject.c.h
+300
-0
listobject.c
Objects/listobject.c
+0
-0
No files found.
Lib/idlelib/idle_test/test_calltips.py
Dosyayı görüntüle @
fdd42c48
...
...
@@ -58,7 +58,7 @@ class Get_signatureTest(unittest.TestCase):
'Create and return a new object. See help(type) for accurate signature.'
)
gtest
(
list
.
__init__
,
'Initialize self. See help(type(self)) for accurate signature.'
)
append_doc
=
"
L.append(object) -> None -- append object to end
"
append_doc
=
"
Append object to the end of the list.
"
gtest
(
list
.
append
,
append_doc
)
gtest
([]
.
append
,
append_doc
)
gtest
(
List
.
append
,
append_doc
)
...
...
@@ -81,9 +81,9 @@ class Get_signatureTest(unittest.TestCase):
def
test_multiline_docstring
(
self
):
# Test fewer lines than max.
self
.
assertEqual
(
signature
(
list
),
"
list() -> new empty lis
t
\n
"
"
list(iterable) -> new list initialized from iterable's items
"
)
self
.
assertEqual
(
signature
(
range
),
"
range(stop) -> range objec
t
\n
"
"
range(start, stop[, step]) -> range object
"
)
# Test max lines
self
.
assertEqual
(
signature
(
bytes
),
'''
\
...
...
Objects/clinic/listobject.c.h
0 → 100644
Dosyayı görüntüle @
fdd42c48
/*[clinic input]
preserve
[clinic start generated code]*/
PyDoc_STRVAR
(
list_insert__doc__
,
"insert($self, index, object, /)
\n
"
"--
\n
"
"
\n
"
"Insert object before index."
);
#define LIST_INSERT_METHODDEF \
{"insert", (PyCFunction)list_insert, METH_FASTCALL, list_insert__doc__},
static
PyObject
*
list_insert_impl
(
PyListObject
*
self
,
Py_ssize_t
index
,
PyObject
*
object
);
static
PyObject
*
list_insert
(
PyListObject
*
self
,
PyObject
**
args
,
Py_ssize_t
nargs
,
PyObject
*
kwnames
)
{
PyObject
*
return_value
=
NULL
;
Py_ssize_t
index
;
PyObject
*
object
;
if
(
!
_PyArg_ParseStack
(
args
,
nargs
,
"nO:insert"
,
&
index
,
&
object
))
{
goto
exit
;
}
if
(
!
_PyArg_NoStackKeywords
(
"insert"
,
kwnames
))
{
goto
exit
;
}
return_value
=
list_insert_impl
(
self
,
index
,
object
);
exit:
return
return_value
;
}
PyDoc_STRVAR
(
list_clear__doc__
,
"clear($self, /)
\n
"
"--
\n
"
"
\n
"
"Remove all items from list."
);
#define LIST_CLEAR_METHODDEF \
{"clear", (PyCFunction)list_clear, METH_NOARGS, list_clear__doc__},
static
PyObject
*
list_clear_impl
(
PyListObject
*
self
);
static
PyObject
*
list_clear
(
PyListObject
*
self
,
PyObject
*
Py_UNUSED
(
ignored
))
{
return
list_clear_impl
(
self
);
}
PyDoc_STRVAR
(
list_copy__doc__
,
"copy($self, /)
\n
"
"--
\n
"
"
\n
"
"Return a shallow copy of the list."
);
#define LIST_COPY_METHODDEF \
{"copy", (PyCFunction)list_copy, METH_NOARGS, list_copy__doc__},
static
PyObject
*
list_copy_impl
(
PyListObject
*
self
);
static
PyObject
*
list_copy
(
PyListObject
*
self
,
PyObject
*
Py_UNUSED
(
ignored
))
{
return
list_copy_impl
(
self
);
}
PyDoc_STRVAR
(
list_append__doc__
,
"append($self, object, /)
\n
"
"--
\n
"
"
\n
"
"Append object to the end of the list."
);
#define LIST_APPEND_METHODDEF \
{"append", (PyCFunction)list_append, METH_O, list_append__doc__},
PyDoc_STRVAR
(
list_extend__doc__
,
"extend($self, iterable, /)
\n
"
"--
\n
"
"
\n
"
"Extend list by appending elements from the iterable."
);
#define LIST_EXTEND_METHODDEF \
{"extend", (PyCFunction)list_extend, METH_O, list_extend__doc__},
PyDoc_STRVAR
(
list_pop__doc__
,
"pop($self, index=-1, /)
\n
"
"--
\n
"
"
\n
"
"Remove and return item at index (default last).
\n
"
"
\n
"
"Raises IndexError if list is empty or index is out of range."
);
#define LIST_POP_METHODDEF \
{"pop", (PyCFunction)list_pop, METH_FASTCALL, list_pop__doc__},
static
PyObject
*
list_pop_impl
(
PyListObject
*
self
,
Py_ssize_t
index
);
static
PyObject
*
list_pop
(
PyListObject
*
self
,
PyObject
**
args
,
Py_ssize_t
nargs
,
PyObject
*
kwnames
)
{
PyObject
*
return_value
=
NULL
;
Py_ssize_t
index
=
-
1
;
if
(
!
_PyArg_ParseStack
(
args
,
nargs
,
"|n:pop"
,
&
index
))
{
goto
exit
;
}
if
(
!
_PyArg_NoStackKeywords
(
"pop"
,
kwnames
))
{
goto
exit
;
}
return_value
=
list_pop_impl
(
self
,
index
);
exit:
return
return_value
;
}
PyDoc_STRVAR
(
list_sort__doc__
,
"sort($self, /, *, key=None, reverse=False)
\n
"
"--
\n
"
"
\n
"
"Stable sort *IN PLACE*."
);
#define LIST_SORT_METHODDEF \
{"sort", (PyCFunction)list_sort, METH_FASTCALL, list_sort__doc__},
static
PyObject
*
list_sort_impl
(
PyListObject
*
self
,
PyObject
*
keyfunc
,
int
reverse
);
static
PyObject
*
list_sort
(
PyListObject
*
self
,
PyObject
**
args
,
Py_ssize_t
nargs
,
PyObject
*
kwnames
)
{
PyObject
*
return_value
=
NULL
;
static
const
char
*
const
_keywords
[]
=
{
"key"
,
"reverse"
,
NULL
};
static
_PyArg_Parser
_parser
=
{
"|$Oi:sort"
,
_keywords
,
0
};
PyObject
*
keyfunc
=
Py_None
;
int
reverse
=
0
;
if
(
!
_PyArg_ParseStackAndKeywords
(
args
,
nargs
,
kwnames
,
&
_parser
,
&
keyfunc
,
&
reverse
))
{
goto
exit
;
}
return_value
=
list_sort_impl
(
self
,
keyfunc
,
reverse
);
exit:
return
return_value
;
}
PyDoc_STRVAR
(
list_reverse__doc__
,
"reverse($self, /)
\n
"
"--
\n
"
"
\n
"
"Reverse *IN PLACE*."
);
#define LIST_REVERSE_METHODDEF \
{"reverse", (PyCFunction)list_reverse, METH_NOARGS, list_reverse__doc__},
static
PyObject
*
list_reverse_impl
(
PyListObject
*
self
);
static
PyObject
*
list_reverse
(
PyListObject
*
self
,
PyObject
*
Py_UNUSED
(
ignored
))
{
return
list_reverse_impl
(
self
);
}
PyDoc_STRVAR
(
list_index__doc__
,
"index($self, value, start=0, stop=sys.maxsize, /)
\n
"
"--
\n
"
"
\n
"
"Return first index of value.
\n
"
"
\n
"
"Raises ValueError if the value is not present."
);
#define LIST_INDEX_METHODDEF \
{"index", (PyCFunction)list_index, METH_FASTCALL, list_index__doc__},
static
PyObject
*
list_index_impl
(
PyListObject
*
self
,
PyObject
*
value
,
Py_ssize_t
start
,
Py_ssize_t
stop
);
static
PyObject
*
list_index
(
PyListObject
*
self
,
PyObject
**
args
,
Py_ssize_t
nargs
,
PyObject
*
kwnames
)
{
PyObject
*
return_value
=
NULL
;
PyObject
*
value
;
Py_ssize_t
start
=
0
;
Py_ssize_t
stop
=
PY_SSIZE_T_MAX
;
if
(
!
_PyArg_ParseStack
(
args
,
nargs
,
"O|O&O&:index"
,
&
value
,
_PyEval_SliceIndex
,
&
start
,
_PyEval_SliceIndex
,
&
stop
))
{
goto
exit
;
}
if
(
!
_PyArg_NoStackKeywords
(
"index"
,
kwnames
))
{
goto
exit
;
}
return_value
=
list_index_impl
(
self
,
value
,
start
,
stop
);
exit:
return
return_value
;
}
PyDoc_STRVAR
(
list_count__doc__
,
"count($self, value, /)
\n
"
"--
\n
"
"
\n
"
"Return number of occurrences of value."
);
#define LIST_COUNT_METHODDEF \
{"count", (PyCFunction)list_count, METH_O, list_count__doc__},
PyDoc_STRVAR
(
list_remove__doc__
,
"remove($self, value, /)
\n
"
"--
\n
"
"
\n
"
"Remove first occurrence of value.
\n
"
"
\n
"
"Raises ValueError if the value is not present."
);
#define LIST_REMOVE_METHODDEF \
{"remove", (PyCFunction)list_remove, METH_O, list_remove__doc__},
PyDoc_STRVAR
(
list___init____doc__
,
"list(iterable=(), /)
\n
"
"--
\n
"
"
\n
"
"Built-in mutable sequence.
\n
"
"
\n
"
"If no argument is given, the constructor creates a new empty list.
\n
"
"The argument must be an iterable if specified."
);
static
int
list___init___impl
(
PyListObject
*
self
,
PyObject
*
iterable
);
static
int
list___init__
(
PyObject
*
self
,
PyObject
*
args
,
PyObject
*
kwargs
)
{
int
return_value
=
-
1
;
PyObject
*
iterable
=
NULL
;
if
((
Py_TYPE
(
self
)
==
&
PyList_Type
)
&&
!
_PyArg_NoKeywords
(
"list"
,
kwargs
))
{
goto
exit
;
}
if
(
!
PyArg_UnpackTuple
(
args
,
"list"
,
0
,
1
,
&
iterable
))
{
goto
exit
;
}
return_value
=
list___init___impl
((
PyListObject
*
)
self
,
iterable
);
exit:
return
return_value
;
}
PyDoc_STRVAR
(
list___sizeof____doc__
,
"__sizeof__($self, /)
\n
"
"--
\n
"
"
\n
"
"Return the size of the list in memory, in bytes."
);
#define LIST___SIZEOF___METHODDEF \
{"__sizeof__", (PyCFunction)list___sizeof__, METH_NOARGS, list___sizeof____doc__},
static
PyObject
*
list___sizeof___impl
(
PyListObject
*
self
);
static
PyObject
*
list___sizeof__
(
PyListObject
*
self
,
PyObject
*
Py_UNUSED
(
ignored
))
{
return
list___sizeof___impl
(
self
);
}
PyDoc_STRVAR
(
list___reversed____doc__
,
"__reversed__($self, /)
\n
"
"--
\n
"
"
\n
"
"Return a reverse iterator over the list."
);
#define LIST___REVERSED___METHODDEF \
{"__reversed__", (PyCFunction)list___reversed__, METH_NOARGS, list___reversed____doc__},
static
PyObject
*
list___reversed___impl
(
PyListObject
*
self
);
static
PyObject
*
list___reversed__
(
PyListObject
*
self
,
PyObject
*
Py_UNUSED
(
ignored
))
{
return
list___reversed___impl
(
self
);
}
/*[clinic end generated code: output=2a3b75efcf858ed5 input=a9049054013a1b77]*/
Objects/listobject.c
Dosyayı görüntüle @
fdd42c48
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