Message363056
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. |
|
Date |
User |
Action |
Args |
2020-03-01 11:59:05 | alexmojaki | set | recipients:
+ alexmojaki |
2020-03-01 11:59:05 | alexmojaki | set | messageid: <1583063945.36.0.652749436793.issue39810@roundup.psfhosted.org> |
2020-03-01 11:59:05 | alexmojaki | link | issue39810 messages |
2020-03-01 11:59:05 | alexmojaki | create | |
|