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
18741a0c
Commit
18741a0c
authored
Dec 19, 2014
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes to get self-hosting working
parent
13800032
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
50 additions
and
1 deletion
+50
-1
lib_pyston/_sysconfigdata.py
lib_pyston/_sysconfigdata.py
+11
-1
lib_python/2.7/distutils/sysconfig.py
lib_python/2.7/distutils/sysconfig.py
+7
-0
src/runtime/builtin_modules/builtins.cpp
src/runtime/builtin_modules/builtins.cpp
+15
-0
src/runtime/types.cpp
src/runtime/types.cpp
+14
-0
test/tests/builtins.py
test/tests/builtins.py
+3
-0
No files found.
lib_pyston/_sysconfigdata.py
View file @
18741a0c
# TODO: we will have to figure out a better way of generating this file
build_time_vars
=
{}
build_time_vars
=
{
"CC"
:
"gcc -pthread"
,
"CXX"
:
"g++ -pthread"
,
"OPT"
:
"-DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes"
,
"CFLAGS"
:
"-fno-strict-aliasing -g -O3 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes"
,
"CCSHARED"
:
"-fPIC"
,
"LDSHARED"
:
"gcc -pthread -shared"
,
"SO"
:
".pyston.so"
,
"AR"
:
"ar"
,
"ARFLAGS"
:
"rc"
,
}
lib_python/2.7/distutils/sysconfig.py
View file @
18741a0c
# This file is originally from CPython 2.7, with modifications for Pyston
# We should probably create a pyston-specific version instead of modifying the
# CPython one.
"""Provide access to Python's configuration information. The specific
configuration variables available depend heavily on the platform and
configuration. The values may be retrieved using
...
...
@@ -64,6 +68,9 @@ def get_python_version():
def
get_python_inc
(
plat_specific
=
0
,
prefix
=
None
):
# Pyston change: this is the way we layout things internally:
return
os
.
path
.
join
(
os
.
path
.
dirname
(
sys
.
executable
),
"include"
)
"""Return the directory containing installed Python header files.
If 'plat_specific' is false (the default), this is the path to the
...
...
src/runtime/builtin_modules/builtins.cpp
View file @
18741a0c
...
...
@@ -852,6 +852,20 @@ public:
return
rtnval
;
}
static
void
gcHandler
(
GCVisitor
*
v
,
Box
*
_b
)
{
assert
(
isSubclass
(
_b
->
cls
,
EnvironmentError
));
boxGCHandler
(
v
,
_b
);
BoxedEnvironmentError
*
ee
=
static_cast
<
BoxedEnvironmentError
*>
(
_b
);
if
(
ee
->
myerrno
)
v
->
visit
(
ee
->
myerrno
);
if
(
ee
->
strerror
)
v
->
visit
(
ee
->
strerror
);
if
(
ee
->
filename
)
v
->
visit
(
ee
->
filename
);
}
};
void
setupBuiltins
()
{
...
...
@@ -909,6 +923,7 @@ void setupBuiltins() {
NotImplementedError
=
makeBuiltinException
(
RuntimeError
,
"NotImplementedError"
);
PendingDeprecationWarning
=
makeBuiltinException
(
Warning
,
"PendingDeprecationWarning"
);
EnvironmentError
->
gc_visit
=
BoxedEnvironmentError
::
gcHandler
;
EnvironmentError
->
giveAttr
(
"__init__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
BoxedEnvironmentError
::
__init__
,
NONE
,
4
,
1
,
false
,
false
),
{
NULL
}));
...
...
src/runtime/types.cpp
View file @
18741a0c
...
...
@@ -686,6 +686,18 @@ public:
return
None
;
}
static
Box
*
get
(
Box
*
_self
,
Box
*
_key
,
Box
*
def
)
{
RELEASE_ASSERT
(
_self
->
cls
==
attrwrapper_cls
,
""
);
AttrWrapper
*
self
=
static_cast
<
AttrWrapper
*>
(
_self
);
RELEASE_ASSERT
(
_key
->
cls
==
str_cls
,
""
);
BoxedString
*
key
=
static_cast
<
BoxedString
*>
(
_key
);
Box
*
r
=
self
->
b
->
getattr
(
key
->
s
);
if
(
!
r
)
return
def
;
return
r
;
}
static
Box
*
getitem
(
Box
*
_self
,
Box
*
_key
)
{
RELEASE_ASSERT
(
_self
->
cls
==
attrwrapper_cls
,
""
);
AttrWrapper
*
self
=
static_cast
<
AttrWrapper
*>
(
_self
);
...
...
@@ -951,6 +963,8 @@ void setupRuntime() {
attrwrapper_cls
->
giveAttr
(
"__name__"
,
boxStrConstant
(
"attrwrapper"
));
attrwrapper_cls
->
giveAttr
(
"__setitem__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
AttrWrapper
::
setitem
,
UNKNOWN
,
3
)));
attrwrapper_cls
->
giveAttr
(
"__getitem__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
AttrWrapper
::
getitem
,
UNKNOWN
,
2
)));
attrwrapper_cls
->
giveAttr
(
"get"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
AttrWrapper
::
get
,
UNKNOWN
,
3
,
1
,
false
,
false
),
{
None
}));
attrwrapper_cls
->
giveAttr
(
"__str__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
AttrWrapper
::
str
,
UNKNOWN
,
1
)));
attrwrapper_cls
->
giveAttr
(
"__contains__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
AttrWrapper
::
contains
,
UNKNOWN
,
2
)));
...
...
test/tests/builtins.py
View file @
18741a0c
...
...
@@ -55,3 +55,6 @@ class C(object):
def
__init__
(
self
):
self
.
a
=
1
print
vars
(
C
()).
items
()
print
globals
().
get
(
"not a real variable"
)
print
globals
().
get
(
"not a real variable"
,
1
)
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