Skip to content

Commit

Permalink
remove old comments
Browse files Browse the repository at this point in the history
  • Loading branch information
goulart-paul committed Mar 3, 2024
1 parent 7a8f468 commit 0d5e21d
Showing 1 changed file with 0 additions and 117 deletions.
117 changes: 0 additions & 117 deletions src/stdio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,120 +129,3 @@ impl Write for PyStderr {
self.0.flush()
}
}

// macro_rules! make_python_stdio {
// ($rawtypename:ident, $typename:ident, $pyfunc:ident, $stdio:ident) => {
// struct $rawtypename {
// cbuffer: Vec<u8>,
// }
// impl $rawtypename {
// fn new() -> Self {
// Self {
// cbuffer: Vec::new(),
// }
// }
// }
// impl Write for $rawtypename {
// fn write(&mut self, buf: &[u8]) -> std::io::Result<usize> {
// //clear internal buffer and then overwrite with the
// //new buffer and a null terminator
// self.cbuffer.clear();
// self.cbuffer.extend_from_slice(buf);
// self.cbuffer.push(0);
// Python::with_gil(|_py| unsafe {
// PySys_WriteStdout(b"%.*s\n\0".as_ptr().cast(), buf.len() as c_int, buf.as_ptr() as *const c_char);
// PySys_FormatStdout(b"%.*d\n\0".as_ptr().cast(), 10,256137);
// });
// Ok(buf.len())
// }
// fn flush(&mut self) -> std::io::Result<()> {
// // call the python flush() on sys.$pymodname
// Python::with_gil(|py| -> std::io::Result<()> {
// py.run_bound(
// std::concat!("import sys; sys.", stringify!($stdio), ".flush()"),
// None,
// None,
// )
// .map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e))?;
// Ok(())
// })
// }
// }

// #[doc=std::concat!("A handle to Python's `sys.", stringify!($stdio),"` stream.")]
// pub struct $typename {
// inner: LineWriter<$rawtypename>,
// }

// impl $typename {
// fn new() -> Self {
// Self {
// inner: LineWriter::new($rawtypename::new()),
// }
// }
// }

// impl Write for $typename {
// fn write(&mut self, buf: &[u8]) -> std::io::Result<usize> {
// self.inner.write(buf)
// }
// fn flush(&mut self) -> std::io::Result<()> {
// self.inner.flush()
// }
// }

// #[doc=std::concat!("Construct a new handle to Python's `sys.", stringify!($stdio),"` stream.")]
// pub fn $stdio() -> $typename {
// $typename::new()
// }

// };

// }
// make_python_stdio!(PyStdoutRaw, PyStdout, PySys_WriteStdout, stdout);
// make_python_stdio!(PyStderrRaw, PyStderr, PySys_WriteStderr, stderr);

// /// A handle to Python's `sys.stdout` stream.
// pub struct PyStdout {}
// /// A handle to Python's `sys.stderr` stream.
// pub struct PyStderr {}

// /// Construct a new handle to Python's `sys.stdout` stream.
// pub fn stdout() -> PyStdout {
// PyStdout{}
// }
// /// Construct a new handle to Python's `sys.stderr` stream.
// pub fn stderr() -> PyStderr {
// PyStderr{}
// }

// macro_rules! make_python_stdio {
// ($typename:ident, $printfcn:ident) => {

// impl Write for $typename {
// fn write(&mut self, buf: &[u8]) -> std::io::Result<usize> {
// //clear internal buffer and then overwrite with the
// //new buffer and a null terminator
// Python::with_gil(|_py| unsafe {
// PySys_WriteStdout(b"%.*s\0".as_ptr().cast(), buf.len() as c_int, buf.as_ptr() as *const c_char);
// });
// Ok(buf.len())
// }
// fn flush(&mut self) -> std::io::Result<()> {
// // call the python flush() on sys.$pymodname
// Python::with_gil(|py| -> std::io::Result<()> {
// py.run_bound(
// "import sys; sys.stdout.flush()",
// None,
// None,
// )
// .map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e))?;
// Ok(())
// })
// }
// }

// };
// }
// make_python_stdio!(PyStdout, PySys_FormatStdout);
// make_python_stdio!(PyStderr, PySys_WriteStderr);

0 comments on commit 0d5e21d

Please sign in to comment.