Skip to content

Commit

Permalink
Intern __next__ method name strings. (#674)
Browse files Browse the repository at this point in the history
  • Loading branch information
obi1kenobi authored Sep 18, 2024
1 parent 0a7b29b commit f85f6a6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pytrustfall/src/shim.rs
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ impl Iterator for PythonResolvePropertyIterator {

fn next(&mut self) -> Option<Self::Item> {
Python::with_gil(|py| {
match self.underlying.call_method0(py, "__next__") {
match self.underlying.call_method0(py, pyo3::intern!(py, "__next__")) {
Ok(output) => {
// `output` must be a (context, property_value) tuple here, or else we panic.
let tuple = output.downcast_bound(py).expect(
Expand Down Expand Up @@ -412,7 +412,7 @@ impl Iterator for PythonResolveNeighborsIterator {

fn next(&mut self) -> Option<Self::Item> {
Python::with_gil(|py| {
match self.underlying.call_method0(py, "__next__") {
match self.underlying.call_method0(py, pyo3::intern!(py, "__next__")) {
Ok(output) => {
// `output` must be a (context, neighbor_iterator) tuple here, or else we panic.
let tuple: &Bound<'_, PyTuple> = output.downcast_bound(py).expect(
Expand Down Expand Up @@ -469,7 +469,7 @@ impl Iterator for PythonResolveCoercionIterator {

fn next(&mut self) -> Option<Self::Item> {
Python::with_gil(|py| {
match self.underlying.call_method0(py, "__next__") {
match self.underlying.call_method0(py, pyo3::intern!(py, "__next__")) {
Ok(output) => {
// `output` must be a (context, can_coerce) tuple here, or else we panic.
let tuple = output
Expand Down

0 comments on commit f85f6a6

Please sign in to comment.