Skip to content

pymodule, pyattr, pyclass, pygetset, and pymethod attrs generate numerous errors related to rustpython_vm when used #6092

Open

Description

@Bee4Queer

Summary

Using the exact code provided on https://rustpython.github.io/docs/interop/rust_from_python.html generates a lot of errors

Expected

It functions and creates a rustpython module.

Actual

[arthur@fullworld][~/notation]% RUSTFLAGS="-Zmacro-backtrace" cargo clippy                                                                                                   [git][git/.][main]
    Checking notation v1.0.0 (/home/arthur/notation)
error: #[pyclass(...)] doesn't contain 'no_attr' to remove
  --> src/plugins.rs:50:7
   |
50 |     #[pyclass]
   |       ^^^^^^^

error[E0432]: unresolved import `rustpython_vm`
  --> src/plugins.rs:39:1
   |
39 | #[pymodule]
   | ^^^^^^^^^^^
   | |
   | help: a similar path exists: `super::rustpython_vm`
   | in this attribute macro expansion
   |
  ::: /home/arthur/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustpython-derive-0.4.0/src/lib.rs:38:1
   |
38 | pub fn pymodule(attr: TokenStream, item: TokenStream) -> TokenStream {
   | -------------------------------------------------------------------- in this expansion of `#[pymodule]`

error[E0433]: failed to resolve: could not find `rustpython_vm` in the list of imported crates
  --> src/plugins.rs:39:1
   |
39 | #[pymodule]
   | ^^^^^^^^^^^
   | |
   | could not find `rustpython_vm` in the list of imported crates
   | in this attribute macro expansion
   |
  ::: /home/arthur/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustpython-derive-0.4.0/src/lib.rs:38:1
   |
38 | pub fn pymodule(attr: TokenStream, item: TokenStream) -> TokenStream {
   | -------------------------------------------------------------------- in this expansion of `#[pymodule]`

error: cannot find attribute `pyclass` in this scope
  --> src/plugins.rs:55:7
   |
55 |     #[pyclass]
   |       ^^^^^^^
   |
help: consider importing this attribute macro
   |
42 +     use crate::plugins::rustpython_vm::pyclass;
   |

error: cannot find attribute `pygetset` in this scope
  --> src/plugins.rs:57:11
   |
57 |         #[pygetset]
   |           ^^^^^^^^

error: cannot find attribute `pymethod` in this scope
  --> src/plugins.rs:62:11
   |
62 |         #[pymethod]
   |           ^^^^^^^^

error: cannot find attribute `pyattr` in this scope
  --> src/plugins.rs:49:7
   |
49 |     #[pyattr]
   |       ^^^^^^

error: cannot find attribute `pyclass` in this scope
  --> src/plugins.rs:50:7
   |
50 |     #[pyclass]
   |       ^^^^^^^
   |
help: consider importing this attribute macro
   |
42 +     use crate::plugins::rustpython_vm::pyclass;
   |

error[E0433]: failed to resolve: could not find `rustpython_vm` in the list of imported crates
  --> src/plugins.rs:39:1
   |
39 | #[pymodule]
   | ^^^^^^^^^^^
   | |
   | could not find `rustpython_vm` in the list of imported crates
   | in this attribute macro expansion
   |
  ::: /home/arthur/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustpython-derive-0.4.0/src/lib.rs:38:1
   |
38 | pub fn pymodule(attr: TokenStream, item: TokenStream) -> TokenStream {
   | -------------------------------------------------------------------- in this expansion of `#[pymodule]`
   |
help: consider importing this crate through its public re-export
   |
42 +     use crate::plugins::rustpython_vm;
   |

error[E0433]: failed to resolve: could not find `rustpython_vm` in the list of imported crates
  --> src/plugins.rs:39:1
   |
39 | #[pymodule]
   | ^^^^^^^^^^^
   | |
   | could not find `rustpython_vm` in the list of imported crates
   | in this attribute macro expansion
   |
  ::: /home/arthur/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustpython-derive-0.4.0/src/lib.rs:38:1
   |
38 | pub fn pymodule(attr: TokenStream, item: TokenStream) -> TokenStream {
   | -------------------------------------------------------------------- in this expansion of `#[pymodule]`
   |
help: consider importing this module
   |
42 +     use crate::plugins::rustpython_vm::builtins;
   |

error[E0425]: cannot find value `DEF` in this scope
  --> src/plugins.rs:39:1
   |
39 | #[pymodule]
   | ^^^^^^^^^^^
   | |
   | not found in this scope
   | in this attribute macro expansion
   |
  ::: /home/arthur/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustpython-derive-0.4.0/src/lib.rs:38:1
   |
38 | pub fn pymodule(attr: TokenStream, item: TokenStream) -> TokenStream {
   | -------------------------------------------------------------------- in this expansion of `#[pymodule]`

error[E0433]: failed to resolve: could not find `rustpython_vm` in the list of imported crates
  --> src/plugins.rs:39:1
   |
39 | #[pymodule]
   | ^^^^^^^^^^^
   | |
   | could not find `rustpython_vm` in the list of imported crates
   | in this attribute macro expansion
   |
  ::: /home/arthur/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustpython-derive-0.4.0/src/lib.rs:38:1
   |
38 | pub fn pymodule(attr: TokenStream, item: TokenStream) -> TokenStream {
   | -------------------------------------------------------------------- in this expansion of `#[pymodule]`
   |
help: consider importing one of these modules
   |
42 +     use crate::plugins::rustpython_stdlib::builtins;
   |
42 +     use crate::plugins::rustpython_vm::builtins;
   |

error[E0433]: failed to resolve: could not find `rustpython_vm` in the list of imported crates
  --> src/plugins.rs:39:1
   |
39 | #[pymodule]
   | ^^^^^^^^^^^
   | |
   | could not find `rustpython_vm` in the list of imported crates
   | in this attribute macro expansion
   |
  ::: /home/arthur/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustpython-derive-0.4.0/src/lib.rs:38:1
   |
38 | pub fn pymodule(attr: TokenStream, item: TokenStream) -> TokenStream {
   | -------------------------------------------------------------------- in this expansion of `#[pymodule]`
   |
help: consider importing this struct
   |
42 +     use crate::plugins::rustpython_vm::builtins::PyModule;
   |

error[E0433]: failed to resolve: could not find `rustpython_vm` in the list of imported crates
  --> src/plugins.rs:39:1
   |
39 | #[pymodule]
   | ^^^^^^^^^^^
   | |
   | could not find `rustpython_vm` in the list of imported crates
   | in this attribute macro expansion
   |
  ::: /home/arthur/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustpython-derive-0.4.0/src/lib.rs:38:1
   |
38 | pub fn pymodule(attr: TokenStream, item: TokenStream) -> TokenStream {
   | -------------------------------------------------------------------- in this expansion of `#[pymodule]`
   |
help: consider importing this module
   |
42 +     use crate::plugins::rustpython_vm::function;
   |

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `rustpython_vm`
  --> src/plugins.rs:39:1
   |
39 | #[pymodule]
   | ^^^^^^^^^^^
   | |
   | use of unresolved module or unlinked crate `rustpython_vm`
   | in this attribute macro expansion
   |
  ::: /home/arthur/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustpython-derive-0.4.0/src/lib.rs:38:1
   |
38 | pub fn pymodule(attr: TokenStream, item: TokenStream) -> TokenStream {
   | -------------------------------------------------------------------- in this expansion of `#[pymodule]`
   |
help: there is a crate or module with a similar name
   |
39 - #[pymodule]
39 + rustpython
   |
help: consider importing this struct
   |
42 +     use crate::plugins::rustpython_vm::function::PyMethodDef;
   |

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `rustpython_vm`
  --> src/plugins.rs:39:1
   |
39 | #[pymodule]
   | ^^^^^^^^^^^
   | |
   | use of unresolved module or unlinked crate `rustpython_vm`
   | in this attribute macro expansion
   |
  ::: /home/arthur/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustpython-derive-0.4.0/src/lib.rs:38:1
   |
38 | pub fn pymodule(attr: TokenStream, item: TokenStream) -> TokenStream {
   | -------------------------------------------------------------------- in this expansion of `#[pymodule]`
   |
help: there is a crate or module with a similar name
   |
39 - #[pymodule]
39 + rustpython
   |
help: consider importing this struct
   |
42 +     use crate::plugins::rustpython_vm::function::PyMethodFlags;
   |

Some errors have detailed explanations: E0425, E0432, E0433.
For more information about an error, try `rustc --explain E0425`.
error: could not compile `notation` (bin "notation") due to 16 previous errors

Python Documentation

N/A

Activity

  1. youknowone commented on Oct 29, 2025

    @youknowone
    Member

    Thank you for the report. Did you add rustpython-vm to the dependency?

  2. Bee4Queer commented on Oct 29, 2025

    @Bee4Queer
    Author

    I do not remember as it has been more than two months. If say double check the link i provided as i used that exact code.

  3. youknowone commented on Oct 29, 2025

    @youknowone
    Member

    Sure, I will check the code. The environment doesn't come with the code though.

    This error is not likely to be happened when it is added as dependency.

    error[E0432]: unresolved import `rustpython_vm`
    

    And I am sorry for the late response. I had to check it earlier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions