Skip to content

Commit

Permalink
Add support for dis.findlinestarts for 3.13.
Browse files Browse the repository at this point in the history
  • Loading branch information
adiroiban committed Dec 20, 2023
1 parent 7a77099 commit accc043
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ jobs:
# No coverage also.
- python-version: '3.13.0-alpha.2'
tox-env: 'mindeps-nocov-posix'
job-name: 'minimum-deps-3.13'
job-name: 'mindeps-nocov-deps-3.13'

# Newest macOS and oldest Python (major) supported versions.
- python-version: '3.8'
Expand Down
5 changes: 5 additions & 0 deletions src/twisted/trial/_synctest.py
Original file line number Diff line number Diff line change
Expand Up @@ -1189,9 +1189,14 @@ def flushWarnings(self, offendingFunctions=None):

if filename != os.path.normcase(aWarning.filename):
continue

# In Python 3.13 line numbers returned by findlinestarts
# can be None for bytecode that does not map to source
# lines.
lineNumbers = [
lineNumber
for _, lineNumber in _findlinestarts(aFunction.__code__)
if lineNumber is not None
]
if not (min(lineNumbers) <= aWarning.lineno <= max(lineNumbers)):
continue
Expand Down

0 comments on commit accc043

Please sign in to comment.