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

Self is passed to dataclasses with no way to pass that reference in python code #3668

Closed
vladraduvidican opened this issue Jun 8, 2020 · 1 comment

Comments

@vladraduvidican
Copy link

vladraduvidican commented Jun 8, 2020

This is the code I'm trying to run in Cython:

from dataclasses import dataclass

@dataclass()
class BookOrder:
    id: int
    time: int
    action: str
    value: float
    quantity: float

order = BookOrder(-1, -1, "-1", -1, -1)

def printme():
    print(str(order))

printme()

This is the error:

  File "main.pyx", line 11, in init main
    order = BookOrder(-1, -1, "-1", -1, -1)
ImportError: Building module main failed: ['TypeError: __init__() takes 1 positional argument but 6 were given\n']
@scoder
Copy link
Contributor

scoder commented Jun 8, 2020

Duplciate of #2552.

@scoder scoder closed this as completed Jun 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants