hauntsaninja / no_implicit_optional

A codemod to make your implicit optional type hints PEP 484 compliant.
MIT License
79 stars 8 forks source link

libcst._version raises ValueError: source code string cannot contain null byte #2

Closed kalebdfischer closed 1 year ago

kalebdfischer commented 1 year ago

I'll open a PR momentarily with the fix, but the following is raised when attempting to run:

  File ".../bin/no_implicit_optional", line 5, in <module>
    from no_implicit_optional import main
  File ".../lib/python3.9/site-packages/no_implicit_optional.py", line 6, in <module>
    import libcst as cst
  File ".../lib/python3.9/site-packages/libcst/__init__.py", line 215, in <module>
    from libcst._version import version as LIBCST_VERSION
ValueError: source code string cannot contain null byte

libcst version is 0.4.8

The issue is actually with libcst, so the issue can be closed. I was able to get no_implicitoptional running by editing the local environment copy of [libcst's __init_\.py on line 216](https://github.com/Instagram/LibCST/blob/main/libcst/__init__.py#L216) from except ImportError: to except (ImportError, ValueError):

hauntsaninja commented 1 year ago

Thanks, sounds good. Seems like https://github.com/Instagram/LibCST/issues/817 is the issue filed on libcst