Skip to content

JSF fails on Python 3.14 #128

Description

@RobbeSneyders

On Python 3.14, the following error is raised when generating an example:

  connexion/utils.py:546: in build_example_from_schema
      return faker.generate()
             ^^^^^^^^^^^^^^^^
  .tox/py314-pypi/lib/python3.14/site-packages/jsf/parser.py:353: in generate
      context = {**self.context, "use_defaults": use_defaults, "use_examples": use_examples}
                   ^^^^^^^^^^^^
  .tox/py314-pypi/lib/python3.14/site-packages/jsf/parser.py:340: in context
      return {**self.base_context, "state": deepcopy(self.base_state)}
                                            ^^^^^^^^^^^^^^^^^^^^^^^^^
  /opt/hostedtoolcache/Python/3.14.0/x64/lib/python3.14/copy.py:131: in deepcopy
      y = copier(x, memo)
          ^^^^^^^^^^^^^^^
  /opt/hostedtoolcache/Python/3.14.0/x64/lib/python3.14/copy.py:202: in _deepcopy_dict
      y[deepcopy(key, memo)] = deepcopy(value, memo)
                               ^^^^^^^^^^^^^^^^^^^^^
  _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
  
  x = count(1), memo = {140453082250240: {}}, _nil = []
  
      def deepcopy(x, memo=None, _nil=[]):
          """Deep copy operation on arbitrary Python objects.
      
          See the module's __doc__ string for more info.
          """
      
          cls = type(x)
      
          if cls in _atomic_types:
              return x
      
          d = id(x)
          if memo is None:
              memo = {}
          else:
              y = memo.get(d, _nil)
              if y is not _nil:
                  return y
      
          copier = _deepcopy_dispatch.get(cls)
          if copier is not None:
              y = copier(x, memo)
          else:
              if issubclass(cls, type):
                  y = x # atomic copy
              else:
                  copier = getattr(x, "__deepcopy__", None)
                  if copier is not None:
                      y = copier(memo)
                  else:
                      reductor = dispatch_table.get(cls)
                      if reductor:
                          rv = reductor(x)
                      else:
                          reductor = getattr(x, "__reduce_ex__", None)
                          if reductor is not None:
  >                           rv = reductor(4)
                                   ^^^^^^^^^^^
  E                           TypeError: cannot pickle 'itertools.count' object
  
  /opt/hostedtoolcache/Python/3.14.0/x64/lib/python3.14/copy.py:146: TypeError

This is caused by itertools.count objects no longer being picklable since Python 3.14:
https://docs.python.org/3/whatsnew/3.14.html#itertools
python/cpython#118816
python/cpython#101588

Activity

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions