Skip to content

Commit

Permalink
Merge pull request #91 from scrapy/py3.13
Browse files Browse the repository at this point in the history
Python 3.13 support
  • Loading branch information
wRAR committed Sep 26, 2024
2 parents af44683 + f548063 commit cd538a9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,13 @@ jobs:
- python-version: '3.12'
env:
TOXENV: py
- python-version: '3.13.0-rc.1'
env:
TOXENV: py
steps:
- uses: actions/checkout@v4
- name: Install system libraries
if: contains(matrix.python-version, 'pypy')
if: contains(matrix.python-version, 'pypy') || contains(matrix.python-version, 'beta')
run: |
sudo apt-get update
sudo apt-get install libxml2-dev libxslt-dev
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
],
Expand Down
15 changes: 9 additions & 6 deletions tests/test_utils_python.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import functools
import operator
import platform
import sys
import unittest
from typing import Any

Expand Down Expand Up @@ -48,16 +49,18 @@ def __call__(self, a, b, c):
self.assertEqual(get_func_args(str.split, stripself=True), ["sep", "maxsplit"])
self.assertEqual(get_func_args(" ".join, stripself=True), ["iterable"])

if platform.python_implementation() == "CPython":
# This didn't work on older versions of CPython: https://github.com/python/cpython/issues/86951
if sys.version_info >= (3, 13) or platform.python_implementation() == "PyPy":
# the correct and correctly extracted signature
self.assertEqual(
get_func_args(operator.itemgetter(2), stripself=True), ["obj"]
)
elif platform.python_implementation() == "CPython":
# ["args", "kwargs"] is a correct result for the pre-3.13 incorrect function signature
# [] is an incorrect result on even older CPython (https://github.com/python/cpython/issues/86951)
self.assertIn(
get_func_args(operator.itemgetter(2), stripself=True),
[[], ["args", "kwargs"]],
)
elif platform.python_implementation() == "PyPy":
self.assertEqual(
get_func_args(operator.itemgetter(2), stripself=True), ["obj"]
)


if __name__ == "__main__":
Expand Down

0 comments on commit cd538a9

Please sign in to comment.