Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Noa
    @coolreader18
    could just be being pedantic - one of those "oh this is actually invalid under stacked borrows" things where you just need to shuffle some accesses around, but idk where that would be needed in the code since the deallocation is fairly straightforward
    carbotaniuman
    @carbotaniuman

    I'm pretty sure WeakRefList needs to be a side-table ala ObjC, or else it can be deallocated while the destructor is still running, but after you've grabbed the pointer.

    https://github.com/RustPython/RustPython/blob/6227ed455303fa43f7cca6b9cbde5a8144ee51b7/vm/src/pyobjectrc.rs#L280

    Noa
    @coolreader18
    I should probably add comments, and also probably run it under miri or set up loom/threadsanitizer, but I did think about that and I think the locking should ensure that if that does happen, it's ok - we check parent again after we get the lock, and nope I see what you mean. In theory it could run the entirety of WeakRefList::drop between load() and lock() ? Even unlock_fair wouldn't necessarily totally fix it, cause there could be a bunch of weakrefs queueing to drop and idk if unlock_fair would go to all of them before returning to the lock in WeakRefList::drop
    Noa
    @coolreader18
    I mean, I suppose parent could be a PyMutex
    Ahh, I see what you mean by side-table, that definitely looks like a much less error-prone solution
    Hoss Ajallooiean
    @katetsu
    im learning about rustpython and have looked at the embedded examples. are those examples embedding the kernel statically?
    also, if i go ahead with using rustpython, is there a limitation involved with pip installing other packages on pypi?
    does the c-api play a role here?
    Jeong YunWon
    @youknowone
    pip works in linux but any c-api related stuff doesn’t work (yet)
    Hoss Ajallooiean
    @katetsu
    Ok thanks
    Snowapril
    @Snowapril

    @coolreader18 I'm trying to implements "Parenthesized context managers(bpo-12782)" before adding RustPython/RustPython#3427 but stuck in lalrpop..

    What I'm trying to add is just support parenthesizing with context like below which is illegal in before.

    with (
                manager() as x,
                manager() as y
            ):
                pass

    But I'm struggling with shift-reduce conflict 😢
    Could you take a look and advice these lines

    Corresponding parts Python.gram in cpython are these lines

    Jim Fasarakis-Hilliard
    @DimitrisJim
    I remember seeing this as a rationale for introducing the PEG parser in CPython. Don't remember the PEP atm but should be easy to find.
    Jim Fasarakis-Hilliard
    @DimitrisJim
    This doesn't block RustPython/RustPython#3427 right?
    Snowapril
    @Snowapril
    Yeah. It doesnt matter with #3427. There are a lot bunch of lalrpop stuffs for pattern-matching. I think it will be long-term works. Before going them I want to quick-solve that bpo-12782 for practice. Thanks 😊
    Yossi Konstantinovsky
    @yossi-k
    Why doesn't OptionalArg allow NoneType? If I have a function that accepts OptionalArg<PyStrRef>, I want to be able to pass None as well as strings or not pass it at all
    Noa
    @coolreader18
    @yossi-k That's OptionalOption, aka OptionalArg<Option<T>>
    Snowapril
    @Snowapril
    It seems #3402, #3421, #3433, #3434 suffered from same test failure in test_cpython_stdlib_os 😢
    hohh
    @hohh:matrix.org
    [m]
    What is the status of the python-vm for rust? I'd like to have some embedded python in a rust application but I see it's been retracted from crates.io and there is a short note on it on the github.
    Steve Shi
    @qingshi163
    stdlib_os failing is not related with these pr, it looks like a version problem happened only on Windows. I don't have the Windows environment to test the code, but it not looks something important right now.
    Snowapril
    @Snowapril
    Yeah I also agree 😊. It was not relevant to those PR but because of it, those PR's test checks were stucked
    hohh
    @hohh:matrix.org
    [m]
    Does anyone know why rustpython-vm was yanked from crates.io?
    There is a note in the README that it's due to it not compiling with newer versions of rustc, however that seems like a poor reason to yank an entire crate. What is required to get this back?
    Jeong YunWon
    @youknowone
    I wrote a new guideline to update test files: https://github.com/RustPython/RustPython/wiki/How-to-update-test-files
    Zomatree
    @Zomatree
    is there any way to debug a memory leak inside rustpython?
    Gerald Nash
    @aunyks
    Hi!
    Does RustPython support module import / export for non-stdlib modules?
    I couldn’t tell from the docs or examples so thought I’d ask
    Jeong YunWon
    @youknowone
    what you mean by module export? if you are looking for python’s import equivalent thing, search for vm.import in the source code
    @Zomatree inside meaning python way? then I have no idea. in rust side, idk well but MIRI looks like the one
    Gerald Nash
    @aunyks
    @youknowone Yea thats what i meant. I wasnt sure how imports are resolved. Thanks ill check
    Snowapril
    @Snowapril
    How do you think to introduce continuous fuzz testing to RustPython? I found some good fuzz testing tool for open source software (https://github.com/google/oss-fuzz). It seems that many of major open source project(cpython, django, etc.. ) registered on it.
    Jeong YunWon
    @youknowone
    If you are interested in, rust is well-known for its advanced fuzz test tools https://rust-fuzz.github.io/book/introduction.html
    Gentle
    @Gentle
    can rustpython work with virtualenvs?
    hohh
    @hohh:matrix.org
    [m]

    I'm using the rustpython-vm crate in order to run some python code from a rust application.
    Currently I'm having issues with first compiling a python library, loading it into a module and after that calling functions from that module in a later call to the VM.
    I'm using the import_file function to create the module, but I'm not sure how to later create a scope for the VM that includes this module.

    Does anyone know how I could go about debugging this?

    use rustpython_vm::compile::Mode;
    use rustpython_vm::Interpreter;
    use rustpython_vm::import::import_file;
    use rustpython_vm::compile;
    
    fn main() {
        Interpreter::default().enter(|vm| {
            let imp = import_file(vm, "mylib", "mylib".to_owned(), MAIN.to_owned()).unwrap();
            //let import = vm.compile(MAIN, compile::Mode::Exec, "<main>".to_owned())
            //    .map_err(|err| vm.new_syntax_error(&err)).unwrap();
    
            let scope = vm.new_scope_with_builtins();
            let code_obj = vm
                .compile(
                    r#"import * from mylib
    def initt():
        print("fef")
    init()"#,
                    Mode::Exec,
                    "<embedded>".to_owned(),
                )
                .map_err(|err| vm.new_syntax_error(&err))
                .unwrap();
            //vm.run_code_obj(import, scope).unwrap();
            vm.run_code_obj(code_obj, scope).unwrap();
        });
        println!("Hello, rust!");
    }
    
    const MAIN: &str = r#"print("PYTHON MODULE INIT")
    def init():
        print("Python says init")
    
    def run(command, ext_state, state):
        print("Python says run")
    "#;
    This is a small reproduction of what I'm trying to do, notice how I don't know how to make the code_obj run in a scope that includes imp
    nadavkluger
    @nadavkluger
    image.png
    Can someone help me? Just cloned the repo and tried to run it on windows, I did set with git bash RUST_BACKTRACE=1 and the result was the same
    Noa
    @coolreader18
    Could you post the output with RUST_BACKTRACE=1 ?
    nadavkluger
    @nadavkluger
    image.png
    Noa
    @coolreader18
    Hm, that's not actually setting the environment variable, it should give a different output
    That's msys? You can replace set with export or just do RUST_BACKTRACE=1 cargo [..]
    nadavkluger
    @nadavkluger
    Thanks!
    Jeong YunWon
    @youknowone
    what’s happened to CI?
    match_class tests looks just ok but failing in CI
    fanninpm
    @fanninpm
    An LTO bug happened to CI.
    tyoc213 (David L)
    @tyoc213
    how to generate not_impl.py as on a fresh clone running whats_left.sh throws Failed reading file 'extra_tests/not_impl.py'
    Jeong YunWon
    @youknowone
    it must be generated by the script. which directory did you run the script? the script might be (wrongly) depending on path