How do I return PyInt/PyLong from an i64 using pyo3

I'm currently writing a Python extension in Rust using pyo3. It returns several different types using the "new" method for each type, like "PyBool::new", "PyFloat::new". Interestingly there is no "new" method for "PyInt" or "PyLong". What is the reason for the missing new method? How do I create a PyInt/PyLong from an i64 type?

You can create a PyObject from i64 using IntoPy in pyo3::conversion - Rust .

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.