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
5a04aec3
Commit
5a04aec3
authored
Jun 25, 2002
by
Raymond Hettinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix SF bug 546434 -- buffer slice type inconsistent.
parent
17031bf4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
13 deletions
+5
-13
Misc/NEWS
Misc/NEWS
+5
-0
Objects/bufferobject.c
Objects/bufferobject.c
+0
-13
No files found.
Misc/NEWS
View file @
5a04aec3
...
...
@@ -6,6 +6,11 @@ Type/class unification and new-style classes
Core and builtins
- Slices and repetitions of buffer objects now consistently return
a string. Formerly, strings would be returned most of the time,
but a buffer object would be returned when the repetition count
was one or when the slice range was all inclusive.
- The __slots__ variable can now mention "private" names, and the
right thing will happen (e.g. __slots__ = ["__foo"]).
...
...
Objects/bufferobject.c
View file @
5a04aec3
...
...
@@ -296,13 +296,6 @@ buffer_concat(PyBufferObject *self, PyObject *other)
if
(
(
count
=
(
*
pb
->
bf_getreadbuffer
)(
other
,
0
,
&
p2
))
<
0
)
return
NULL
;
/* optimize special case */
if
(
count
==
0
)
{
Py_INCREF
(
self
);
return
(
PyObject
*
)
self
;
}
ob
=
PyString_FromStringAndSize
(
NULL
,
self
->
b_size
+
count
);
p1
=
PyString_AS_STRING
(
ob
);
memcpy
(
p1
,
self
->
b_ptr
,
self
->
b_size
);
...
...
@@ -361,12 +354,6 @@ buffer_slice(PyBufferObject *self, int left, int right)
right
=
0
;
if
(
right
>
self
->
b_size
)
right
=
self
->
b_size
;
if
(
left
==
0
&&
right
==
self
->
b_size
)
{
/* same as self */
Py_INCREF
(
self
);
return
(
PyObject
*
)
self
;
}
if
(
right
<
left
)
right
=
left
;
return
PyString_FromStringAndSize
((
char
*
)
self
->
b_ptr
+
left
,
...
...
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