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
1bf47653
Commit
1bf47653
authored
Jul 02, 2009
by
Benjamin Peterson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
only order comparisons are removed in py3k #6119
parent
0c6de43d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
7 deletions
+20
-7
Lib/test/test_py3kwarn.py
Lib/test/test_py3kwarn.py
+10
-1
Misc/NEWS
Misc/NEWS
+3
-0
Objects/methodobject.c
Objects/methodobject.c
+7
-6
No files found.
Lib/test/test_py3kwarn.py
View file @
1bf47653
...
...
@@ -21,6 +21,9 @@ class TestPy3KWarnings(unittest.TestCase):
def
assertWarning
(
self
,
_
,
warning
,
expected_message
):
self
.
assertEqual
(
str
(
warning
.
message
),
expected_message
)
def
assertNoWarning
(
self
,
_
,
recorder
):
self
.
assertEqual
(
len
(
recorder
.
warnings
),
0
)
def
test_backquote
(
self
):
expected
=
'backquote not supported in 3.x; use repr()'
with
check_warnings
()
as
w
:
...
...
@@ -113,7 +116,7 @@ class TestPy3KWarnings(unittest.TestCase):
def
test_builtin_function_or_method_comparisons
(
self
):
expected
=
(
'builtin_function_or_method '
'
inequality
comparisons not supported in 3.x'
)
'
order
comparisons not supported in 3.x'
)
func
=
eval
meth
=
{}.
get
with
check_warnings
()
as
w
:
...
...
@@ -124,6 +127,12 @@ class TestPy3KWarnings(unittest.TestCase):
self
.
assertWarning
(
meth
<=
func
,
w
,
expected
)
w
.
reset
()
self
.
assertWarning
(
meth
>=
func
,
w
,
expected
)
w
.
reset
()
self
.
assertNoWarning
(
meth
==
func
,
w
)
self
.
assertNoWarning
(
meth
!=
func
,
w
)
lam
=
lambda
x
:
x
self
.
assertNoWarning
(
lam
==
func
,
w
)
self
.
assertNoWarning
(
lam
!=
func
,
w
)
def
test_frame_attributes
(
self
):
template
=
"%s has been removed in 3.x"
...
...
Misc/NEWS
View file @
1bf47653
...
...
@@ -12,6 +12,9 @@ What's New in Python 2.7 alpha 1
Core and Builtins
-----------------
- Issue #6119: Fixed a incorrect Py3k warning about order comparisons of builtin
functions and methods.
- Issue #6347: Include inttypes.h as well as stdint.h in pyport.h.
This fixes a build failure on HP-UX: int32_t and uint32_t are
defined in inttypes.h instead of stdint.h on that platform.
...
...
Objects/methodobject.c
View file @
1bf47653
...
...
@@ -230,12 +230,9 @@ meth_richcompare(PyObject *self, PyObject *other, int op)
PyObject
*
res
;
int
eq
;
if
((
op
!=
Py_EQ
&&
op
!=
Py_NE
)
||
!
PyCFunction_Check
(
self
)
||
!
PyCFunction_Check
(
other
))
{
/* Py3K warning if types are not equal and comparison isn't == or != */
if
(
PyErr_WarnPy3k
(
"builtin_function_or_method inequality "
if
(
op
!=
Py_EQ
&&
op
!=
Py_NE
)
{
/* Py3K warning if comparison isn't == or !=. */
if
(
PyErr_WarnPy3k
(
"builtin_function_or_method order "
"comparisons not supported in 3.x"
,
1
)
<
0
)
{
return
NULL
;
}
...
...
@@ -243,6 +240,10 @@ meth_richcompare(PyObject *self, PyObject *other, int op)
Py_INCREF
(
Py_NotImplemented
);
return
Py_NotImplemented
;
}
else
if
(
!
PyCFunction_Check
(
self
)
||
!
PyCFunction_Check
(
other
))
{
Py_INCREF
(
Py_NotImplemented
);
return
Py_NotImplemented
;
}
a
=
(
PyCFunctionObject
*
)
self
;
b
=
(
PyCFunctionObject
*
)
other
;
eq
=
a
->
m_self
==
b
->
m_self
;
...
...
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