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
4ddb44a1
Kaydet (Commit)
4ddb44a1
authored
Mar 04, 2016
tarafından
Benjamin Peterson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
properly use PyObject_CallMethod in dictview binary operations (closes #26478)
üst
69d7f6a6
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
5 deletions
+12
-5
test_dictviews.py
Lib/test/test_dictviews.py
+4
-0
NEWS
Misc/NEWS
+3
-0
dictobject.c
Objects/dictobject.c
+5
-5
No files found.
Lib/test/test_dictviews.py
Dosyayı görüntüle @
4ddb44a1
...
@@ -98,6 +98,7 @@ class DictSetTest(unittest.TestCase):
...
@@ -98,6 +98,7 @@ class DictSetTest(unittest.TestCase):
self
.
assertEqual
(
d1
.
viewkeys
()
&
set
(
d1
.
viewkeys
()),
{
'a'
,
'b'
})
self
.
assertEqual
(
d1
.
viewkeys
()
&
set
(
d1
.
viewkeys
()),
{
'a'
,
'b'
})
self
.
assertEqual
(
d1
.
viewkeys
()
&
set
(
d2
.
viewkeys
()),
{
'b'
})
self
.
assertEqual
(
d1
.
viewkeys
()
&
set
(
d2
.
viewkeys
()),
{
'b'
})
self
.
assertEqual
(
d1
.
viewkeys
()
&
set
(
d3
.
viewkeys
()),
set
())
self
.
assertEqual
(
d1
.
viewkeys
()
&
set
(
d3
.
viewkeys
()),
set
())
self
.
assertEqual
(
d1
.
viewkeys
()
&
tuple
(
d1
.
viewkeys
()),
{
'a'
,
'b'
})
self
.
assertEqual
(
d1
.
viewkeys
()
|
d1
.
viewkeys
(),
{
'a'
,
'b'
})
self
.
assertEqual
(
d1
.
viewkeys
()
|
d1
.
viewkeys
(),
{
'a'
,
'b'
})
self
.
assertEqual
(
d1
.
viewkeys
()
|
d2
.
viewkeys
(),
{
'a'
,
'b'
,
'c'
})
self
.
assertEqual
(
d1
.
viewkeys
()
|
d2
.
viewkeys
(),
{
'a'
,
'b'
,
'c'
})
...
@@ -106,6 +107,7 @@ class DictSetTest(unittest.TestCase):
...
@@ -106,6 +107,7 @@ class DictSetTest(unittest.TestCase):
self
.
assertEqual
(
d1
.
viewkeys
()
|
set
(
d2
.
viewkeys
()),
{
'a'
,
'b'
,
'c'
})
self
.
assertEqual
(
d1
.
viewkeys
()
|
set
(
d2
.
viewkeys
()),
{
'a'
,
'b'
,
'c'
})
self
.
assertEqual
(
d1
.
viewkeys
()
|
set
(
d3
.
viewkeys
()),
self
.
assertEqual
(
d1
.
viewkeys
()
|
set
(
d3
.
viewkeys
()),
{
'a'
,
'b'
,
'd'
,
'e'
})
{
'a'
,
'b'
,
'd'
,
'e'
})
self
.
assertEqual
(
d1
.
viewkeys
()
|
(
1
,
2
),
{
'a'
,
'b'
,
1
,
2
})
self
.
assertEqual
(
d1
.
viewkeys
()
^
d1
.
viewkeys
(),
set
())
self
.
assertEqual
(
d1
.
viewkeys
()
^
d1
.
viewkeys
(),
set
())
self
.
assertEqual
(
d1
.
viewkeys
()
^
d2
.
viewkeys
(),
{
'a'
,
'c'
})
self
.
assertEqual
(
d1
.
viewkeys
()
^
d2
.
viewkeys
(),
{
'a'
,
'c'
})
...
@@ -114,6 +116,7 @@ class DictSetTest(unittest.TestCase):
...
@@ -114,6 +116,7 @@ class DictSetTest(unittest.TestCase):
self
.
assertEqual
(
d1
.
viewkeys
()
^
set
(
d2
.
viewkeys
()),
{
'a'
,
'c'
})
self
.
assertEqual
(
d1
.
viewkeys
()
^
set
(
d2
.
viewkeys
()),
{
'a'
,
'c'
})
self
.
assertEqual
(
d1
.
viewkeys
()
^
set
(
d3
.
viewkeys
()),
self
.
assertEqual
(
d1
.
viewkeys
()
^
set
(
d3
.
viewkeys
()),
{
'a'
,
'b'
,
'd'
,
'e'
})
{
'a'
,
'b'
,
'd'
,
'e'
})
self
.
assertEqual
(
d1
.
viewkeys
()
^
tuple
(
d2
.
keys
()),
{
'a'
,
'c'
})
self
.
assertEqual
(
d1
.
viewkeys
()
-
d1
.
viewkeys
(),
set
())
self
.
assertEqual
(
d1
.
viewkeys
()
-
d1
.
viewkeys
(),
set
())
self
.
assertEqual
(
d1
.
viewkeys
()
-
d2
.
viewkeys
(),
{
'a'
})
self
.
assertEqual
(
d1
.
viewkeys
()
-
d2
.
viewkeys
(),
{
'a'
})
...
@@ -121,6 +124,7 @@ class DictSetTest(unittest.TestCase):
...
@@ -121,6 +124,7 @@ class DictSetTest(unittest.TestCase):
self
.
assertEqual
(
d1
.
viewkeys
()
-
set
(
d1
.
viewkeys
()),
set
())
self
.
assertEqual
(
d1
.
viewkeys
()
-
set
(
d1
.
viewkeys
()),
set
())
self
.
assertEqual
(
d1
.
viewkeys
()
-
set
(
d2
.
viewkeys
()),
{
'a'
})
self
.
assertEqual
(
d1
.
viewkeys
()
-
set
(
d2
.
viewkeys
()),
{
'a'
})
self
.
assertEqual
(
d1
.
viewkeys
()
-
set
(
d3
.
viewkeys
()),
{
'a'
,
'b'
})
self
.
assertEqual
(
d1
.
viewkeys
()
-
set
(
d3
.
viewkeys
()),
{
'a'
,
'b'
})
self
.
assertEqual
(
d1
.
viewkeys
()
-
(
0
,
1
),
{
'a'
,
'b'
})
def
test_items_set_operations
(
self
):
def
test_items_set_operations
(
self
):
d1
=
{
'a'
:
1
,
'b'
:
2
}
d1
=
{
'a'
:
1
,
'b'
:
2
}
...
...
Misc/NEWS
Dosyayı görüntüle @
4ddb44a1
...
@@ -49,6 +49,9 @@ Core and Builtins
...
@@ -49,6 +49,9 @@ Core and Builtins
__str__
,
__trunc__
,
and
__float__
returning
instances
of
subclasses
of
__str__
,
__trunc__
,
and
__float__
returning
instances
of
subclasses
of
str
,
long
,
and
float
to
subclasses
of
str
,
long
,
and
float
correspondingly
.
str
,
long
,
and
float
to
subclasses
of
str
,
long
,
and
float
correspondingly
.
-
Issue
#
26478
:
Fix
semantic
bugs
when
using
binary
operators
with
dictionary
views
and
tuples
.
-
Issue
#
26171
:
Fix
possible
integer
overflow
and
heap
corruption
in
-
Issue
#
26171
:
Fix
possible
integer
overflow
and
heap
corruption
in
zipimporter
.
get_data
().
zipimporter
.
get_data
().
...
...
Objects/dictobject.c
Dosyayı görüntüle @
4ddb44a1
...
@@ -2998,7 +2998,8 @@ dictviews_sub(PyObject* self, PyObject *other)
...
@@ -2998,7 +2998,8 @@ dictviews_sub(PyObject* self, PyObject *other)
if
(
result
==
NULL
)
if
(
result
==
NULL
)
return
NULL
;
return
NULL
;
tmp
=
PyObject_CallMethod
(
result
,
"difference_update"
,
"O"
,
other
);
tmp
=
PyObject_CallMethod
(
result
,
"difference_update"
,
"(O)"
,
other
);
if
(
tmp
==
NULL
)
{
if
(
tmp
==
NULL
)
{
Py_DECREF
(
result
);
Py_DECREF
(
result
);
return
NULL
;
return
NULL
;
...
@@ -3016,7 +3017,7 @@ dictviews_and(PyObject* self, PyObject *other)
...
@@ -3016,7 +3017,7 @@ dictviews_and(PyObject* self, PyObject *other)
if
(
result
==
NULL
)
if
(
result
==
NULL
)
return
NULL
;
return
NULL
;
tmp
=
PyObject_CallMethod
(
result
,
"intersection_update"
,
"
O
"
,
other
);
tmp
=
PyObject_CallMethod
(
result
,
"intersection_update"
,
"
(O)
"
,
other
);
if
(
tmp
==
NULL
)
{
if
(
tmp
==
NULL
)
{
Py_DECREF
(
result
);
Py_DECREF
(
result
);
return
NULL
;
return
NULL
;
...
@@ -3034,7 +3035,7 @@ dictviews_or(PyObject* self, PyObject *other)
...
@@ -3034,7 +3035,7 @@ dictviews_or(PyObject* self, PyObject *other)
if
(
result
==
NULL
)
if
(
result
==
NULL
)
return
NULL
;
return
NULL
;
tmp
=
PyObject_CallMethod
(
result
,
"update"
,
"
O
"
,
other
);
tmp
=
PyObject_CallMethod
(
result
,
"update"
,
"
(O)
"
,
other
);
if
(
tmp
==
NULL
)
{
if
(
tmp
==
NULL
)
{
Py_DECREF
(
result
);
Py_DECREF
(
result
);
return
NULL
;
return
NULL
;
...
@@ -3052,8 +3053,7 @@ dictviews_xor(PyObject* self, PyObject *other)
...
@@ -3052,8 +3053,7 @@ dictviews_xor(PyObject* self, PyObject *other)
if
(
result
==
NULL
)
if
(
result
==
NULL
)
return
NULL
;
return
NULL
;
tmp
=
PyObject_CallMethod
(
result
,
"symmetric_difference_update"
,
"O"
,
tmp
=
PyObject_CallMethod
(
result
,
"symmetric_difference_update"
,
"(O)"
,
other
);
other
);
if
(
tmp
==
NULL
)
{
if
(
tmp
==
NULL
)
{
Py_DECREF
(
result
);
Py_DECREF
(
result
);
return
NULL
;
return
NULL
;
...
...
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