Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Classes that contain things other than methods, booleans, numbers and strings cause a segfault #13

Open
tbodt opened this issue Sep 11, 2017 · 2 comments

Comments

@tbodt
Copy link
Owner

tbodt commented Sep 11, 2017

Examples:

class Test:
    class Inner:
        pass
    mapping = {'a': 'b'}
    thing = ['a', 'b']
@tbodt
Copy link
Owner Author

tbodt commented Sep 11, 2017

Making this work as expected wouldn't be easy, since exactly one FunctionTemplate is created for each class, and V8 requires that everything other than functions, booleans, numbers, and strings be created in a context. Maybe a special context could be created for these things? But that would allow communication between contexts where that might not be intended:

class Thing:
    thing = []
a = v8py.Context()
a.expose(Thing)
a.eval('Thing.thing.push("hello")')
b = v8py.Context()
b.expose(Thing)
a.eval('Thing.thing') #=> ['hello']

The solution is probably to ignore or issue a warning for these things.

cc @buffer

@tbodt
Copy link
Owner Author

tbodt commented Jun 12, 2018

@desertkun has found that using a context would not actually help, since you can only set templates and primitives as template attributes anyway. #24 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant