Git Product home page Git Product logo

async-eval's Introduction

async-eval

from async_eval import eval


async def foo() -> int:
    return 10


print(eval("await foo()"))

async-eval's People

Contributors

dependabot[bot] avatar github-actions[bot] avatar surendra9123 avatar uriyyo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

async-eval's Issues

Cannot compile() a string

Hi there,

I want to compile() a string but async-eval compile()s it internally.
I want to make it so the <eval> filename does not show up in the console's logs, but does, for example, <protected> (see image below).

image

NameError: name '__locals__' is not defined

Python 3.8.2 (default, Feb 26 2020, 02:56:10)
Traceback (most recent call last):
  File "<eval>", line 28, in <module>
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/nest_asyncio.py", line 81, in run_until_complete
    return f.result()
  File "/usr/lib/python3.8/asyncio/futures.py", line 178, in result
    raise self._exception
  File "/usr/lib/python3.8/asyncio/tasks.py", line 280, in __step
    result = coro.send(None)
  File "<eval>", line 19, in __async_exec_func__
  File "<eval>", line 9, in __async_exec_func__
NameError: name '__locals__' is not defined

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "main.py", line 36, in <module>
    REPL = debug.require("files/REPL @__main__")
  File "/home/runner/LinkSafePremium/files/debug.py", line 403, in require
    return getmodule(*args, **kwargs)
  File "/home/runner/LinkSafePremium/files/debug.py", line 433, in getmodule
    module = exec(f"from {regex[0]}.{regex[1]} import {regex[2]}\nreturn {regex[2]}")
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/async_eval/async_eval.py", line 200, in async_eval
    exec(code_obj, _globals, _locals)
  File "<eval>", line 40, in <module>
NameError: name '__locals__' is not defined

image

Does not work on pypy 3.10

Hi. The package doesn't work with pypy 3.10.
It crashes on the save_locals() function with AttributeError: module 'ctypes' has no attribute 'pythonapi'.
When I comment that line, it seems to work ok, so it could not be hard to fix, but I don't understand function's purpose.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.