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
1f11cf95
Commit
1f11cf95
authored
Jun 11, 2019
by
Raymond Hettinger
Committed by
GitHub
Jun 11, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-37219: Remove erroneous optimization for differencing an empty set (GH-13965)
parent
408a2ef1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
8 deletions
+7
-8
Lib/test/test_set.py
Lib/test/test_set.py
+6
-0
Misc/NEWS.d/next/Core and Builtins/2019-06-10-23-18-31.bpo-37219.jPSufq.rst
...ore and Builtins/2019-06-10-23-18-31.bpo-37219.jPSufq.rst
+1
-0
Objects/setobject.c
Objects/setobject.c
+0
-8
No files found.
Lib/test/test_set.py
View file @
1f11cf95
...
...
@@ -895,6 +895,12 @@ class TestBasicOps:
self
.
assertEqual
(
self
.
set
,
copy
,
"%s != %s"
%
(
self
.
set
,
copy
))
def
test_issue_37219
(
self
):
with
self
.
assertRaises
(
TypeError
):
set
().
difference
(
123
)
with
self
.
assertRaises
(
TypeError
):
set
().
difference_update
(
123
)
#------------------------------------------------------------------------------
class
TestBasicOpsEmpty
(
TestBasicOps
,
unittest
.
TestCase
):
...
...
Misc/NEWS.d/next/Core and Builtins/2019-06-10-23-18-31.bpo-37219.jPSufq.rst
0 → 100644
View file @
1f11cf95
Remove errorneous optimization for empty set differences.
Objects/setobject.c
View file @
1f11cf95
...
...
@@ -1456,10 +1456,6 @@ PyDoc_STRVAR(isdisjoint_doc,
static
int
set_difference_update_internal
(
PySetObject
*
so
,
PyObject
*
other
)
{
if
(
PySet_GET_SIZE
(
so
)
==
0
)
{
return
0
;
}
if
((
PyObject
*
)
so
==
other
)
return
set_clear_internal
(
so
);
...
...
@@ -1534,10 +1530,6 @@ set_difference(PySetObject *so, PyObject *other)
Py_ssize_t
pos
=
0
,
other_size
;
int
rv
;
if
(
PySet_GET_SIZE
(
so
)
==
0
)
{
return
set_copy
(
so
,
NULL
);
}
if
(
PyAnySet_Check
(
other
))
{
other_size
=
PySet_GET_SIZE
(
other
);
}
...
...
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