File tree Expand file tree Collapse file tree 2 files changed +10
-7
lines changed
Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Original file line number Diff line number Diff line change 4141class MmapInputSource : public InputSource {
4242public:
4343 MmapInputSource (
44- py::object stream, const std::string &description, bool close_stream)
45- : InputSource(), stream(stream), close_stream(close_stream)
44+ const py::object & stream, const std::string &description, bool close_stream)
45+ : InputSource(), close_stream(close_stream)
4646 {
4747 py::gil_scoped_acquire acquire;
48- py::int_ fileno = stream.attr (" fileno" )();
48+ this ->stream = stream;
49+
50+ py::int_ fileno = this ->stream .attr (" fileno" )();
4951 int fd = fileno;
5052 auto mmap_module = py::module_::import (" mmap" );
5153 auto mmap_fn = mmap_module.attr (" mmap" );
Original file line number Diff line number Diff line change 2727
2828class PythonStreamInputSource : public InputSource {
2929public:
30- PythonStreamInputSource (py::object stream, std::string name, bool close)
31- : stream(stream), name(name), close(close)
30+ PythonStreamInputSource (const py::object & stream, std::string name, bool close)
31+ : name(name), close(close)
3232 {
3333 py::gil_scoped_acquire gil;
34- if (!stream.attr (" readable" )().cast <bool >())
34+ this ->stream = stream;
35+ if (!this ->stream .attr (" readable" )().cast <bool >())
3536 throw py::value_error (" not readable" );
36- if (!stream.attr (" seekable" )().cast <bool >())
37+ if (!this -> stream .attr (" seekable" )().cast <bool >())
3738 throw py::value_error (" not seekable" );
3839 }
3940 virtual ~PythonStreamInputSource ()
You can’t perform that action at this time.
0 commit comments