Skip to content

Commit

Permalink
sanic-orggh-2985: Fixed mixins.startup.serve UnboundLocalError.
Browse files Browse the repository at this point in the history
  • Loading branch information
pygeek committed Jul 31, 2024
1 parent da1c646 commit 0d7b2ae
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
3 changes: 2 additions & 1 deletion sanic/mixins/startup.py
Original file line number Diff line number Diff line change
Expand Up @@ -1033,6 +1033,7 @@ def serve(

socks = []
sync_manager = Manager()
worker_state: Mapping[str, Any] = {"state": "NONE"}
setup_ext(primary)
exit_code = 0
try:
Expand All @@ -1056,7 +1057,7 @@ def serve(
]
primary_server_info.settings["run_multiple"] = True
monitor_sub, monitor_pub = Pipe(True)
worker_state: Mapping[str, Any] = sync_manager.dict()
worker_state = sync_manager.dict()
kwargs: Dict[str, Any] = {
**primary_server_info.settings,
"monitor_publisher": monitor_pub,
Expand Down
9 changes: 7 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Sanic
"""

import codecs
import os
import re
Expand Down Expand Up @@ -59,7 +60,9 @@ def str_to_bool(val: str) -> bool:

with open_local(["sanic", "__version__.py"], encoding="latin1") as fp:
try:
version = re.findall(r"^__version__ = \"([^']+)\"\r?$", fp.read(), re.M)[0]
version = re.findall(
r"^__version__ = \"([^']+)\"\r?$", fp.read(), re.M
)[0]
except IndexError:
raise RuntimeError("Unable to determine version.")

Expand Down Expand Up @@ -94,7 +97,9 @@ def str_to_bool(val: str) -> bool:
"entry_points": {"console_scripts": ["sanic = sanic.__main__:main"]},
}

env_dependency = '; sys_platform != "win32" ' 'and implementation_name == "cpython"'
env_dependency = (
'; sys_platform != "win32" ' 'and implementation_name == "cpython"'
)
ujson = "ujson>=1.35" + env_dependency
uvloop = "uvloop>=0.15.0" + env_dependency
types_ujson = "types-ujson" + env_dependency
Expand Down

0 comments on commit 0d7b2ae

Please sign in to comment.