Skip to content

Commit

Permalink
Fix deprecation warnings in Python 3.12 (#22)
Browse files Browse the repository at this point in the history
* Fix deprecation warnings in Python 3.12

* remove -dev from 3.12 version
  • Loading branch information
alexmojaki authored Dec 21, 2023
1 parent 3bef5d6 commit 551ba91
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']

runs-on: ubuntu-latest
steps:
Expand Down
21 changes: 20 additions & 1 deletion pytest_examples/traceback.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,26 @@ def create_custom_frame(frame: FrameType, example: CodeExample) -> FrameType:
ctypes.pythonapi.PyThreadState_Get.restype = P_MEM_TYPE

f_code = frame.f_code
if sys.version_info >= (3, 11):
if sys.version_info >= (3, 12):
code = CodeType(
f_code.co_argcount,
f_code.co_posonlyargcount,
f_code.co_kwonlyargcount,
f_code.co_nlocals,
f_code.co_stacksize,
f_code.co_flags,
f_code.co_code,
f_code.co_consts,
f_code.co_names,
f_code.co_varnames,
str(example.path),
f_code.co_name,
f_code.co_qualname,
f_code.co_firstlineno + example.start_line,
f_code.co_linetable,
f_code.co_exceptiontable,
)
elif sys.version_info >= (3, 11):
code = CodeType(
f_code.co_argcount,
f_code.co_posonlyargcount,
Expand Down
6 changes: 2 additions & 4 deletions requirements/testing.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# pip-compile --output-file=requirements/testing.txt --resolver=backtracking requirements/testing.in
# pip-compile --output-file=requirements/testing.txt requirements/testing.in
#
attrs==22.2.0
# via pytest
coverage==7.2.2
# via -r requirements/testing.in
exceptiongroup==1.1.1
Expand All @@ -22,7 +20,7 @@ pluggy==1.0.0
# via pytest
pygments==2.14.0
# via rich
pytest==7.2.2
pytest==7.4.2
# via pytest-pretty
pytest-pretty==1.1.1
# via -r requirements/testing.in
Expand Down

0 comments on commit 551ba91

Please sign in to comment.