Skip to content

Support for Python 3.13? #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
RMPR opened this issue Nov 29, 2024 · 1 comment · Fixed by #25
Closed

Support for Python 3.13? #23

RMPR opened this issue Nov 29, 2024 · 1 comment · Fixed by #25

Comments

@RMPR
Copy link

RMPR commented Nov 29, 2024

pyo3 supports 3.13

I tried giving this a shot:

M Cargo.toml
@@ -22,7 +22,7 @@ name = "starlark"
 starlark = "^0.10.0"
 starlark_derive = "^0.10.0"
 anyhow = "^1.0.65"
-pyo3 = { version = "0.21.2", features = ["extension-module"] }
+pyo3 = { version = "0.22", features = ["extension-module"] }
 
 # needed to resolve contradictory constraints in dependencies
 syn = "^1.0.96"
M src/lib.rs
@@ -680,7 +680,7 @@ impl Module {
         self.0.set(name, b);
     }
 
-    fn freeze(mod_cell: &PyCell<Module>) -> PyResult<FrozenModule> {
+    fn freeze(mod_cell: &Bound<Module>) -> PyResult<FrozenModule> {
         let module = mod_cell
             .replace(Module(starlark::environment::Module::new()))
             .0;
@@ -752,7 +752,7 @@ fn empty_ast() -> AstModule {
 )]
 fn eval(
     module: &mut Module,
-    ast: &PyCell<AstModule>,
+    ast: &Bound<AstModule>,
     globals: &Globals,
     file_loader: Option<&Bound<FileLoader>>,
 ) -> PyResult<PyObject> {

But it's not a drop-in replacement:

error[E0599]: no method named `replace` found for reference `&pyo3::Bound<'_, Module>` in the current scope
   --> src/lib.rs:685:14
    |
684 |           let module = mod_cell
    |  ______________________-
685 | |             .replace(Module(starlark::environment::Module::new()))
    | |             -^^^^^^^ method not found in `&Bound<'_, Module>`
    | |_____________|
    |

error[E0599]: no method named `replace` found for reference `&pyo3::Bound<'_, AstModule>` in the current scope
   --> src/lib.rs:763:39
    |
763 |             evaluator.eval_module(ast.replace(empty_ast()).0, &globals.0),
    |                                       ^^^^^^^ method not found in `&Bound<'_, AstModule>`
@inducer
Copy link
Owner

inducer commented Nov 30, 2024

I tried this, too, and I got stuck in the same places you did. 🙂 I'll spend the time at some point to get this to go. In the meantime, any help would be more than welcome.

inducer added a commit that referenced this issue Dec 4, 2024
inducer added a commit that referenced this issue Dec 4, 2024
inducer added a commit that referenced this issue Dec 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants