Skip to content

Commit 170d937

Browse files
committed
rust-ext: consistently and properly define hint argument to readline()
The `#[args()]` annotation used the wrong argument name. And in one case this argument was not accepted. Found this as part of attempting to to upgrade PyO3 to 0.18, which complained at run-time about `hint` being a required argument.
1 parent c1fa597 commit 170d937

File tree

4 files changed

+6
-4
lines changed

4 files changed

+6
-4
lines changed

rust-ext/src/compression_reader.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,9 @@ impl ZstdCompressionReader {
157157
Err(PyErr::from_instance(exc))
158158
}
159159

160-
fn readlines(&self, py: Python) -> PyResult<()> {
160+
#[args(hint = "None")]
161+
#[allow(unused_variables)]
162+
fn readlines(&self, py: Python, hint: Option<&PyAny>) -> PyResult<()> {
161163
let io = py.import("io")?;
162164
let exc = io.getattr("UnsupportedOperation")?;
163165

rust-ext/src/compression_writer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ impl ZstdCompressionWriter {
145145
Err(PyErr::from_instance(exc))
146146
}
147147

148-
#[args(size = "None")]
148+
#[args(hint = "None")]
149149
#[allow(unused_variables)]
150150
fn readlines(&self, py: Python, hint: Option<&PyAny>) -> PyResult<()> {
151151
let io = py.import("io")?;

rust-ext/src/decompression_reader.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ impl ZstdDecompressionReader {
137137
Err(PyErr::from_instance(exc))
138138
}
139139

140-
#[args(size = "None")]
140+
#[args(hint = "None")]
141141
#[allow(unused_variables)]
142142
fn readlines(&self, py: Python, hint: Option<&PyAny>) -> PyResult<()> {
143143
let io = py.import("io")?;

rust-ext/src/decompression_writer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ impl ZstdDecompressionWriter {
150150
Err(PyErr::from_instance(exc))
151151
}
152152

153-
#[args(size = "None")]
153+
#[args(hint = "None")]
154154
#[allow(unused_variables)]
155155
fn readlines(&self, py: Python, hint: Option<&PyAny>) -> PyResult<()> {
156156
let io = py.import("io")?;

0 commit comments

Comments
 (0)