Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
grumpy
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
grumpy
Commits
2c7a26ac
Commit
2c7a26ac
authored
Jan 07, 2017
by
feilengcui008
Committed by
Dylan Trotter
Jan 06, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix #30 and add #19 sys.stdin, sys.stdout, sys.stderr (#32)
parent
4033cdd9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
3 deletions
+9
-3
lib/sys.py
lib/sys.py
+6
-2
runtime/file.go
runtime/file.go
+3
-1
No files found.
lib/sys.py
View file @
2c7a26ac
...
@@ -14,8 +14,8 @@
...
@@ -14,8 +14,8 @@
"""System-specific parameters and functions."""
"""System-specific parameters and functions."""
from
__go__.os
import
Args
from
__go__.os
import
Args
,
Stdin
,
Stdout
,
Stderr
from
__go__.grumpy
import
SysModules
,
MaxInt
# pylint: disable=g-multiple-import
from
__go__.grumpy
import
SysModules
,
MaxInt
,
NewFileFromFD
# pylint: disable=g-multiple-import
from
__go__.runtime
import
Version
from
__go__.runtime
import
Version
argv
=
[]
argv
=
[]
...
@@ -28,6 +28,10 @@ modules = SysModules
...
@@ -28,6 +28,10 @@ modules = SysModules
py3kwarning
=
False
py3kwarning
=
False
warnoptions
=
[]
warnoptions
=
[]
stdin
=
NewFileFromFD
(
Stdin
.
Fd
())
stdout
=
NewFileFromFD
(
Stdout
.
Fd
())
stderr
=
NewFileFromFD
(
Stderr
.
Fd
())
class
_Flags
(
object
):
class
_Flags
(
object
):
"""Container class for sys.flags."""
"""Container class for sys.flags."""
...
...
runtime/file.go
View file @
2c7a26ac
...
@@ -44,7 +44,9 @@ type File struct {
...
@@ -44,7 +44,9 @@ type File struct {
// NewFileFromFD creates a file object from the given file descriptor fd.
// NewFileFromFD creates a file object from the given file descriptor fd.
func
NewFileFromFD
(
fd
uintptr
)
*
File
{
func
NewFileFromFD
(
fd
uintptr
)
*
File
{
// TODO: Use fcntl or something to get the mode of the descriptor.
// TODO: Use fcntl or something to get the mode of the descriptor.
return
&
File
{
Object
:
Object
{
typ
:
FileType
},
mode
:
"?"
,
open
:
true
,
file
:
os
.
NewFile
(
fd
,
"<fdopen>"
)}
file
:=
&
File
{
Object
:
Object
{
typ
:
FileType
},
mode
:
"?"
,
open
:
true
,
file
:
os
.
NewFile
(
fd
,
"<fdopen>"
)}
file
.
reader
=
bufio
.
NewReader
(
file
.
file
)
return
file
}
}
func
toFileUnsafe
(
o
*
Object
)
*
File
{
func
toFileUnsafe
(
o
*
Object
)
*
File
{
...
...
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