This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author alexmojaki
Recipients alexmojaki
Date 2020-03-01.11:59:04
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1583063945.36.0.652749436793.issue39810@roundup.psfhosted.org>
In-reply-to
Content
Attached is a script which:

- Gets all the source code it can find from sys.modules
- Looks at every node in the parsed source
- Gets source text for that node using ast.get_source_segment
- Parses the source text again
- Compares the original node with the newly parsed node
- Points out if the nodes don't match

I ran this on Python 3.8.0, and it found several issues which have now been solved. So if there was a test like this then many bugs would have been caught earlier. I haven't tried it on a build of master, so I'm actually not sure which bugs have been fixed and what new bugs have been introduced.

The script partly relies on [asttokens](https://github.com/gristlabs/asttokens) which is another way to get the source code of a node. This helps to skip some known issues and to show what the output from get_source_segment should probably be. You don't strictly need to install asttokens to run the script but it's helpful.
History
Date User Action Args
2020-03-01 11:59:05alexmojakisetrecipients: + alexmojaki
2020-03-01 11:59:05alexmojakisetmessageid: <1583063945.36.0.652749436793.issue39810@roundup.psfhosted.org>
2020-03-01 11:59:05alexmojakilinkissue39810 messages
2020-03-01 11:59:05alexmojakicreate