MCPcopy Create free account
hub / github.com/dgrunwald/rust-cpython / new

Method new

src/objects/num.rs:74–76  ·  view source on GitHub ↗

Creates a new Python 2.7 `int` object. Note: you might want to call `val.to_py_object(py)` instead to avoid truncation if the value does not fit into a `c_long`, and to make your code compatible with Python 3.x.

(py: Python, val: c_long)

Source from the content-addressed store, hash-verified

72 /// to avoid truncation if the value does not fit into a `c_long`,
73 /// and to make your code compatible with Python 3.x.
74 pub fn new(py: Python, val: c_long) -> PyInt {
75 unsafe { err::cast_from_owned_ptr_or_panic(py, ffi::PyInt_FromLong(val)) }
76 }
77
78 /// Gets the value of this integer.
79 ///

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected