Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from 1 commit
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
Next Next commit
MNT: do not use deprecated load_module method
The load_module method has been deprecated from py34 and will be removed in
py315 [1] (it is already gone on CPython main).

The recommended replacement is exec_module, however the documentation [2]
suggests to use a simpler approach than using the loaders directly and runpy
[3] seemed better than sys.path hacking.

Given that this is a one-line file simply reading the file and parsing it 'by
hand' is an option.

[1] https://docs.python.org/3/library/importlib.html#importlib.abc.Loader.load_module
[2] https://docs.python.org/3/library/importlib.html#importing-a-source-file-directly
[3] https://docs.python.org/3/library/runpy.html#runpy.run_path
  • Loading branch information
tacaswell committed Jan 1, 2026
commit f746928e007c2e2627ba5cbdf9a0d10b37ff334e
7 changes: 2 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,14 @@
from setuptools import setup, Extension
except ImportError:
from distutils.core import setup, Extension
import importlib
import runpy
import glob
import io
import sys


def version():
loader = importlib.machinery.SourceFileLoader(
"hiredis.version", "hiredis/version.py")
module = loader.load_module()
return module.__version__
return runpy.run_path("hiredis/version.py")["__version__"]


def get_sources():
Expand Down
Loading