Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Noa
    @coolreader18
    ❯ target/release/rustpython
    Welcome to the magnificent Rust Python 0.1.2 interpreter 😱 🖖
    >>>>> import sys; sys.path.insert(0, '/home/coolreader18/rspy-tests/asynchttp')
    >>>>> import aiohttp
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/home/coolreader18/rspy-tests/asynchttp/aiohttp/__init__.py", line 6, in <module>
        from .client import (
      File "/home/coolreader18/rspy-tests/asynchttp/aiohttp/client.py", line 35, in <module>
        from . import hdrs, http, payload
      File "/home/coolreader18/rspy-tests/asynchttp/aiohttp/http.py", line 7, in <module>
        from .http_parser import (
      File "/home/coolreader18/rspy-tests/asynchttp/aiohttp/http_parser.py", line 15, in <module>
        from .helpers import NO_EXTENSIONS, BaseTimerContext
      File "/home/coolreader18/rspy-tests/asynchttp/aiohttp/helpers.py", line 48, in <module>
        from typing_extensions import Protocol
      File "/home/coolreader18/rspy-tests/asynchttp/typing_extensions.py", line 364, in <module>
        class _FinalForm(typing._SpecialForm, _root=True):
    AttributeError: module 'typing' has no attribute '_SpecialForm'
    Noa
    @coolreader18
    Yeah, I tweaked a few things and I'm able to import it fine
    ❯ rustpython                                     
    Welcome to the magnificent Rust Python 0.1.2 interpreter 😱 🖖
    >>>>> import idna_ssl; import sys; sys.version_info = (3, 6, 0)
    >>>>> import aiohttp
    >>>>> aiohttp
    <module 'aiohttp' from '/home/coolreader18/rspy-tests/asynchttp/aiohttp/__init__.py'>
    Venu Vemula
    @venugopv_twitter
    Hi, I am newbie to RustPython. Spent some time in docs/examples/code.. but am not able to find a way to target python code to WASM. I am working on generic WASM Executor using which I can run WASM modules (i.e code complied to wasm from different languages like C, C++, Rust ). It would be great, if RustPython provides a way to target python for compiling to WASM.
    pca006132
    @pca006132
    I don't think RustPython is a compiler?
    Noa
    @coolreader18
    Yeah, you compile RustPython to wasm and then run the code using the interpreter
    pca006132
    @pca006132
    hi, is there documentation about how vm/src/slots.rs works? I'm a bit confused with the code, and not sure how to add more functions to it, like __add__ etc.
    Zomatree
    @Zomatree

    so going on with my importing issue from yesterday, it seems to be an issue with one of my other modules, it seems that rustpython is just hanging on some of my relative imports (from .a import B), none of the file that im trying to import gets executed.

    ive tried making a minimal but cant get any repro so im uploading the entire setup, https://github.com/Zomatree/discord.py/tree/rustpython-test and run rustpython -m discord it should print a bunch of stuff then hang at 16 that is trying to import discord/http.py from discord/client.py#61, does this hang for anyone else?

    Noa
    @coolreader18
    yeah it hangs for me after 16
    I was looking into trying to fix from . import x stuff, but it's so weird I don't know how it works in cpython
    Zomatree
    @Zomatree
    yeah like its working 99% of the time but just here its not
    Zomatree
    @Zomatree
    would be nice if rustpython errors or something instead of hanging and memory leaking
    this seems to be the cause of it eating 15GB+ of mem
    Noa
    @coolreader18
    oh i see. we implemented Instruction::ImportFrom wrong, lol. it should fallback to checking sys.modules if the attribute isn't there
    Noa
    @coolreader18
    I had been staring at importlib/_bootstrap.py for like an hour and it wasn't even an issue there
    Noa
    @coolreader18
    @Zomatree I pushed a branch misc-aiohttp for fixing some of the issues
    Noa
    @coolreader18
    Yeah, now rustpython -m discord exits without doing anything, which is the same thing I'm getting with the aiohttp hello world
    Zomatree
    @Zomatree
    does it not run the __main__.py file?
    Noa
    @coolreader18
    it does, it just doesn't start up the main loop or something like that
    like with this:
    import idna_ssl; import sys; sys.version_info = (3, 6, 0)
    import aiohttp
    import asyncio
    
    async def main():
        async with aiohttp.ClientSession() as session:
            print(session)
            async with session.get('http://python.org') as response:
                print(response)
                try:
                    print(await response.text())
                except:
                    import traceback;
                    traceback.print_exc()
    
    asyncio.run(main())
    it prints the session, but not the response, and not any error
    Zomatree
    @Zomatree
    ill have a dig around
    Noa
    @coolreader18
    oh also @Zomatree I have a bunch of fixes for coroutines in coolreader18/fix-vm-exc-stack, so you might want to get a second branch and merge both those in
    git checkout master && git checkout -b aiohttp-merge && git merge misc-aiohttp coolreader18/fix-vm-exc-stack
    Zomatree
    @Zomatree
    seems like the signal lib is missing a bunch of attrs
    Zomatree
    @Zomatree
    are you not publically showing NSIG inside the signal lib, you use inside the source code
    ill just hardcode it as 64 for now but it should be accessable under the signal lib
    Zomatree
    @Zomatree
    @coolreader18 i think you broke the ThreadPoolExecutor, your __getattr__ stops it from working
    Noa
    @coolreader18
    yeah, that requires ModuleType.getattribute to respect the module's defined getattr
    i cherrypicked 1f35a09 in and removed everything but the changes to module.rs
    lotta stuff happening :sweat_smile:
    Zomatree
    @Zomatree
    yeah everything is all over the place
    Noa
    @coolreader18
    @Zomatree I pushed to misc-aiohttp again, it should get farther along and properly error in aiohttp now
    Zomatree
    @Zomatree
    im getting cert errors now even though i enabled the ssl feature
    Noa
    @coolreader18
    @Zomatree basic aiohttp functionality works now! just on the misc-aiohttp branch with cargo build --release --features ssl:
    import idna_ssl; import sys; sys.version_info = (3, 6, 0)
    import aiohttp
    import asyncio
    
    async def main():
        async with aiohttp.ClientSession() as session:
            async with session.get('http://python.org') as response:
                print(await response.text())
    
    asyncio.run(main())
    ❯ rustpython t.py
    <!doctype html>
    <!--[if lt IE 7]>   <html class="no-js ie6 lt-ie7 lt-ie8 lt-ie9">   <![endif]-->
    <!--[if IE 7]>      <html class="no-js ie7 lt-ie8 lt-ie9">          <![endif]-->
    <!--[if IE 8]>      <html class="no-js ie8 lt-ie9">                 <![endif]-->
    <!--[if gt IE 8]><!--><html class="no-js" lang="en" dir="ltr">  <!--<![endif]-->
    
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <!-- snip -->
    </body>
    </html>
    the version_info hack is required because we don't have PEP 560 implemented, but I don't think that should be too hard
    Zomatree
    @Zomatree
    error[E0425]: cannot find function, tuple struct or tuple variant `SSL_get_current_compression` in module `sys`
       --> vm/src/stdlib/ssl.rs:702:41
        |
    702 |         let comp_method = unsafe { sys::SSL_get_current_compression(stream.ssl().as_ptr()) };
    seems like openssl-sys is giving me issues
    Noa
    @coolreader18
    Oh, I guess that's an old ssl version. I think it's possible to shim that functionality
    Noa
    @coolreader18
    @Zomatree could you try again? I just pushed to misc-aiohttp
    Zomatree
    @Zomatree
    its not erroring with that anymore, i have openssl 1.1.1
    SSLError: (134, 'certificate verify failed (_ssl.c:1913)') welp
    Noa
    @coolreader18
    huh.. what's the traceback of that?
    and is that with discord or just the aiohttp helloworld?
    Zomatree
    @Zomatree
    @coolreader18 both
    Noa
    @coolreader18
    hm, that's really weird, it's not like there's any ssl configuration
    oh wait i do use the system ssl lib, let me try with vendoring it into the binary
    ah I'm able to reproduce it now!
    Noa
    @coolreader18
    although I'm not sure what we could do to fix it, it seems like it might be an issue in openssl-sys' tarball of openssl
    Try setting OPENSSL_NO_VENDOR=1 while building, that should fix the issue temporarily (assuming you have openssl installed on your system)