Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add support for Python 3.12 #844

Merged
merged 1 commit into from
Jan 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,13 @@ jobs:
matrix:
python-impl:
- python
- pypy
python-version:
- '3.10'
- '3.11'
exclude:
# XXX: pypy-3.11 does exist yet
- '3.12'
include:
- python-impl: pypy
python-version: '3.11'
python-version: '3.10'
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
import os
import json
full_matrix = {
'python': ['3.10', '3.11'],
'python': ['3.10', '3.11', '3.12'],
# available OS's: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idruns-on
'os': ['ubuntu-22.04', 'macos-12', 'windows-2022'],
'include': [
Expand All @@ -33,7 +33,7 @@ jobs:
}
# this is the fastest one:
reduced_matrix = {
'python': ['3.11'],
'python': ['3.12'],
'os': ['ubuntu-22.04'],
}
github_repository = os.environ['GITHUB_REPOSITORY']
Expand Down
4 changes: 4 additions & 0 deletions hathor/event/storage/rocksdb_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ def iter_from_event(self, key: int) -> Iterator[BaseEvent]:
for event_bytes in it:
yield BaseEvent.parse_raw(event_bytes)

# XXX: on Python 3.12, not deleting it here can cause EXC_BAD_ACCESS if the db is released before the iterator
# in the garbage collector. This race condition might happen between tests.
del it

def _db_get_last_event(self) -> Optional[BaseEvent]:
last_element: Optional[bytes] = None
it = self._db.itervalues(self._cf_event)
Expand Down
12 changes: 6 additions & 6 deletions hathor/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,14 +176,14 @@ class MaxSizeOrderedDict(OrderedDict):
>>> foo[3] = 'c'
>>> foo[4] = 'd'
>>> foo[5] = 'e'
>>> foo
MaxSizeOrderedDict([(1, 'a'), (2, 'b'), (3, 'c'), (4, 'd'), (5, 'e')])
>>> list(foo.items())
[(1, 'a'), (2, 'b'), (3, 'c'), (4, 'd'), (5, 'e')]
>>> foo[6] = 'f'
>>> foo
MaxSizeOrderedDict([(2, 'b'), (3, 'c'), (4, 'd'), (5, 'e'), (6, 'f')])
>>> list(foo.items())
[(2, 'b'), (3, 'c'), (4, 'd'), (5, 'e'), (6, 'f')]
>>> foo[7] = 'g'
>>> foo
MaxSizeOrderedDict([(3, 'c'), (4, 'd'), (5, 'e'), (6, 'f'), (7, 'g')])
>>> list(foo.items())
[(3, 'c'), (4, 'd'), (5, 'e'), (6, 'f'), (7, 'g')]
"""
# Kindly stolen from: https://stackoverflow.com/a/49274421/947511
def __init__(self, *args, max=0, **kwargs):
Expand Down
Loading
Loading