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.

classification
Title: Invalid syntax Python files in Python sources tree
Type: compile error Stage: resolved
Components: 2to3 (2.x to 3.x conversion tool), Demos and Tools, Library (Lib), macOS, Tests, Tkinter, Windows Versions: Python 3.3
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: georg.brandl, ned.deily, r.david.murray, ronaldoussoren, serhiy.storchaka
Priority: normal Keywords:

Created on 2012-04-04 20:30 by serhiy.storchaka, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
scanpy.py serhiy.storchaka, 2012-04-04 20:30 Search invalid syntax Python files
invalid.txt serhiy.storchaka, 2012-04-04 20:38 List of invalid files
scan.txt r.david.murray, 2012-04-05 01:47
Messages (7)
msg157501 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2012-04-04 20:30
I was very surprised to find in Python source code files that are not compatible with Python3. It turns out that this is not an exception, such files very much (see scanner script in attachment). Surely for many years no one had reached his hands run 2to3? These files need to be or to correct, or throw (when nobody needs them).

Python 3.2 detects significantly less invalid syntax files. But Python 3.3 has become more severe.
msg157502 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2012-04-04 20:36
See also issues 14490, 14491, and 14492.
msg157503 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2012-04-04 20:48
Some of these at least are intentional.  There are test files (especially in 2to3!) that use python2 syntax, and test files that have specially crated syntax errors in them.  Sphinx at one point was using Python2, I'm not sure if it has been upgraded to 3 yet or not.

I'm sure there are also files that just haven't been checked and updated, such as the ones in Tools/scripts(*).  So an audit is definitely in order.

(*) I thought someone *had* done an audit of those, but the evidence says otherwise.
msg157515 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2012-04-04 22:28
There was some related work on this in the earlier Demo clean up issue (Issue7962) and the still open "make altnstall" shebang line cleanup (Issue10318).

But I'm confused.  From the list of files you show in invalid.txt appear to be from a Python 2 source directory not a Python 3 one.  Many (most?) of the files in your list no longer exist in Python 3.  What problem are you trying to solve here?
msg157529 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2012-04-05 01:47
Here's a run of your script against Python3.3  

I see nothing on this list that is a problem (after the recent fixes in Tools/scripts).  The Doc stuff can be ignored, that's a Python2 based toolchain checked out by the Doc 'make' file.  As I said, lib2to3 tests contain python2 code.  The other tests files are supposed to be bad syntax.  The PC build toolchain is also still Python2 (same comment applies to the msi tool, which is part of that toolchain).  I imagine the Mac buildscript is too, but Ned can comment on that.  The gdb script is also Python2 (that's what GDB links against).

So, I'm closing this issue.
msg157537 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2012-04-05 05:27
Indeed, somehow I have in the source tree were many Python2 files. After `rm -r *` and `hg revert -a ` number of invalid files decreased to a reasonable limit. Sorry for the false alarm.
msg157541 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2012-04-05 06:58
Yes, Sphinx is still 2.x, although we could switch to a Python 3 version since now all necessary dependencies are ported.
History
Date User Action Args
2022-04-11 14:57:28adminsetgithub: 58702
2012-04-05 06:58:27georg.brandlsetnosy: + georg.brandl
messages: + msg157541
2012-04-05 05:27:50serhiy.storchakasetmessages: + msg157537
2012-04-05 01:47:47r.david.murraysetstatus: open -> closed
files: + scan.txt
messages: + msg157529

resolution: not a bug
stage: resolved
2012-04-04 22:28:48ned.deilysetassignee: ronaldoussoren ->

messages: + msg157515
nosy: + ned.deily
2012-04-04 20:48:12r.david.murraysetnosy: + r.david.murray
messages: + msg157503
2012-04-04 20:38:14serhiy.storchakasetfiles: + invalid.txt
2012-04-04 20:36:21serhiy.storchakasetmessages: + msg157502
2012-04-04 20:30:35serhiy.storchakacreate