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
ab1049c0
Commit
ab1049c0
authored
Aug 08, 2006
by
Thomas Heller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
memcmp() can return values other than -1, 0, and +1 but tp_compare
must not.
parent
b0061c8e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
1 deletion
+6
-1
Lib/test/test_types.py
Lib/test/test_types.py
+3
-0
Misc/NEWS
Misc/NEWS
+2
-0
Objects/bufferobject.c
Objects/bufferobject.c
+1
-1
No files found.
Lib/test/test_types.py
View file @
ab1049c0
...
@@ -233,6 +233,9 @@ print 'Buffers'
...
@@ -233,6 +233,9 @@ print 'Buffers'
try
:
buffer
(
'asdf'
,
-
1
)
try
:
buffer
(
'asdf'
,
-
1
)
except
ValueError
:
pass
except
ValueError
:
pass
else
:
raise
TestFailed
,
"buffer('asdf', -1) should raise ValueError"
else
:
raise
TestFailed
,
"buffer('asdf', -1) should raise ValueError"
cmp
(
buffer
(
"abc"
),
buffer
(
"def"
))
# used to raise a warning: tp_compare didn't return -1, 0, or 1
cmp
(
buffer
(
'abc'
),
buffer
(
'def'
))
try
:
buffer
(
None
)
try
:
buffer
(
None
)
except
TypeError
:
pass
except
TypeError
:
pass
...
...
Misc/NEWS
View file @
ab1049c0
...
@@ -12,6 +12,8 @@ What's New in Python 2.5 release candidate 1?
...
@@ -12,6 +12,8 @@ What's New in Python 2.5 release candidate 1?
Core and builtins
Core and builtins
-----------------
-----------------
- Bug #1536786: buffer comparison could emit a RuntimeWarning.
- Bug #1535165: fixed a segfault in input() and raw_input() when
- Bug #1535165: fixed a segfault in input() and raw_input() when
sys.stdin is closed.
sys.stdin is closed.
...
...
Objects/bufferobject.c
View file @
ab1049c0
...
@@ -272,7 +272,7 @@ buffer_compare(PyBufferObject *self, PyBufferObject *other)
...
@@ -272,7 +272,7 @@ buffer_compare(PyBufferObject *self, PyBufferObject *other)
if
(
min_len
>
0
)
{
if
(
min_len
>
0
)
{
cmp
=
memcmp
(
p1
,
p2
,
min_len
);
cmp
=
memcmp
(
p1
,
p2
,
min_len
);
if
(
cmp
!=
0
)
if
(
cmp
!=
0
)
return
cmp
;
return
cmp
<
0
?
-
1
:
1
;
}
}
return
(
len_self
<
len_other
)
?
-
1
:
(
len_self
>
len_other
)
?
1
:
0
;
return
(
len_self
<
len_other
)
?
-
1
:
(
len_self
>
len_other
)
?
1
:
0
;
}
}
...
...
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