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
a771457a
Commit
a771457a
authored
Nov 09, 2015
by
Boxiang Sun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add two attribute to str cls that let test_string could pass
parent
c79439cf
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
0 deletions
+22
-0
from_cpython/Objects/stringobject.c
from_cpython/Objects/stringobject.c
+16
-0
src/runtime/str.cpp
src/runtime/str.cpp
+4
-0
src/runtime/types.cpp
src/runtime/types.cpp
+2
-0
No files found.
from_cpython/Objects/stringobject.c
View file @
a771457a
...
...
@@ -23,6 +23,22 @@ PyObject * _do_string_format(PyObject *self, PyObject *args, PyObject *kwargs) {
return
do_string_format
(
self
,
args
,
kwargs
);
}
void
_string_init
()
{
if
(
PyType_Ready
(
&
PyFieldNameIter_Type
)
<
0
)
Py_FatalError
(
"Can't initialize field name iterator type"
);
if
(
PyType_Ready
(
&
PyFormatterIter_Type
)
<
0
)
Py_FatalError
(
"Can't initialize formatter iter type"
);
}
PyObject
*
_formatter_parser
(
STRINGLIB_OBJECT
*
self
)
{
return
formatter_parser
(
self
);
}
PyObject
*
_formatter_field_name_split
(
STRINGLIB_OBJECT
*
self
)
{
return
formatter_field_name_split
(
self
);
}
PyObject
*
string_count
(
PyStringObject
*
self
,
PyObject
*
sub_obj
,
PyObject
*
obj_start
,
PyObject
**
args
)
...
...
src/runtime/str.cpp
View file @
a771457a
...
...
@@ -45,6 +45,8 @@ extern "C" PyObject* string_rfind(PyStringObject* self, PyObject* args) noexcept
extern
"C"
PyObject
*
string_replace
(
PyStringObject
*
self
,
PyObject
*
args
)
noexcept
;
extern
"C"
PyObject
*
string_splitlines
(
PyStringObject
*
self
,
PyObject
*
args
)
noexcept
;
extern
"C"
PyObject
*
string__format__
(
PyObject
*
self
,
PyObject
*
args
)
noexcept
;
extern
"C"
PyObject
*
_formatter_parser
(
PyStringObject
*
self
)
noexcept
;
extern
"C"
PyObject
*
_formatter_field_name_split
(
PyStringObject
*
self
)
noexcept
;
// from cpython's stringobject.c:
#define LEFTSTRIP 0
...
...
@@ -2784,6 +2786,8 @@ static PyMethodDef string_methods[] = {
{
"splitlines"
,
(
PyCFunction
)
string_splitlines
,
METH_VARARGS
,
NULL
},
{
"zfill"
,
(
PyCFunction
)
string_zfill
,
METH_VARARGS
,
NULL
},
{
"__format__"
,
(
PyCFunction
)
string__format__
,
METH_VARARGS
,
NULL
},
{
"_formatter_parser"
,
(
PyCFunction
)
_formatter_parser
,
METH_NOARGS
,
NULL
},
{
"_formatter_field_name_split"
,
(
PyCFunction
)
_formatter_field_name_split
,
METH_NOARGS
,
NULL
},
};
void
setupStr
()
{
...
...
src/runtime/types.cpp
View file @
a771457a
...
...
@@ -77,6 +77,7 @@ extern "C" void initzlib();
extern
"C"
void
init_codecs
();
extern
"C"
void
init_socket
();
extern
"C"
void
_PyUnicode_Init
();
extern
"C"
void
_string_init
();
extern
"C"
void
initunicodedata
();
extern
"C"
void
init_weakref
();
extern
"C"
void
initcStringIO
();
...
...
@@ -3936,6 +3937,7 @@ void setupRuntime() {
setupClassobj
();
setupSuper
();
_PyUnicode_Init
();
_string_init
();
setupDescr
();
setupTraceback
();
setupCode
();
...
...
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