Skip to content

Commit

Permalink
Merge pull request #87 from Pylons/py312
Browse files Browse the repository at this point in the history
support python 3.12
  • Loading branch information
mmerickel committed Jan 26, 2024
2 parents 3d8c2a3 + c3afd56 commit 79c43b9
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 8 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "pypy-3.8"
os:
- "ubuntu-latest"
Expand Down
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
unreleased
==========

- Add support for Python 3.12.

- Fix a blocking issue when shutting down on Windows.

- Fix a broken socket that sometimes occurs when reloading due to sockets being
Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ classifiers =
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12
Programming Language :: Python :: Implementation :: CPython
Programming Language :: Python :: Implementation :: PyPy

Expand Down
6 changes: 6 additions & 0 deletions src/hupper/ipc.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ class Connection(object):

_packet_len = struct.Struct('Q')

send_lock = None
reader_thread = None
on_recv = lambda _: None

def __init__(self, r_fd, w_fd):
self.r_fd = r_fd
self.w_fd = w_fd
Expand Down Expand Up @@ -142,6 +146,8 @@ def close(self):

close_fd(w_fd)
close_fd(r_fd)
if self.reader_thread:
self.reader_thread.join()

def _recv_packet(self):
buf = io.BytesIO()
Expand Down
11 changes: 6 additions & 5 deletions src/hupper/watchman.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ def join(self):
finally:
self._close_sock()

def stop(self):
self.enabled = False
self._close_sock()

def run(self):
while self.enabled:
try:
Expand Down Expand Up @@ -138,10 +142,6 @@ def _is_unilateral(self, result):
return True
return False

def stop(self):
self.enabled = False
self._close_sock()

def _close_sock(self):
if self._sock:
try:
Expand Down Expand Up @@ -194,7 +194,8 @@ def _readline(self):
b = self._sock.recv(4096)
if not b:
self.logger.error(
'Lost connection to watchman. No longer watching for changes.'
'Lost connection to watchman. No longer watching for'
' changes.'
)
self.stop()
raise socket.timeout
Expand Down
2 changes: 0 additions & 2 deletions tests/test_ipc.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ def echo(pipe):
pipe.send(msg)
msg = q.get()
pipe.close()
pipe.reader_thread.join()


def test_ipc_close():
Expand All @@ -31,6 +30,5 @@ def test_ipc_close():
assert c1_q.get() == "hello world"

c1.close()
c1.reader_thread.join()
finally:
proc.terminate()
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tox]
envlist =
lint,
py37,py38,py39,py310,py311,pypy3,
py37,py38,py39,py310,py311,py312,pypy3,
docs,coverage

isolated_build = true
Expand Down

0 comments on commit 79c43b9

Please sign in to comment.