Skip to content

Commit

Permalink
Workaround the 3.12 traceback issue again.
Browse files Browse the repository at this point in the history
  • Loading branch information
jamadden committed Aug 31, 2023
1 parent 2f53c85 commit 495e37a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@ jobs:
# 3.10+ needs more work: dnspython for example doesn't work
# with it. That means for the bulk of our testing we need to
# stick to 3.9.
# 3.12-dev disabled for now, the traceback issue has only gotten worse.
python-version: ["pypy-3.10", 3.8, 3.9, '3.10', '3.11']
python-version: ["3.12-dev", "pypy-3.10", 3.8, 3.9, '3.10', '3.11']
os: [macos-latest, ubuntu-latest]
exclude:
# The bulk of the testing is on Linux and Windows (appveyor).
Expand Down
12 changes: 9 additions & 3 deletions src/gevent/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,14 @@ def format(self, details=True):
def __str__(self):
return self.format(False)

@staticmethod
def __render_tb(tree, label, frame, limit):
SUPPORTS_TRACEBACK = sys.version_info not in (
(3, 12, 0, 'beta', 3),
(3, 12, 0, 'beta', 4),
(3, 12, 0, 'candidate', 1),
)

@classmethod
def __render_tb(cls, tree, label, frame, limit):
tree.child_data(label)
# XXX: Issues with tblib? Seen with tblib 1.3 and 2.0.
# More likely, it's something wrong in greenlet and the way it's
Expand Down Expand Up @@ -410,7 +416,7 @@ def __render_tb(tree, label, frame, limit):
# A workaround on macOS is to not dump the root frame, but that only fixes
# test__util. test__threadpool:test_greenlet_class crashes similarly, but
# not 100% of the time.
if sys.version_info not in ((3, 12, 0, 'beta', 3), (3, 12, 0, 'beta', 4)):
if cls.SUPPORTS_TRACEBACK:
tb = ''.join(traceback.format_stack(frame, limit))
else:
tb = ''
Expand Down

0 comments on commit 495e37a

Please sign in to comment.