- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Parsing error when using dataclasses in Py36 without default values #4914
Comments
PEP-557 says dataclasses is a new feature of 3.7. But it seems you're using py3.6
|
@tk0miya indeed ! I'm using https://github.com/ericvsmith/dataclasses to emulate the behaviour. The PEP states that the syntax is: @dataclass
class C:
a: int # 'a' has no default value
b: int = 0 # assign a default value for 'b' , which is the exact same syntax I'm using. I know this isn't official Python (yet), but since it's coming pretty soon, I figured I'd raise the issue =) |
On my local, with python-3.6.4 and dataclasses-0.5, I can't reproduce the error. BTW, the error was raised on parssing
|
Ah, sorry. I noticed both
Anyway, I can't reproduce the error yet. So we have to reproduce it to fix. |
Thanks for looking into it. I'm away for work but I'll look into it this week end and try to narrow it down! |
We will ship next stable release soon. I'd like to fix this until then if possible. So please let me know if any updates. |
I'm sorry I didn't come back to you earlier, something popped up on another front. Thank you for the reminder ! I am at a complete loss, the bug has disappeared without any reason. My environment is locked, and I have not the slightest idea about what could have gone wrong at the time ... I will however report back if it ever happens again. I'm sorry for wasting your time on this without an actual outcome. |
I noticed the error has been happened silently. We can see it with
|
…thout default values
…thout default values
Oh, ok. I wonder why it decided to pop for me (I'm not using -vvv). It was crashing my build entirely. Please let me know if I can do anything to help. Thanks a bunch for what you're doing guys, it's much, much appreciated! I'm looking forward using the upcoming stable release! |
Please try #4996 and confirm it works fine if you have time. |
Fix #4914: autodoc: Parsing error when using dataclasses without default values
Fixed by #4996. |
Subject: sphinx build fails when using dataclasses in Py36 without default values
Problem
Using Python 3.6.5 on Win7 inside a Pipenv venv.
When building the documentation, Sphinx is unable to parse a .py file containing a simple dataclass (see .py file below).
Procedure to reproduce the problem
(nothing fancy going on)
Error logs / results
https://pastebin.com/qQi0NLW4
Expected results
I expected Sphinx to document the dataclass, showing the attributes' expected types.
Reproducible project / your project
Environment info
Extensions:
This is my first time reporting an issue here, please let me know if I've broken any guideline and I'll do my best to fix it!
EDIT: I forgot to emphasize that if I'm specifying default values like so:
then Sphinx has no issue whatsoever building the documentation.
The text was updated successfully, but these errors were encountered: