-
Notifications
You must be signed in to change notification settings - Fork 252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python 3.11: '_Code' object has no attribute 'co_positions' #377
Comments
try to down grade your python or use celery 5.3.0b1 with billiard 4.0.2 |
Hi @auvipy, I tried using I also checked |
you can contribute to fix that |
The new property `co_postions` needs to be pulled through for Exception handling in python 3.11 to work. Addresses celery#377
ping me again if not released in a week |
@auvipy do you have any updates? |
Celery breaks with an error. See celery/billiard#377
* Dependencies versions updated Removed tests for `celery<5`. Support for these expired Aug 2021. https://docs.celeryq.dev/en/master/history/whatsnew-5.1.html#long-term-support-policy Remove support for Python 3.7, as newest django (4.1) supports Python 3.8+ only * PostgreSQL version updated to 11 Django 4.1 support PostgreSQL versions 11+ * Default python version set to 3.8 * Python 3.11 not supported yet Celery breaks with an error. See celery/billiard#377
@auvipy another week, another ping (do say if you'd rather not be reminded). |
Encountered the same problem so pinging @auvipy. :-) |
@auvipy another week, another ping (do say if you'd rather not be reminded). |
@auvipy We can release a new version of billiard without releasing Kombu/Celery yet. |
100% |
I will release ASAP |
released a new version |
@auvipy celery 5.2.7 requireds billiard<4.0. Can you release 3.6.5.0(may be) with this fix? |
this release is for celery 5.3 mainly. we still do not back port python 3.11 support to celery 5.2.x |
The celery tests failed on Python 3.11. This is most likely due to this issue in billiard, a celery dependency, about it not working on Python 3.11 because of the error reported in the CI: celery/billiard#377 It's been fixed in billiard 4.1.0, but celery is locked on billiard version lower than 4, so it cannot use this version with the fix. This issue does not arise on the Docker tests, because they use Python 3.9.16. I've moved the error test span event assertions to the error test that is available in the functional tests, and removed the unit test. That way, the build will run successfully.
* Add tests for errors in Celery tasks I noticed there were no tests for the error scenario in the Celery package. This commit adds a basic test, based on the previous test and how I see other packages test the error status on the span. Part of #987 * Record exception in Celery instrumentation In addition to setting the status on the span, also record the exception on the span. This adds an event to the span with more details about the error, following the format other instrumentations also use. * Update CHANGELOG with Celery record exception * Fix lint code formatting issues * Move Celery error tests to the functional tests The celery tests failed on Python 3.11. This is most likely due to this issue in billiard, a celery dependency, about it not working on Python 3.11 because of the error reported in the CI: celery/billiard#377 It's been fixed in billiard 4.1.0, but celery is locked on billiard version lower than 4, so it cannot use this version with the fix. This issue does not arise on the Docker tests, because they use Python 3.9.16. I've moved the error test span event assertions to the error test that is available in the functional tests, and removed the unit test. That way, the build will run successfully. * Remove duplicate entry in changelog This was added in a recent merge commit on this PR branch. * Remove unused test code With the move of the tests for tasks with errors to the functional tests, remove the unit test's error task and unused imports. --------- Co-authored-by: Srikanth Chekuri <[email protected]>
That's https:/celery/billiard/releases/tag/v4.1.0 for anyone else who hit this and is wondering how to get the fix. However...
https://pypi.org/project/celery/#history suggests that all celery 5.3.x versions are still pre-release, so from your comment above it seems that there is no support (or plan for it) for python 3.11 in any current official 'release' of celery? 😢 |
that can be used with 5.3beta versions as of now |
Yes I see that, however we do not plan to use a beta version of celery in production - it's a shame that the current 5.2.x series is being left behind in terms of python 3.11 support. |
I understand the need for Python 3.11 support my friend @sparrowt, and it will come, but we first need to concentrate on releasing the official Celery 5.3 release (no beta, no pre-releases, official), so we can close the circle on that aspect and move on forward. I am sure @auvipy and myself would happy to support any contribution towards adding Python 3.11, but at the moment our hands are full and we cannot depreioritize other issues to push this instead. |
How to live dangerously (i.e. Python 3.11 with Celery 5.2): diff --git a/.venv/lib/python3.11/site-packages/billiard/einfo.py b/.venv/lib/python3.11/site-packages/billiard/einfo.py
index 236f400c7..84ff7529d 100644
--- a/.venv/lib/python3.11/site-packages/billiard/einfo.py
+++ b/.venv/lib/python3.11/site-packages/billiard/einfo.py
@@ -24,6 +24,13 @@ class _Code(object):
self.co_nlocals = code.co_nlocals
self.co_stacksize = code.co_stacksize
self.co_varnames = ()
+ if sys.version_info >= (3, 11):
+ self._co_positions = list(code.co_positions())
+
+ if sys.version_info >= (3, 11):
+ @property
+ def co_positions(self):
+ return self._co_positions.__iter__
class _Frame(object):
|
I have a celery task that raises an exception:
When the task is applied, instead of being caught and sending a task failure signal, I get an attribute error from a biliard object:
AttributeError: '_Code' object has no attribute 'co_positions'
.co_positions
is new in Python 3.11 for codeobjects, so I'm wondering if this is a billiards compatibility problem with Python 3.11 or if it's something else entirely with celery.Here is the traceback:
Note: I am running
billard==3.6.4.0, celery==5.2.7, redis==3.5
with Python 3.11.The text was updated successfully, but these errors were encountered: