by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Jeong YunWon
    @youknowone
    Yep.. i agree the name can be confusing
    Alan Justino da Silva
    @alanjds
    Asking because del frame.f_frame should put a None instead of really deleting the thing
    Jeong YunWon
    @youknowone
    did you check CPython code of it?
    Alan Justino da Silva
    @alanjds
    this is unexpected for me but is what bdb.py does

    did you check CPython code of it?

    No. Good idea.

    Jeong YunWon
    @youknowone
    when cpython use getset, we use PyGetSet. when Cpython use property, we use PyProperty
    Alan Justino da Silva
    @alanjds
    I will look on cpython frame implementation of f_trace
    thanks
    Jeong YunWon
    @youknowone
    is it f_frame? I grepped cpython code but nothing found
    Alan Justino da Silva
    @alanjds
    f_trace. Sorry
    Jeong YunWon
    @youknowone
    {"f_trace", (getter)frame_gettrace, (setter)frame_settrace, NULL},
    it doesn’t use delete
    But PyGetSet can be just incompatible with CPython getset
    @alanjds its getter is cheating
        if (trace == NULL)
            trace = Py_None;
    Alan Justino da Silva
    @alanjds
    Yeah. I just found that :/
    Jeong YunWon
    @youknowone
    so, just by adding custom getter and setter, it will work!
    Alan Justino da Silva
    @alanjds
    but how do del frame.f_trace will work?
    Jeong YunWon
    @youknowone
    umm… probably that part could be incompatibility of PyGetSet?
    Alan Justino da Silva
    @alanjds
    I mean, when >>>>> del f.f_trace occur, the next call to >>>>> f.f_trace will still call FrameRef::f_trace ?
    I will figure out. Attaching a debugger in 3..2..1..
    Jeong YunWon
    @youknowone
    I am not sure rustpython support del f.f_trace for getset
    but f.f_trace sounds like always calling frame.f_trace / not sure
    Alan Justino da Silva
    @alanjds
    Supports. It raises an AttributeError after the del
    Noah
    @coolreader18
    @KaiserKarel yeah, right now we load all Rust modules by default, but you could try avoiding that by modifying vm.stdlib_inits to remove the posix or nt modules.
    Alan Justino da Silva
    @alanjds
    Huh. You are right, @youknowone:
    >>>>> f.f_trace
    Called: FrameRef::f_trace
    <function object at 0x555557eeb470>
    >>>>> del f.f_trace
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    AttributeError: 'frame' object has no attribute 'f_trace'
    (my branch. have #[pyproperty] fn f_trace on FrameRef)
    CPython:
    >>> f.f_trace
    <function <lambda> at 0x7f299efb1510>
    >>> del f.f_trace
    >>> f.f_trace
    >>>
    It does not really del, but acts as replacing with None
    Jeong YunWon
    @youknowone
    i glanced descrobject.c a bit but didn’t find hint
    Jeong YunWon
    @youknowone
    maybe this is problem of del implementation of rustpython
    Unfortunately my brain doesn’t work anymore - it is 4 am. @alanjds good luck! i hope to see good news at the morning :D
    Alan Justino da Silva
    @alanjds
    hahaha
    thanks
    Good... night?
    Karel L. Kubat
    @KaiserKarel
    It's good to see that all VM attributes are public; so I can just implement a custom builder and do the inits myself
    Without certain modules; python cannot make system calls right?
    Or does the language have some builtin ways to make them as well?
    Karel L. Kubat
    @KaiserKarel
    Also, what does py_compile_bytecode accept exactly/how does it work? :)
    Karel L. Kubat
    @KaiserKarel
    Oh and out of the builtins; open, input and print obviously make syscalls
    Sean Chen
    @seanchen1991
    Hi, I just wanted to ask and make sure that currently when you run pytest -v against the source code that there will be some expected failures. I'm seeing SampleTestCase.test_cpython_function_args, SampleTestCase.test_cpython_fstrings, and SampleTestCase.test_cpython_dict_union failing.
    Noah
    @coolreader18
    It might be because your system Python version is a bit behind, but it shouldn't be anything to worry about; the Python version when it's tested on CI is always consistent
    Sean Chen
    @seanchen1991
    Oh ok, I'm on 3.7.2, not 3.7.4.
    Jeong YunWon
    @youknowone
    The ci probably run 3.8.x
    Karel L. Kubat
    @KaiserKarel
    I'm trying to call vm.set_attr, but I'm getting a trait not implemented error on smallbox
    My code is basically taken from vm.initialize
    let mut vm = python::VirtualMachine::new(setting);
            // ensure that only files to which we have the capabilities can be opened, by removing
            // the standard open wrapper, and substituting our own.
            {
                let open_wrapper = crate::stdlib::io::io_open_with_capabilities(self.cap.clone().fs);
                vm.set_attr(&vm.builtins, "open", open_wrapper)?;
            }
    
            Ok(Vm{vm, cap: self.cap.clone()})
    where my open_wrapper is a PyNative functions
    Any clues what's going on? I'm creating open_wrapper using IntoPyNativeFunc::into_func(open_fn)
    I'm on master btw