mhammond / pywin32

Python for Windows (pywin32) Extensions
5.01k stars 792 forks source link

Version 306 has an indentation issue in gencache.py which causes an error #2161

Closed AndyCWB closed 8 months ago

AndyCWB commented 9 months ago
Avasam commented 8 months ago

Something doesn't seem to add up. The exception mentions gencache.py:64, not gencache.py:771-776. Line 64 doesn't have mixed indentation. It also seems like usage method could only be called from executing the module anyway, not importing it. Tabs in strings is fine anyway.

I was not able to replicate, even with this simplified scenario:

import sys
print(sys.version)
print(sys.platform)

def usage():
    usageString = """\
      Usage: gencache [-q] [-d] [-r]

             -q         - Quiet
             -d         - Dump the cache (typelibrary description and filename).
             -r         - Rebuild the cache dictionary from the existing .py files
    """
    print(usageString)

usage()
3.8.5 (default, Jul 20 2020, 23:11:29) 
[GCC 9.3.0]
linux
      Usage: gencache [-q] [-d] [-r]

             -q         - Quiet
             -d         - Dump the cache (typelibrary description and filename).
             -r         - Rebuild the cache dictionary from the existing .py files

I still think it would be better to not mix indent in strings out of principle and consistency (and this isn't caught by black because it's in a string obviously). So I opened #2167