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
    Python requires some modules to launch python itself - this is called frozen module in rustpython / i dont know this concept very well. Somebody else will help you
    I guess some code change is required but it is possible
    Karel L. Kubat
    @KaiserKarel
    I'm okay with required modules loading; but beyond the bare minimum; I'd like to have some control on what is loaded.
    Quickly perusing vm/src/stdlib, it seems only the os.rs may be problematic
    Karel L. Kubat
    @KaiserKarel
    I'm guessing it would be a nice feature to be able to set some sandboxing/permission level on vm instantiation, akin to what deno does?
    Jeong YunWon
    @youknowone
    @coolreader18 was interested in sandboxing. maybe he would give some comment
    Alan Justino da Silva
    @alanjds
    Just to be sure: PyGetSet is the barebone of Property. I will need to change it to PyGetSetDelete to be able to implement @property.deleter, right?
    Jeong YunWon
    @youknowone
    get_module_inits was the loading part
    @alanjds PyGetSet is CPython getset. There also is PyProperty
    which is corresponding to python property
    It already has deleter.
    Alan Justino da Silva
    @alanjds
    Hum... so we create a PyGetSet on #[pyproperty] instead of a PyProperty?
    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?