Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Pyston
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
Boxiang Sun
Pyston
Commits
d2e9aed7
Commit
d2e9aed7
authored
Oct 15, 2015
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make cStringIO.readline use METH_O
parent
a419290b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
10 deletions
+28
-10
from_cpython/Modules/cStringIO.c
from_cpython/Modules/cStringIO.c
+6
-5
from_cpython/Python/getargs.c
from_cpython/Python/getargs.c
+22
-5
No files found.
from_cpython/Modules/cStringIO.c
View file @
d2e9aed7
...
@@ -222,12 +222,13 @@ IO_creadline(PyObject *self, char **output) {
...
@@ -222,12 +222,13 @@ IO_creadline(PyObject *self, char **output) {
}
}
static
PyObject
*
static
PyObject
*
IO_readline
(
IOobject
*
self
,
PyObject
*
args
)
{
IO_readline
(
IOobject
*
self
,
PyObject
*
m_obj
)
{
int
n
,
m
=-
1
;
int
n
,
m
=-
1
;
char
*
output
;
char
*
output
;
if
(
args
)
// Pyston change:
if
(
!
PyArg_ParseTuple
(
args
,
"|i:readline"
,
&
m
))
return
NULL
;
if
(
m_obj
)
if
(
!
PyArg_ParseSingle
(
m_obj
,
1
,
"readline"
,
"i"
,
&
m
))
return
NULL
;
if
(
(
n
=
IO_creadline
((
PyObject
*
)
self
,
&
output
))
<
0
)
return
NULL
;
if
(
(
n
=
IO_creadline
((
PyObject
*
)
self
,
&
output
))
<
0
)
return
NULL
;
if
(
m
>=
0
&&
m
<
n
)
{
if
(
m
>=
0
&&
m
<
n
)
{
...
@@ -514,7 +515,7 @@ static struct PyMethodDef O_methods[] = {
...
@@ -514,7 +515,7 @@ static struct PyMethodDef O_methods[] = {
{
"getvalue"
,
(
PyCFunction
)
IO_getval
,
METH_VARARGS
,
IO_getval__doc__
},
{
"getvalue"
,
(
PyCFunction
)
IO_getval
,
METH_VARARGS
,
IO_getval__doc__
},
{
"isatty"
,
(
PyCFunction
)
IO_isatty
,
METH_NOARGS
,
IO_isatty__doc__
},
{
"isatty"
,
(
PyCFunction
)
IO_isatty
,
METH_NOARGS
,
IO_isatty__doc__
},
{
"read"
,
(
PyCFunction
)
IO_read
,
METH_VARARGS
,
IO_read__doc__
},
{
"read"
,
(
PyCFunction
)
IO_read
,
METH_VARARGS
,
IO_read__doc__
},
{
"readline"
,
(
PyCFunction
)
IO_readline
,
METH_VARARGS
,
IO_readline__doc__
},
{
"readline"
,
(
PyCFunction
)
IO_readline
,
/* Pyston change: */
METH_O
|
METH_D1
,
IO_readline__doc__
},
{
"readlines"
,
(
PyCFunction
)
IO_readlines
,
METH_VARARGS
,
IO_readlines__doc__
},
{
"readlines"
,
(
PyCFunction
)
IO_readlines
,
METH_VARARGS
,
IO_readlines__doc__
},
{
"reset"
,
(
PyCFunction
)
IO_reset
,
METH_NOARGS
,
IO_reset__doc__
},
{
"reset"
,
(
PyCFunction
)
IO_reset
,
METH_NOARGS
,
IO_reset__doc__
},
{
"seek"
,
(
PyCFunction
)
IO_seek
,
METH_VARARGS
,
IO_seek__doc__
},
{
"seek"
,
(
PyCFunction
)
IO_seek
,
METH_VARARGS
,
IO_seek__doc__
},
...
@@ -621,7 +622,7 @@ static struct PyMethodDef I_methods[] = {
...
@@ -621,7 +622,7 @@ static struct PyMethodDef I_methods[] = {
{
"getvalue"
,
(
PyCFunction
)
IO_getval
,
METH_VARARGS
,
IO_getval__doc__
},
{
"getvalue"
,
(
PyCFunction
)
IO_getval
,
METH_VARARGS
,
IO_getval__doc__
},
{
"isatty"
,
(
PyCFunction
)
IO_isatty
,
METH_NOARGS
,
IO_isatty__doc__
},
{
"isatty"
,
(
PyCFunction
)
IO_isatty
,
METH_NOARGS
,
IO_isatty__doc__
},
{
"read"
,
(
PyCFunction
)
IO_read
,
METH_VARARGS
,
IO_read__doc__
},
{
"read"
,
(
PyCFunction
)
IO_read
,
METH_VARARGS
,
IO_read__doc__
},
{
"readline"
,
(
PyCFunction
)
IO_readline
,
METH_VARARGS
,
IO_readline__doc__
},
{
"readline"
,
(
PyCFunction
)
IO_readline
,
/* Pyston change: */
METH_O
|
METH_D1
,
IO_readline__doc__
},
{
"readlines"
,
(
PyCFunction
)
IO_readlines
,
METH_VARARGS
,
IO_readlines__doc__
},
{
"readlines"
,
(
PyCFunction
)
IO_readlines
,
METH_VARARGS
,
IO_readlines__doc__
},
{
"reset"
,
(
PyCFunction
)
IO_reset
,
METH_NOARGS
,
IO_reset__doc__
},
{
"reset"
,
(
PyCFunction
)
IO_reset
,
METH_NOARGS
,
IO_reset__doc__
},
{
"seek"
,
(
PyCFunction
)
IO_seek
,
METH_VARARGS
,
IO_seek__doc__
},
{
"seek"
,
(
PyCFunction
)
IO_seek
,
METH_VARARGS
,
IO_seek__doc__
},
...
...
from_cpython/Python/getargs.c
View file @
d2e9aed7
...
@@ -569,8 +569,7 @@ float_argument_error(PyObject *arg)
...
@@ -569,8 +569,7 @@ float_argument_error(PyObject *arg)
return
0
;
return
0
;
}
}
int
_PyArg_ParseSingle_SizeT
(
PyObject
*
obj
,
int
arg_idx
,
const
char
*
fname
,
const
char
*
format
,
...)
{
int
vgetsingle
(
PyObject
*
obj
,
int
arg_idx
,
const
char
*
fname
,
const
char
*
format
,
va_list
*
v_pa
,
int
flags
)
{
va_list
va
;
char
*
msg
;
char
*
msg
;
char
msgbuf
[
256
];
char
msgbuf
[
256
];
...
@@ -582,9 +581,7 @@ int _PyArg_ParseSingle_SizeT(PyObject* obj, int arg_idx, const char* fname, cons
...
@@ -582,9 +581,7 @@ int _PyArg_ParseSingle_SizeT(PyObject* obj, int arg_idx, const char* fname, cons
assert
(
format
[
1
]
!=
'*'
);
// would need to pass a non-null freelist
assert
(
format
[
1
]
!=
'*'
);
// would need to pass a non-null freelist
assert
(
format
[
0
]
!=
'e'
);
// would need to pass a non-null freelist
assert
(
format
[
0
]
!=
'e'
);
// would need to pass a non-null freelist
va_start
(
va
,
format
);
msg
=
convertsimple
(
obj
,
&
format
,
v_pa
,
flags
,
msgbuf
,
sizeof
(
msgbuf
),
NULL
);
msg
=
convertsimple
(
obj
,
&
format
,
&
va
,
FLAG_SIZE_T
,
msgbuf
,
sizeof
(
msgbuf
),
NULL
);
va_end
(
va
);
if
(
msg
)
{
if
(
msg
)
{
int
levels
[
1
];
int
levels
[
1
];
...
@@ -598,6 +595,26 @@ int _PyArg_ParseSingle_SizeT(PyObject* obj, int arg_idx, const char* fname, cons
...
@@ -598,6 +595,26 @@ int _PyArg_ParseSingle_SizeT(PyObject* obj, int arg_idx, const char* fname, cons
return
1
;
return
1
;
}
}
int
PyArg_ParseSingle
(
PyObject
*
obj
,
int
arg_idx
,
const
char
*
fname
,
const
char
*
format
,
...)
{
va_list
va
;
va_start
(
va
,
format
);
int
r
=
vgetsingle
(
obj
,
arg_idx
,
fname
,
format
,
&
va
,
0
);
va_end
(
va
);
return
r
;
}
int
_PyArg_ParseSingle_SizeT
(
PyObject
*
obj
,
int
arg_idx
,
const
char
*
fname
,
const
char
*
format
,
...)
{
va_list
va
;
va_start
(
va
,
format
);
int
r
=
vgetsingle
(
obj
,
arg_idx
,
fname
,
format
,
&
va
,
FLAG_SIZE_T
);
va_end
(
va
);
return
r
;
}
/* Convert a non-tuple argument. Return NULL if conversion went OK,
/* Convert a non-tuple argument. Return NULL if conversion went OK,
or a string with a message describing the failure. The message is
or a string with a message describing the failure. The message is
formatted as "must be <desired type>, not <actual type>".
formatted as "must be <desired type>, not <actual type>".
...
...
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