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
127ef44c
Commit
127ef44c
authored
Feb 07, 2007
by
Raymond Hettinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug #1575169: operator.isSequenceType() now returns False for subclasses of dict.
parent
113776c4
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
0 deletions
+6
-0
Lib/test/test_operator.py
Lib/test/test_operator.py
+2
-0
Misc/NEWS
Misc/NEWS
+2
-0
Objects/abstract.c
Objects/abstract.c
+2
-0
No files found.
Lib/test/test_operator.py
View file @
127ef44c
...
@@ -215,6 +215,8 @@ class OperatorTestCase(unittest.TestCase):
...
@@ -215,6 +215,8 @@ class OperatorTestCase(unittest.TestCase):
self
.
failUnless
(
operator
.
isSequenceType
(
xrange
(
10
)))
self
.
failUnless
(
operator
.
isSequenceType
(
xrange
(
10
)))
self
.
failUnless
(
operator
.
isSequenceType
(
'yeahbuddy'
))
self
.
failUnless
(
operator
.
isSequenceType
(
'yeahbuddy'
))
self
.
failIf
(
operator
.
isSequenceType
(
3
))
self
.
failIf
(
operator
.
isSequenceType
(
3
))
class
Dict
(
dict
):
pass
self
.
failIf
(
operator
.
isSequenceType
(
Dict
()))
def
test_lshift
(
self
):
def
test_lshift
(
self
):
self
.
failUnlessRaises
(
TypeError
,
operator
.
lshift
)
self
.
failUnlessRaises
(
TypeError
,
operator
.
lshift
)
...
...
Misc/NEWS
View file @
127ef44c
...
@@ -103,6 +103,8 @@ Core and builtins
...
@@ -103,6 +103,8 @@ Core and builtins
Extension
Modules
Extension
Modules
-----------------
-----------------
-
Bug
#
1575169
:
operator
.
isSequenceType
()
now
returns
False
for
subclasses
of
dict
.
-
collections
.
defaultdict
()
now
verifies
that
the
factory
function
is
callable
.
-
collections
.
defaultdict
()
now
verifies
that
the
factory
function
is
callable
.
-
Bug
#
1486663
:
don
't reject keyword arguments for subclasses of builtin
-
Bug
#
1486663
:
don
't reject keyword arguments for subclasses of builtin
...
...
Objects/abstract.c
View file @
127ef44c
...
@@ -1157,6 +1157,8 @@ PySequence_Check(PyObject *s)
...
@@ -1157,6 +1157,8 @@ PySequence_Check(PyObject *s)
{
{
if
(
s
&&
PyInstance_Check
(
s
))
if
(
s
&&
PyInstance_Check
(
s
))
return
PyObject_HasAttrString
(
s
,
"__getitem__"
);
return
PyObject_HasAttrString
(
s
,
"__getitem__"
);
if
(
PyObject_IsInstance
(
s
,
&
PyDict_Type
))
return
0
;
return
s
!=
NULL
&&
s
->
ob_type
->
tp_as_sequence
&&
return
s
!=
NULL
&&
s
->
ob_type
->
tp_as_sequence
&&
s
->
ob_type
->
tp_as_sequence
->
sq_item
!=
NULL
;
s
->
ob_type
->
tp_as_sequence
->
sq_item
!=
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