@@ -124,15 +124,10 @@ If it is another kind of object, it will be printed and the system
124
124
exit status will be one (i.e., failure).`
125
125
126
126
func sys_exit (self py.Object , args py.Tuple ) py.Object {
127
- panic ("Not implemented" )
128
- return py .None
129
- // py.Object exit_code = 0;
130
- // if (!PyArg_UnpackTuple(args, "exit", 0, 1, &exit_code)) {
131
- // return nil;
132
- // }
133
- // /* Raise SystemExit so callers may catch it or clean up. */
134
- // PyErr_SetObject(PyExc_SystemExit, exit_code);
135
- // return nil;
127
+ var exit_code py.Object
128
+ py .UnpackTuple (args , nil , "exit" , 0 , 1 , & exit_code )
129
+ // Raise SystemExit so callers may catch it or clean up.
130
+ panic (py .ExceptionNew (py .SystemExit , args , nil ))
136
131
}
137
132
138
133
const getdefaultencoding_doc = `getdefaultencoding() -> string
@@ -676,8 +671,15 @@ func init() {
676
671
for i , v := range pyargs {
677
672
argv .Items [i ] = py .String (v )
678
673
}
674
+ stdin , stdout , stderr := (* py .File )(os .Stdin ), (* py .File )(os .Stdout ), (* py .File )(os .Stderr )
679
675
globals := py.StringDict {
680
- "argv" : argv ,
676
+ "argv" : argv ,
677
+ "stdin" : stdin ,
678
+ "stdout" : stdout ,
679
+ "stderr" : stderr ,
680
+ "__stdin__" : stdin ,
681
+ "__stdout__" : stdout ,
682
+ "__stderr__" : stderr ,
681
683
//"version": py.Int(MARSHAL_VERSION),
682
684
// /* stdin/stdout/stderr are now set by pythonrun.c */
683
685
0 commit comments