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
09160163
Commit
09160163
authored
Nov 02, 2016
by
Boxiang Sun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
In order to get the content of sequence datatye easier, add some Repr APIs
parent
2c9e575d
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
37 additions
and
19 deletions
+37
-19
src/codegen/irgen/hooks.cpp
src/codegen/irgen/hooks.cpp
+17
-17
src/runtime/dict.cpp
src/runtime/dict.cpp
+5
-0
src/runtime/dict.h
src/runtime/dict.h
+1
-1
src/runtime/list.cpp
src/runtime/list.cpp
+5
-0
src/runtime/list.h
src/runtime/list.h
+1
-0
src/runtime/tuple.cpp
src/runtime/tuple.cpp
+6
-0
src/runtime/tuple.h
src/runtime/tuple.h
+1
-0
test/integration/zope_test.py
test/integration/zope_test.py
+1
-1
No files found.
src/codegen/irgen/hooks.cpp
View file @
09160163
...
...
@@ -384,23 +384,23 @@ static void pickGlobalsAndLocals(Box*& globals, Box*& locals) {
RELEASE_ASSERT
(
globals
&&
(
globals
->
cls
==
module_cls
||
globals
->
cls
==
dict_cls
),
"Unspported globals type: %s"
,
globals
?
globals
->
cls
->
tp_name
:
"NULL"
);
if
(
globals
)
{
// From CPython (they set it to be f->f_builtins):
Box
*
globals_dict
;
if
(
globals
->
cls
==
module_cls
)
globals_dict
=
globals
->
getAttrWrapper
();
else
globals_dict
=
globals
;
auto
requested_builtins
=
PyDict_GetItemString
(
globals_dict
,
"__builtins__"
);
if
(
requested_builtins
==
NULL
)
PyDict_SetItemString
(
globals_dict
,
"__builtins__"
,
PyEval_GetBuiltins
());
else
RELEASE_ASSERT
(
requested_builtins
==
builtins_module
||
requested_builtins
==
builtins_module
->
getAttrWrapper
(),
"we don't support overriding __builtins__"
);
}
//
//
if (globals) {
//
// From CPython (they set it to be f->f_builtins):
//
Box* globals_dict;
//
if (globals->cls == module_cls)
//
globals_dict = globals->getAttrWrapper();
//
else
//
globals_dict = globals;
//
//
auto requested_builtins = PyDict_GetItemString(globals_dict, "__builtins__");
//
if (requested_builtins == NULL)
//
PyDict_SetItemString(globals_dict, "__builtins__", PyEval_GetBuiltins());
//
else
//
RELEASE_ASSERT(requested_builtins == builtins_module
//
|| requested_builtins == builtins_module->getAttrWrapper(),
//
"we don't support overriding __builtins__");
//
}
}
extern
"C"
PyObject
*
PyEval_EvalCode
(
PyCodeObject
*
co
,
PyObject
*
globals
,
PyObject
*
locals
)
noexcept
{
...
...
src/runtime/dict.cpp
View file @
09160163
...
...
@@ -118,6 +118,11 @@ Box* dictRepr(BoxedDict* self) {
return
boxString
(
llvm
::
StringRef
(
&
chars
[
0
],
chars
.
size
()));
}
extern
"C"
void
PyDict_Repr
(
BoxedDict
*
self
)
{
BoxedString
*
result
=
(
BoxedString
*
)
dictRepr
(
self
);
fprintf
(
stderr
,
std
::
string
(
result
->
s
()).
c_str
());
}
Box
*
dictCopy
(
BoxedDict
*
self
)
{
if
(
!
PyDict_Check
(
self
))
raiseExcHelper
(
TypeError
,
"descriptor 'copy' requires a 'dict' object but received a '%s'"
,
getTypeName
(
self
));
...
...
src/runtime/dict.h
View file @
09160163
...
...
@@ -51,7 +51,7 @@ Box* dictIterHasnext(Box* self);
llvm_compat_bool
dictIterHasnextUnboxed
(
Box
*
self
);
Box
*
dictiter_next
(
Box
*
self
)
noexcept
;
Box
*
dictIterNext
(
Box
*
self
);
void
_PyDict_Repr
(
Box
*
self
);
void
dictMerge
(
BoxedDict
*
self
,
Box
*
other
);
Box
*
dictUpdate
(
BoxedDict
*
self
,
BoxedTuple
*
args
,
BoxedDict
*
kwargs
);
...
...
src/runtime/list.cpp
View file @
09160163
...
...
@@ -104,6 +104,11 @@ extern "C" Box* listRepr(Box* _self) {
return
boxString
(
llvm
::
StringRef
(
&
chars
[
0
],
chars
.
size
()));
}
extern
"C"
void
PyList_Repr
(
Box
*
self
)
{
BoxedString
*
result
=
(
BoxedString
*
)
listRepr
(
self
);
fprintf
(
stderr
,
std
::
string
(
result
->
s
()).
c_str
());
}
Box
*
list_repr
(
Box
*
self
)
noexcept
{
return
callCXXFromStyle
<
CAPI
>
(
listRepr
,
self
);
}
...
...
src/runtime/list.h
View file @
09160163
...
...
@@ -51,6 +51,7 @@ Box* listreviterHasnext(Box* self);
llvm_compat_bool
listreviterHasnextUnboxed
(
Box
*
self
);
Box
*
listreviterNext
(
Box
*
self
);
Box
*
listreviter_next
(
Box
*
s
)
noexcept
;
extern
"C"
void
PyList_Repr
(
Box
*
self
);
extern
"C"
Box
*
listAppend
(
Box
*
self
,
Box
*
v
);
}
...
...
src/runtime/tuple.cpp
View file @
09160163
...
...
@@ -309,6 +309,12 @@ Box* tupleRepr(Box* _t) {
return
boxString
(
llvm
::
StringRef
(
&
chars
[
0
],
chars
.
size
()));
}
extern
"C"
void
PyTuple_Repr
(
Box
*
self
)
{
BoxedString
*
result
=
(
BoxedString
*
)
tupleRepr
(
self
);
fprintf
(
stderr
,
std
::
string
(
result
->
s
()).
c_str
());
}
static
Box
*
tuple_repr
(
Box
*
v
)
noexcept
{
return
callCXXFromStyle
<
CAPI
>
(
tupleRepr
,
v
);
}
...
...
src/runtime/tuple.h
View file @
09160163
...
...
@@ -47,6 +47,7 @@ Box* tupleiterHasnext(Box* self);
llvm_compat_bool
tupleiterHasnextUnboxed
(
Box
*
self
);
Box
*
tupleiter_next
(
Box
*
self
)
noexcept
;
Box
*
tupleiterNext
(
Box
*
self
);
extern
"C"
void
PyTuple_Repr
(
Box
*
self
);
}
#endif
test/integration/zope_test.py
View file @
09160163
...
...
@@ -71,7 +71,7 @@ modified_list = [
(
"zope.container-3.11.2"
,
"https://lab.nexedi.com/Daetalus/zope.container-3.11.2/repository/archive.zip?ref=pyston_patch"
),
(
"zope.proxy-3.6.1"
,
"https://lab.nexedi.com/Daetalus/zope.proxy-3.6.1/repository/archive.zip?ref=pyston_patch"
),
(
"zope.security-3.7.4"
,
"https://lab.nexedi.com/Daetalus/zope.security-3.7.4/repository/archive.zip?ref=pyston_patch"
),
(
"DocumentTemplate-2.13.2"
,
"https://lab.nexedi.com/Daetalus/DocumentTemplate-2.13.2/repository/archive.zip?ref=pyston_
implementation
"
),
(
"DocumentTemplate-2.13.2"
,
"https://lab.nexedi.com/Daetalus/DocumentTemplate-2.13.2/repository/archive.zip?ref=pyston_
patch
"
),
(
"RestrictedPython-3.6.0"
,
"https://lab.nexedi.com/Daetalus/RestrictedPython-3.6.0/repository/archive.zip?ref=pyston_patch"
),
(
"ZODB3-3.10.5"
,
"https://lab.nexedi.com/Daetalus/ZODB3-3.10.5/repository/archive.zip?ref=pyston_patch"
),
(
"Zope2-2.13.24"
,
"https://lab.nexedi.com/Daetalus/Zope2-2.13.24/repository/archive.zip?ref=python_implementation"
),]
...
...
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