EasyPost / pystalk

Simple python Beanstalkd client
ISC License
11 stars 4 forks source link

Incompatible with Python 3.11 #18

Open akotlar opened 1 year ago

akotlar commented 1 year ago

Minimal example:

try:
            job = client.reserve_job(5)
except BeanstalkError as err:
            if err.message == 'TIMED_OUT':
                continue
            raise err

Results in

Traceback (most recent call last):
  File "/home/ec2-user/miniconda/envs/bystro311/lib/python3.11/contextlib.py", line 155, in __exit__
    self.gen.throw(typ, value, traceback)   
  File "/home/ec2-user/miniconda/envs/bystro311/lib/python3.11/site-packages/pystalk/client.py", line 166, in _sock_ctx
    yield self._socket
  File "/home/ec2-user/miniconda/envs/bystro311/lib/python3.11/site-packages/pystalk/client.py", line 425, in reserve_job
    job_id, job_data = self._receive_id_and_data_with_prefix(b'RESERVED', socket)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ec2-user/miniconda/envs/bystro311/lib/python3.11/site-packages/pystalk/client.py", line 194, in _receive_id_and_data_with_prefix
    raise BeanstalkError(error)
pystalk.client.BeanstalkError: b'TIMED_OUT' 

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/ec2-user/bystro/search2/python/search/index/listener.py", line 209, in <module>
    main()
  File "/home/ec2-user/bystro/search2/python/search/index/listener.py", line 205, in main
    listen(queue_conf, search_conf, config_path_base_dir)
  File "/home/ec2-user/bystro/search2/python/search/index/listener.py", line 125, in listen
    job = client.reserve_job(5)
          ^^^^^^^^^^^^^^^^^^^^^
  File "/home/ec2-user/miniconda/envs/bystro311/lib/python3.11/site-packages/pystalk/client.py", line 423, in reserve_job
    with self._sock_ctx() as socket:
  File "/home/ec2-user/miniconda/envs/bystro311/lib/python3.11/contextlib.py", line 188, in __exit__
    exc.__traceback__ = traceback
    ^^^^^^^^^^^^^^^^^
  File "/home/ec2-user/miniconda/envs/bystro311/lib/python3.11/site-packages/attr/_make.py", line 606, in _frozen_setattrs
    raise FrozenInstanceError()
attr.exceptions.FrozenInstanceError

If you stop modifying traceback the issue should be resolved

Justintime50 commented 1 year ago

Hey @akotlar, thanks for reporting this issue! We don't have any immediate plans to address this issue; however, we are definitely open to PRs if you'd like to submit one that can correct and test this. Otherwise we will revisit this in the future.