Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a9fba1b

Browse filesBrowse files
committed
clear out warnings
1 parent 07aa90c commit a9fba1b
Copy full SHA for a9fba1b

22 files changed

+60
-44
lines changed

‎common/src/linked_list.rs

Copy file name to clipboardExpand all lines: common/src/linked_list.rs
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! This module is modified from tokio::util::linked_list: https://github.com/tokio-rs/tokio/blob/master/tokio/src/util/linked_list.rs
1+
//! This module is modified from tokio::util::linked_list: <https://github.com/tokio-rs/tokio/blob/master/tokio/src/util/linked_list.rs>
22
//! Tokio is licensed under the MIT license:
33
//!
44
//! Copyright (c) 2021 Tokio Contributors

‎src/lib.rs

Copy file name to clipboardExpand all lines: src/lib.rs
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
//! This is the `rustpython` binary. If you're looking to embed RustPython into your application,
2-
//! you're likely looking for the [`rustpython-vm`](https://docs.rs/rustpython-vm) crate.
2+
//! you're likely looking for the [`rustpython_vm`] crate.
33
//!
44
//! You can install `rustpython` with `cargo install rustpython`, or if you'd like to inject your
55
//! own native modules you can make a binary crate that depends on the `rustpython` crate (and
6-
//! probably `rustpython-vm`, too), and make a `main.rs` that looks like:
6+
//! probably [`rustpython_vm`], too), and make a `main.rs` that looks like:
77
//!
88
//! ```no_run
99
//! use rustpython_vm::{pymodule, py_freeze};

‎src/settings.rs

Copy file name to clipboardExpand all lines: src/settings.rs
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@ pub enum RunMode {
1313
}
1414

1515
pub enum InstallPipMode {
16+
/// Install pip using the ensurepip pip module. This has a higher chance of
17+
/// success, but may not install the latest version of pip.
1618
Ensurepip,
19+
/// Install pip using the get-pip.py script, which retrieves the latest pip version.
20+
/// This can be broken due to incompatibilities with cpython.
1721
GetPip,
1822
}
1923

‎src/shell.rs

Copy file name to clipboardExpand all lines: src/shell.rs
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ fn shell_exec(
7171
}
7272
}
7373

74+
75+
/// Enter a repl loop
7476
pub fn run_shell(vm: &VirtualMachine, scope: Scope) -> PyResult<()> {
7577
let mut repl = Readline::new(helper::ShellHelper::new(vm, scope.globals.clone()));
7678
let mut full_input = String::new();

‎stdlib/src/pystruct.rs

Copy file name to clipboardExpand all lines: stdlib/src/pystruct.rs
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
//! Python struct module.
22
//!
3-
//! Docs: https://docs.python.org/3/library/struct.html
3+
//! Docs: <https://docs.python.org/3/library/struct.html>
44
//!
55
//! Use this rust module to do byte packing:
6-
//! https://docs.rs/byteorder/1.2.6/byteorder/
6+
//! <https://docs.rs/byteorder/1.2.6/byteorder/>
77
88
pub(crate) use _struct::make_module;
99

‎vm/src/builtins/mod.rs

Copy file name to clipboardExpand all lines: vm/src/builtins/mod.rs
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! This package contains the python basic/builtin types
2-
//! 7 common PyRef type aliases are exposed - PyBytesRef, PyDictRef, PyIntRef, PyListRef, PyStrRef, PyTypeRef, PyTupleRef
3-
//! Do not add more PyRef type aliases. They will be rare enough to use directly PyRef<T>.
2+
//! 7 common PyRef type aliases are exposed - [`PyBytesRef`], [`PyDictRef`], [`PyIntRef`], [`PyListRef`], [`PyStrRef`], [`PyTypeRef`], [`PyTupleRef`]
3+
//! Do not add more PyRef type aliases. They will be rare enough to use directly `PyRef<T>`.
44
55
pub(crate) mod asyncgenerator;
66
pub use asyncgenerator::PyAsyncGen;

‎vm/src/dictdatatype.rs

Copy file name to clipboardExpand all lines: vm/src/dictdatatype.rs
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Ordered dictionary implementation.
2-
//! Inspired by: https://morepypy.blogspot.com/2015/01/faster-more-memory-efficient-and-more.html
3-
//! And: https://www.youtube.com/watch?v=p33CVV29OG8
4-
//! And: http://code.activestate.com/recipes/578375/
2+
//! Inspired by: <https://morepypy.blogspot.com/2015/01/faster-more-memory-efficient-and-more.html>
3+
//! And: <https://www.youtube.com/watch?v=p33CVV29OG8>
4+
//! And: <http://code.activestate.com/recipes/578375/>
55
66
use crate::{
77
AsObject, Py, PyExact, PyObject, PyObjectRef, PyRefExact, PyResult, VirtualMachine,

‎vm/src/function/builtin.rs

Copy file name to clipboardExpand all lines: vm/src/function/builtin.rs
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ const fn zst_ref_out_of_thin_air<T: 'static>(x: T) -> &'static T {
6565
}
6666
}
6767

68-
/// Get the [`STATIC_FUNC`](IntoPyNativeFn::STATIC_FUNC) of the passed function. The same
68+
/// Get the STATIC_FUNC of the passed function. The same
6969
/// requirements of zero-sizedness apply, see that documentation for details.
7070
///
7171
/// Equivalent to [`IntoPyNativeFn::into_func()`], but usable in a const context. This is only

‎vm/src/import.rs

Copy file name to clipboardExpand all lines: vm/src/import.rs
+2-3Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
/*
2-
* Import mechanics
3-
*/
1+
//! Import mechanics
2+
43
use crate::{
54
AsObject, PyObjectRef, PyPayload, PyRef, PyResult, TryFromObject,
65
builtins::{PyBaseExceptionRef, PyCode, list, traceback::PyTraceback},

‎vm/src/lib.rs

Copy file name to clipboardExpand all lines: vm/src/lib.rs
+4-3Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
//! This crate contains most python logic.
1+
//! This crate contains most of the python logic.
22
//!
3-
//! - Compilation
4-
//! - Bytecode
3+
//! - Interpreter
54
//! - Import mechanics
65
//! - Base objects
6+
//!
7+
//! Some stdlib modules are implemented here, but most of them are in the `rustpython-stdlib` module. The
78
89
// to allow `mod foo {}` in foo.rs; clippy thinks this is a mistake/misunderstanding of
910
// how `mod` works, but we want this sometimes for pymodule declarations

‎vm/src/object/core.rs

Copy file name to clipboardExpand all lines: vm/src/object/core.rs
+8-8Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
//! Essential types for object models
22
//!
3-
//! +-------------------------+--------------+---------------+
4-
//! | Management | Typed | Untyped |
5-
//! +-------------------------+--------------+---------------+
6-
//! | Interpreter-independent | Py<T> | PyObject |
7-
//! | Reference-counted | PyRef<T> | PyObjectRef |
8-
//! | Weak | PyWeakRef<T> | PyRef<PyWeak> |
9-
//! +-------------------------+--------------+---------------+
3+
//! +-------------------------+--------------+-----------------------+
4+
//! | Management | Typed | Untyped |
5+
//! +-------------------------+------------------+-------------------+
6+
//! | Interpreter-independent | [`Py<T>`] | [`PyObject`] |
7+
//! | Reference-counted | [`PyRef<T>`] | [`PyObjectRef`] |
8+
//! | Weak | [`PyWeakRef<T>`] | [`PyRef<PyWeak>`] |
9+
//! +-------------------------+--------------+-----------------------+
1010
//!
11-
//! PyRef<PyWeak> may looking like to be called as PyObjectWeak by the rule,
11+
//! [`PyRef<PyWeak>`] may looking like to be called as PyObjectWeak by the rule,
1212
//! but not to do to remember it is a PyRef object.
1313
use super::{
1414
PyAtomicRef,

‎vm/src/object/traverse.rs

Copy file name to clipboardExpand all lines: vm/src/object/traverse.rs
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@ pub trait MaybeTraverse {
1717
fn try_traverse(&self, traverse_fn: &mut TraverseFn<'_>);
1818
}
1919

20-
/// Type that need traverse it's children should impl `Traverse`(Not `MaybeTraverse`)
20+
/// Type that need traverse it's children should impl [`Traverse`] (not [`MaybeTraverse`])
2121
/// # Safety
22-
/// Please carefully read [`traverse()`] and follow the guideline
22+
/// Please carefully read [`Traverse::traverse()`] and follow the guideline
2323
pub unsafe trait Traverse {
2424
/// impl `traverse()` with caution! Following those guideline so traverse doesn't cause memory error!:
2525
/// - Make sure that every owned object(Every PyObjectRef/PyRef) is called with traverse_fn **at most once**.
2626
/// If some field is not called, the worst results is just memory leak,
2727
/// but if some field is called repeatedly, panic and deadlock can happen.
2828
///
29-
/// - _**DO NOT**_ clone a `PyObjectRef` or `Pyef<T>` in `traverse()`
29+
/// - _**DO NOT**_ clone a [`PyObjectRef`] or [`PyRef<T>`] in [`Traverse::traverse()`]
3030
fn traverse(&self, traverse_fn: &mut TraverseFn<'_>);
3131
}
3232

‎vm/src/prelude.rs

Copy file name to clipboardExpand all lines: vm/src/prelude.rs
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
//! The prelude imports the various objects and traits.
2+
//!
3+
//! The intention is that one can include `use rustpython_vm::prelude::*`.
4+
15
pub use crate::{
26
object::{
37
AsObject, Py, PyExact, PyObject, PyObjectRef, PyPayload, PyRef, PyRefExact, PyResult,

‎vm/src/protocol/buffer.rs

Copy file name to clipboardExpand all lines: vm/src/protocol/buffer.rs
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//! Buffer protocol
2-
//! https://docs.python.org/3/c-api/buffer.html
2+
//! <https://docs.python.org/3/c-api/buffer.html>
33
44
use crate::{
55
Py, PyObject, PyObjectRef, PyPayload, PyRef, PyResult, TryFromBorrowedObject, VirtualMachine,

‎vm/src/protocol/object.rs

Copy file name to clipboardExpand all lines: vm/src/protocol/object.rs
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//! Object Protocol
2-
//! https://docs.python.org/3/c-api/object.html
2+
//! <https://docs.python.org/3/c-api/object.html>
33
44
use crate::{
55
AsObject, Py, PyObject, PyObjectRef, PyResult, TryFromObject, VirtualMachine,

‎vm/src/readline.rs

Copy file name to clipboardExpand all lines: vm/src/readline.rs
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
//! Readline interface for REPLs
2+
//!
3+
//! This module provides a common interface for reading lines from the console, with support for history and completion.
4+
//! It uses the [`rustyline`] crate on non-WASM platforms and a custom implementation on WASM platforms.
5+
16
use std::{io, path::Path};
27

38
type OtherError = Box<dyn std::error::Error>;

‎vm/src/suggestion.rs

Copy file name to clipboardExpand all lines: vm/src/suggestion.rs
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
//! This module provides functionality to suggest similar names for attributes or variables.
2+
//! This is used during tracebacks.
3+
14
use crate::{
25
AsObject, Py, PyObjectRef, VirtualMachine,
36
builtins::{PyStr, PyStrRef},

‎vm/src/version.rs

Copy file name to clipboardExpand all lines: vm/src/version.rs
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
/* Several function to retrieve version information.
2-
*/
1+
//! Several function to retrieve version information.
32
43
use chrono::{Local, prelude::DateTime};
54
use std::time::{Duration, UNIX_EPOCH};

‎vm/src/vm/interpreter.rs

Copy file name to clipboardExpand all lines: vm/src/vm/interpreter.rs
+6-7Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,21 +64,20 @@ impl Interpreter {
6464
///
6565
/// To finalize the vm once all desired `enter`s are called, calling `finalize` will be helpful.
6666
///
67-
/// See also [`run`] for managed way to run the interpreter.
67+
/// See also [`Interpreter::run`] for managed way to run the interpreter.
6868
pub fn enter<F, R>(&self, f: F) -> R
6969
where
7070
F: FnOnce(&VirtualMachine) -> R,
7171
{
7272
thread::enter_vm(&self.vm, || f(&self.vm))
7373
}
7474

75-
/// Run [`enter`] and call `expect_pyresult` for the result.
75+
/// Run [`Interpreter::enter`] and call [`VirtualMachine::expect_pyresult`] for the result.
7676
///
7777
/// This function is useful when you want to expect a result from the function,
7878
/// but also print useful panic information when exception raised.
7979
///
80-
/// See [`enter`] for more information.
81-
/// See [`expect_pyresult`] for more information.
80+
/// See also [`Interpreter::enter`] and [`VirtualMachine::expect_pyresult`] for more information.
8281
pub fn enter_and_expect<F, R>(&self, f: F, msg: &str) -> R
8382
where
8483
F: FnOnce(&VirtualMachine) -> PyResult<R>,
@@ -92,11 +91,11 @@ impl Interpreter {
9291
/// Run a function with the main virtual machine and return exit code.
9392
///
9493
/// To enter vm context only once and safely terminate the vm, this function is preferred.
95-
/// Unlike [`enter`], `run` calls finalize and returns exit code.
94+
/// Unlike [`Interpreter::enter`], `run` calls finalize and returns exit code.
9695
/// You will not be able to obtain Python exception in this way.
9796
///
98-
/// See [`finalize`] for the finalization steps.
99-
/// See also [`enter`] for pure function call to obtain Python exception.
97+
/// See [`Interpreter::finalize`] for the finalization steps.
98+
/// See also [`Interpreter::enter`] for pure function call to obtain Python exception.
10099
pub fn run<F>(self, f: F) -> u8
101100
where
102101
F: FnOnce(&VirtualMachine) -> PyResult<()>,

‎vm/src/vm/mod.rs

Copy file name to clipboardExpand all lines: vm/src/vm/mod.rs
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ pub const MAX_MEMORY_SIZE: usize = isize::MAX as usize;
6161
/// Top level container of a python virtual machine. In theory you could
6262
/// create more instances of this struct and have them operate fully isolated.
6363
///
64-
/// To construct this, please refer to the [`Interpreter`](Interpreter)
64+
/// To construct this, please refer to the [`Interpreter`]
6565
pub struct VirtualMachine {
6666
pub builtins: PyRef<PyModule>,
6767
pub sys_module: PyRef<PyModule>,
@@ -564,7 +564,7 @@ impl VirtualMachine {
564564
/// Call Python __import__ function without from_list.
565565
/// Roughly equivalent to `import module_name` or `import top.submodule`.
566566
///
567-
/// See also [`import_from`] for more advanced import.
567+
/// See also [`VirtualMachine::import_from`] for more advanced import.
568568
/// See also [`rustpython_vm::import::import_source`] and other primitive import functions.
569569
#[inline]
570570
pub fn import<'a>(&self, module_name: impl AsPyStr<'a>, level: usize) -> PyResult {

‎vm/src/vm/vm_ops.rs

Copy file name to clipboardExpand all lines: vm/src/vm/vm_ops.rs
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,9 @@ impl VirtualMachine {
152152
/// Calling scheme used for binary operations:
153153
///
154154
/// Order operations are tried until either a valid result or error:
155-
/// b.rop(b,a)[*], a.op(a,b), b.rop(b,a)
155+
/// `b.rop(b,a)[*], a.op(a,b), b.rop(b,a)`
156156
///
157-
/// [*] only when Py_TYPE(a) != Py_TYPE(b) && Py_TYPE(b) is a subclass of Py_TYPE(a)
157+
/// `[*]` - only when Py_TYPE(a) != Py_TYPE(b) && Py_TYPE(b) is a subclass of Py_TYPE(a)
158158
pub fn binary_op1(&self, a: &PyObject, b: &PyObject, op_slot: PyNumberBinaryOp) -> PyResult {
159159
let class_a = a.class();
160160
let class_b = b.class();

‎wtf8/src/lib.rs

Copy file name to clipboardExpand all lines: wtf8/src/lib.rs
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
//!
2020
//! We use WTF-8 over something more similar to CPython's string implementation
2121
//! because of its compatibility with UTF-8, meaning that in the case where a
22-
//! string has no surrogates, it can be viewed as a UTF-8 Rust [`str`] without
22+
//! string has no surrogates, it can be viewed as a UTF-8 Rust [`prim@str`] without
2323
//! needing any copies or re-encoding.
2424
//!
2525
//! This implementation is mostly copied from the WTF-8 implentation in the

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.