Skip to content

1.7.0 regression with mypyc #16480

Closed

Description

@mr-c

Bug Report

Bisected to e1f6d6b from #16268

To Reproduce

git clone https://github.com/common-workflow-language/cwltool
cd cwltool
git checkout dependabot/pip/mypy-1.7.0
make dev
MYPYPATH=mypy-stubs CWLTOOL_USE_MYPYC=1 pip install --verbose -e .
pytest -k '(test_listing_deep or test_cwltool_options or test_passthrough_successive or test_listing_v1_0 or test_disable_dir_overwrite_without_ext or test_disable_dir_creation_in_outdir_with_ext or test_warn_large_inputs or test_directory_workflow)'
# any of these tests will trigger the error, I'm just being comprehensive

Expected Behavior

Tests pass without failure

Actual Behavior

ERROR    cwltool:test_ext.py:30 Got workflow error
Traceback (most recent call last):
  File "cwltool/executors.py", line 220, in run_jobs
    for job in jobiter:
  File "cwltool/command_line_tool.py", line 963, in job
    builder = self._init_job(job_order, runtimeContext)
  File "cwltool/process.py", line 788, in _init_job
    visit_class(v, ("Directory",), lambda x: inc(dircount))  # noqa: B023
  File "cwltool/utils.py", line 219, in visit_class
    op(rec)
  File "cwltool/process.py", line 788, in <lambda>
    visit_class(v, ("Directory",), lambda x: inc(dircount))  # noqa: B023
AttributeError: attribute 'inc' of '_init_job_Process_env' undefined
ERROR    cwltool:test_ext.py:30 Workflow error, try again with --debug for more information:
attribute 'inc' of '_init_job_Process_env' undefined

Your Environment

  • Mypy version used: 1.7.0
  • Mypy command-line flags:
  • Mypy configuration options from mypy.ini (and other config files):
  • Python version used: 3.11.2, but also 3.8, 3.9, 3.11, and 3.12

Activity

  1. added
    bugmypy got something wrong
    on Nov 13, 2023
  2. AlexWaygood commented on Nov 13, 2023

    @AlexWaygood
    Member

    Bisected to e1f6d6b from #16268

    cc. @JukkaL

  3. ilevkivskyi commented on Nov 13, 2023

    @ilevkivskyi
    Member

    A standalone mypyc test case to reproduce

    [case testCallNestedFunctionWithLambda]
    def f(x: int) -> int:
        def inc(x: int) -> int:
            return x + 1
        return (lambda x: inc(x))(1)
    [file driver.py]
    from native import f
    print(f(1))
    [out]
    2
    

    Fails with

    Traceback (most recent call last):
      File "driver.py", line 2, in <module>
        print(f(1))
              ^^^^
      File "run-functions.test", line 1294, in f
        return (lambda x: inc(x))(1)
      File "run-functions.test", line 1294, in <lambda>
        return (lambda x: inc(x))(1)
    AttributeError: attribute 'inc' of 'f_env' undefined
    
  4. ilevkivskyi commented on Nov 13, 2023

    @ilevkivskyi
    Member

    Also same crash in a test that doesn't involve a lambda:

    [case testCallNestedFunctionWithoutLambda]
    def f() -> None:
        def a() -> None:
            pass
        def b() -> None:
            a()
        b()
    [file driver.py]
    from native import f
    f()
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrongtopic-mypycmypyc bugs

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions