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
27c38df6
Commit
27c38df6
authored
Apr 10, 2015
by
Chris Toshok
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #435 from toshok/sys-platform
support 'linux2', 'darwin', and 'unknown' for sys.platform
parents
e8f0d966
db061cfe
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
1 deletion
+15
-1
src/runtime/builtin_modules/sys.cpp
src/runtime/builtin_modules/sys.cpp
+15
-1
No files found.
src/runtime/builtin_modules/sys.cpp
View file @
27c38df6
...
@@ -231,6 +231,20 @@ static bool isLittleEndian() {
...
@@ -231,6 +231,20 @@ static bool isLittleEndian() {
return
s
[
0
]
!=
0
;
return
s
[
0
]
!=
0
;
}
}
extern
"C"
const
char
*
Py_GetPlatform
()
noexcept
{
// cpython does this check in their configure script
#if defined(__linux__)
return
"linux2"
;
#elif defined(__APPLE__) && defined(__MACH__)
return
"darwin"
;
#else
// cpython also supports returning "atheos", "irix6", "win32", or
// whatever the user can get PLATFORM to be #defined as at
// build-time.
return
"unknown"
;
#endif
}
void
setupSys
()
{
void
setupSys
()
{
sys_modules_dict
=
new
BoxedDict
();
sys_modules_dict
=
new
BoxedDict
();
gc
::
registerPermanentRoot
(
sys_modules_dict
);
gc
::
registerPermanentRoot
(
sys_modules_dict
);
...
@@ -260,7 +274,7 @@ void setupSys() {
...
@@ -260,7 +274,7 @@ void setupSys() {
sys_module
->
giveAttr
(
"py3kwarning"
,
False
);
sys_module
->
giveAttr
(
"py3kwarning"
,
False
);
sys_module
->
giveAttr
(
"byteorder"
,
boxStrConstant
(
isLittleEndian
()
?
"little"
:
"big"
));
sys_module
->
giveAttr
(
"byteorder"
,
boxStrConstant
(
isLittleEndian
()
?
"little"
:
"big"
));
sys_module
->
giveAttr
(
"platform"
,
boxStrConstant
(
"unknown"
));
// seems like a reasonable, if poor, default
sys_module
->
giveAttr
(
"platform"
,
boxStrConstant
(
Py_GetPlatform
()));
llvm
::
SmallString
<
128
>
main_fn
;
llvm
::
SmallString
<
128
>
main_fn
;
// TODO supposed to pass argv0, main_addr to this function:
// TODO supposed to pass argv0, main_addr to this function:
...
...
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