Whole file
celery/billiard
The author described this change as “fix(co_positions): resolve issue caused by absence `co_positions` (#395)”. It counts as a record because the check below fails on the code as it stood at 32e51b50a and passes on 17037e55c, with nothing else changed between the two runs.
Projectcelery/billiard
Fix saved2023-10-29
Sharing licenceBSD-3-Clause · LICENSE.txt
Change size+25 −0
What the code was meant to do, written into the code itself as a save note
fix(co_positions): resolve issue caused by absence `co_positions` (#395)
The change
| 57 | 57 | # don't want to hit https://bugs.python.org/issue21967 | |
| 58 | 58 | self.f_restricted = False | |
| 59 | 59 | ||
| 60 | + | if sys.version_info >= (3, 11): | |
| 61 | + | @property | |
| 62 | + | def co_positions(self): | |
| 63 | + | return self.f_code.co_positions | |
| 60 | 64 | ||
| 65 | + | ||
| 61 | 66 | class _Object: | |
| 62 | 67 | ||
| 63 | 68 | def __init__(self, **kw): | |
| 64 | 69 | [setattr(self, k, v) for k, v in kw.items()] | |
| 65 | 70 | ||
| 71 | + | if sys.version_info >= (3, 11): | |
| 72 | + | __default_co_positions__ = ((None, None, None, None),) | |
| 66 | 73 | ||
| 74 | + | @property | |
| 75 | + | def co_positions(self): | |
| 76 | + | return getattr( | |
| 77 | + | self, | |
| 78 | + | "_co_positions", | |
| 79 | + | self.__default_co_positions__ | |
| 80 | + | ).__iter__ | |
| 81 | + | ||
| 82 | + | @co_positions.setter | |
| 83 | + | def co_positions(self, value): | |
| 84 | + | self._co_positions = value # noqa | |
| 85 | + | ||
| 86 | + | ||
| 67 | 87 | class _Truncated: | |
| 68 | 88 | ||
| 69 | 89 | def __init__(self): | |
| ⋯ | |||
| 78 | 98 | ) | |
| 79 | 99 | self.tb_next = None | |
| 80 | 100 | self.tb_lasti = 0 | |
| 101 | + | ||
| 102 | + | if sys.version_info >= (3, 11): | |
| 103 | + | @property | |
| 104 | + | def co_positions(self): | |
| 105 | + | return self.tb_frame.co_positions | |
| 81 | 106 | ||
| 82 | 107 | ||
| 83 | 108 | class Traceback: | |
The check that tells the two apart
fail→pass·t/unit/test_einfo.py::test_object_co_positions
Check file t/unit/test_einfo.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.
Origin and history
The code before it32e51b50aa3e6eaec597f5587c41951376554066
Broken version dated2023-08-04
Modulebilliard.einfo
Units changed_Frame, _Object, _Truncated
Fingerprint9f1b7671c37d7352
Checked2026-08-18 by goldset/0.1
Every field above is generated by our program. None of it is written by hand.
Other bugs found in celery/billiard
- 2017-05-20fix cpython issue 14881 (#224)