Uploaded image for project: 'Beam'
  1. Beam
  2. BEAM-8494 Python 3.8 Support
  3. BEAM-9755

infer_return_type does not infer as expected in Python 3.8

Details

    • Sub-task
    • Status: Resolved
    • P2
    • Resolution: Fixed
    • None
    • Not applicable
    • sdk-py-core
    • None

    Description

      apache_beam.typehints.trivial_inference.infer_return_type does not return type as expected in Python 3.8.
      And this cause testDictComprehensionSimple (apache_beam.typehints.trivial_inference_test.TrivialInferenceTest) FAIL.

      • Python 3.7.7
         >> from apache_beam.typehints.trivial_inference import infer_return_type
         >> infer_return_type(lambda _list: {'a': 1 for _ in _list}, [], debug=False, depth=5)
         Dict[str, int]
      • Python 3.8.2
         >> from apache_beam.typehints.trivial_inference import infer_return_type
         >> infer_return_type(lambda _list: {'a': 1 for _ in _list}, [], debug=False, depth=5)
         Dict[int, str]

         

      CPython bytecode changes[1] may affect.

       [1] https://docs.python.org/3/whatsnew/3.8.html

      Attachments

        Activity

          People

            yoshiki.obata yoshiki obata
            yoshiki.obata yoshiki obata
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 1h 40m
                1h 40m