Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit89abe7e

Browse files
oschwaldclaude
andcommitted
Modernize setup.py for Python 3.10+
- Replace sys.exc_info() with modern exception handling using 'from' clause- Use text mode when opening files instead of binary mode with manual decode- Update BuildFailed to accept exception parameter for proper chainingThese are internal improvements with no user-visible changes.🤖 Generated with [Claude Code](https://claude.com/claude-code)Co-Authored-By: Claude <noreply@anthropic.com>
1 parent29b4f3c commit89abe7e

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

‎setup.py‎

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,9 @@
6565

6666

6767
classBuildFailed(Exception):
68-
def__init__(self)->None:
69-
self.cause=sys.exc_info()[1]
68+
def__init__(self,cause:Exception)->None:
69+
super().__init__()
70+
self.cause=cause
7071

7172

7273
classve_build_ext(build_ext):
@@ -75,18 +76,18 @@ class ve_build_ext(build_ext):
7576
defrun(self)->None:
7677
try:
7778
build_ext.run(self)
78-
exceptPlatformError:
79-
raiseBuildFailed
79+
exceptPlatformErrorasex:
80+
raiseBuildFailed(ex)fromex
8081

8182
defbuild_extension(self,ext)->None:
8283
try:
8384
build_ext.build_extension(self,ext)
84-
exceptext_errors:
85-
raiseBuildFailed
86-
exceptValueError:
85+
exceptext_errorsasex:
86+
raiseBuildFailed(ex)fromex
87+
exceptValueErrorasex:
8788
# this can happen on Windows 64 bit, see Python issue 7511
88-
if"'path'"instr(sys.exc_info()[1]):
89-
raiseBuildFailed
89+
if"'path'"instr(ex):
90+
raiseBuildFailed(ex)fromex
9091
raise
9192

9293

@@ -95,11 +96,11 @@ def build_extension(self, ext) -> None:
9596

9697
ROOT=os.path.dirname(__file__)
9798

98-
withopen(os.path.join(ROOT,"README.rst"),"rb")asfd:
99-
README=fd.read().decode("utf8")
99+
withopen(os.path.join(ROOT,"README.rst"),encoding="utf-8")asfd:
100+
README=fd.read()
100101

101-
withopen(os.path.join(ROOT,"maxminddb","__init__.py"),"rb")asfd:
102-
maxminddb_text=fd.read().decode("utf8")
102+
withopen(os.path.join(ROOT,"maxminddb","__init__.py"),encoding="utf-8")asfd:
103+
maxminddb_text=fd.read()
103104
VERSION= (
104105
re.compile(r".*__version__ = \"(.*?)\"",re.DOTALL)
105106
.match(maxminddb_text)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp