tbodt/v8py

Is greenstack required?

AlexHill opened this issue · 7 comments

More questions!

In greenstack.cpp:

     PyGreenstack_Import();
    if (_PyGreenstack_API == NULL) {
        // No greenlets? No problems!
        return 0;
}

And in v8py.cpp:

 if (greenstack_init() < 0) return FAIL;

This and the fact that the package isn't a dependency in setup.py makes me think greenstack isn't meant to be required. But if I just pip install v8py, open Python and import v8py, I get ImportError: PyCapsule_Import could not import module "greenstack" during from _v8py import *, I guess because as well as returning NULL, PyCapsule_Import sets an exception.

What's meant to happen here?

This is on Python 2.7.12 on Ubuntu 16.04, latest v8py master and 0.9.12.

tbodt commented

Yes, greenstack is not suppose to be required. This is a bug, I'll investigate. For what it's worth, it seems to work fine on Python 3.

tbodt commented

The solution is probably PyErr_Clear if greenstack is not present.

I get the same error in Python 3.5.2, but with an extra exception:

(v8py-env) $ python
Python 3.5.2 (default, Sep 14 2017, 22:51:06) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import v8py
ImportError: PyCapsule_Import could not import module "greenstack"

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/alexh/v8py-env/lib/python3.5/site-packages/v8py/__init__.py", line 1, in <module>
    from _v8py import *
  File "<frozen importlib._bootstrap>", line 968, in _find_and_load
SystemError: PyEval_EvalFrameEx returned a result with an error set
>>> 
tbodt commented

Uh oh!

Looks like I was wrong.

tbodt commented

Fix should still just be PyErr_Clear.

Fixed in #18