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
df419891
Kaydet (Commit)
df419891
authored
Şub 25, 2008
tarafından
Facundo Batista
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue 2168. gdbm and dbm needs to be iterable; this fixes a
failure in the shelve module. Thanks Thomas Herve.
üst
fd429063
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
68 additions
and
3 deletions
+68
-3
dbmmodule.c
Modules/dbmmodule.c
+39
-1
gdbmmodule.c
Modules/gdbmmodule.c
+29
-2
No files found.
Modules/dbmmodule.c
Dosyayı görüntüle @
df419891
...
...
@@ -161,6 +161,37 @@ dbm_ass_sub(dbmobject *dp, PyObject *v, PyObject *w)
return
0
;
}
static
int
dbm_contains
(
register
dbmobject
*
dp
,
PyObject
*
v
)
{
datum
key
,
val
;
if
(
PyString_AsStringAndSize
(
v
,
&
key
.
dptr
,
&
key
.
dsize
))
{
return
-
1
;
}
/* Expand check_dbmobject_open to return -1 */
if
(
dp
->
di_dbm
==
NULL
)
{
PyErr_SetString
(
DbmError
,
"DBM object has already been closed"
);
return
-
1
;
}
val
=
dbm_fetch
(
dp
->
di_dbm
,
key
);
return
val
.
dptr
!=
NULL
;
}
static
PySequenceMethods
dbm_as_sequence
=
{
(
lenfunc
)
dbm_length
,
/*_length*/
0
,
/*sq_concat*/
0
,
/*sq_repeat*/
0
,
/*sq_item*/
0
,
/*sq_slice*/
0
,
/*sq_ass_item*/
0
,
/*sq_ass_slice*/
(
objobjproc
)
dbm_contains
,
/*sq_contains*/
0
,
/*sq_inplace_concat*/
0
/*sq_inplace_repeat*/
};
static
PyMappingMethods
dbm_as_mapping
=
{
(
lenfunc
)
dbm_length
,
/*mp_length*/
(
binaryfunc
)
dbm_subscript
,
/*mp_subscript*/
...
...
@@ -313,8 +344,15 @@ static PyTypeObject Dbmtype = {
0
,
/*tp_compare*/
0
,
/*tp_repr*/
0
,
/*tp_as_number*/
0
,
/*tp_as_sequence*/
&
dbm_as_sequence
,
/*tp_as_sequence*/
&
dbm_as_mapping
,
/*tp_as_mapping*/
0
,
/*tp_hash*/
0
,
/*tp_call*/
0
,
/*tp_str*/
0
,
/*tp_getattro*/
0
,
/*tp_setattro*/
0
,
/*tp_as_buffer*/
Py_TPFLAGS_DEFAULT
,
/*tp_xxx4*/
};
/* ----------------------------------------------------------------- */
...
...
Modules/gdbmmodule.c
Dosyayı görüntüle @
df419891
...
...
@@ -178,6 +178,33 @@ dbm_ass_sub(dbmobject *dp, PyObject *v, PyObject *w)
return
0
;
}
static
int
dbm_contains
(
register
dbmobject
*
dp
,
PyObject
*
v
)
{
datum
key
;
if
(
PyString_AsStringAndSize
(
v
,
&
key
.
dptr
,
&
key
.
dsize
))
{
return
-
1
;
}
check_dbmobject_open
(
dp
);
return
gdbm_exists
(
dp
->
di_dbm
,
key
);
}
static
PySequenceMethods
dbm_as_sequence
=
{
(
lenfunc
)
dbm_length
,
/*_length*/
0
,
/*sq_concat*/
0
,
/*sq_repeat*/
0
,
/*sq_item*/
0
,
/*sq_slice*/
0
,
/*sq_ass_item*/
0
,
/*sq_ass_slice*/
(
objobjproc
)
dbm_contains
,
/*sq_contains*/
0
,
/*sq_inplace_concat*/
0
/*sq_inplace_repeat*/
};
static
PyMappingMethods
dbm_as_mapping
=
{
(
lenfunc
)
dbm_length
,
/*mp_length*/
(
binaryfunc
)
dbm_subscript
,
/*mp_subscript*/
...
...
@@ -381,7 +408,7 @@ static PyTypeObject Dbmtype = {
0
,
/*tp_compare*/
0
,
/*tp_repr*/
0
,
/*tp_as_number*/
0
,
/*tp_as_sequence*/
&
dbm_as_sequence
,
/*tp_as_sequence*/
&
dbm_as_mapping
,
/*tp_as_mapping*/
0
,
/*tp_hash*/
0
,
/*tp_call*/
...
...
@@ -389,7 +416,7 @@ static PyTypeObject Dbmtype = {
0
,
/*tp_getattro*/
0
,
/*tp_setattro*/
0
,
/*tp_as_buffer*/
0
,
/*tp_xxx4*/
Py_TPFLAGS_DEFAULT
,
/*tp_xxx4*/
gdbm_object__doc__
,
/*tp_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