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
f7820c16
Commit
f7820c16
authored
Oct 24, 2009
by
Antoine Pitrou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Manual py3k backport: [svn r74316] Issue #5449: Fix io.BytesIO to not accept arbitrary keywords
parent
fa94e80f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
1 deletion
+8
-1
Lib/test/test_memoryio.py
Lib/test/test_memoryio.py
+5
-0
Modules/_io/bytesio.c
Modules/_io/bytesio.c
+3
-1
No files found.
Lib/test/test_memoryio.py
View file @
f7820c16
...
...
@@ -467,6 +467,11 @@ class PyBytesIOTest(MemoryTestMixin, MemorySeekTestMixin, unittest.TestCase):
self
.
assertEqual
(
memio
.
write
(
a
),
10
)
self
.
assertEqual
(
memio
.
getvalue
(),
buf
)
def
test_issue5449
(
self
):
buf
=
self
.
buftype
(
"1234567890"
)
self
.
ioclass
(
initial_bytes
=
buf
)
self
.
assertRaises
(
TypeError
,
self
.
ioclass
,
buf
,
foo
=
None
)
class
TextIOTestMixin
:
...
...
Modules/_io/bytesio.c
View file @
f7820c16
...
...
@@ -766,9 +766,11 @@ bytesio_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
static
int
bytesio_init
(
bytesio
*
self
,
PyObject
*
args
,
PyObject
*
kwds
)
{
char
*
kwlist
[]
=
{
"initial_bytes"
,
NULL
};
PyObject
*
initvalue
=
NULL
;
if
(
!
PyArg_ParseTuple
(
args
,
"|O:BytesIO"
,
&
initvalue
))
if
(
!
PyArg_ParseTupleAndKeywords
(
args
,
kwds
,
"|O:BytesIO"
,
kwlist
,
&
initvalue
))
return
-
1
;
/* In case, __init__ is called multiple times. */
...
...
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