Skip to content

Commit 994f2cc

Browse files
author
Release Manager
committed
gh-40888: replace gone in python3.14 FancyURL FancyURL has been long deprecated, since Python 3.3. It's finally gone in 3.14, so we need this to move forward, e.g. on Fedora 43, as reported on [sage-support](https://groups.google.com/g/sage- support/c/12GaUYfAbD0/m/1RcOQypjAwAJ) This will fix #40886 ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - #12345: short description why this is a dependency --> <!-- - #34567: ... --> URL: #40888 Reported by: Dima Pasechnik Reviewer(s): Enrique Manuel Artal Bartolo
2 parents 76ee377 + 7e384c9 commit 994f2cc

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

build/sage_bootstrap/download/transfer.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
log = logging.getLogger()
2121

2222
from sage_bootstrap.stdio import flush
23-
from sage_bootstrap.compat import urllib
23+
import urllib
24+
from urllib.request import build_opener, install_opener, urlretrieve
2425

2526

2627
class ProgressBar(object):
@@ -120,16 +121,17 @@ def error_progress_bar(self):
120121
self.progress_bar.error_stop()
121122

122123
def run(self):
123-
opener = urllib.FancyURLopener()
124+
opener = build_opener()
125+
install_opener(opener)
126+
124127
opener.http_error_default = self.http_error_default
125128
self.start_progress_bar()
126129
try:
127130
if self.progress:
128-
filename, info = opener.retrieve(
129-
self.url, self.destination, self.progress_bar)
131+
urlretrieve(self.url, self.destination, reporthook=self.progress_bar)
130132
else:
131-
filename, info = opener.retrieve(
132-
self.url, self.destination)
133+
urlretrieve(self.url, self.destination)
134+
133135
except IOError as error:
134136
self.error_progress_bar()
135137
log.error(error)

build/sage_bootstrap/uncompress/tar_file.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import stat
2121
import subprocess
2222
import time
23+
import inspect
2324

2425
from io import BytesIO
2526

@@ -96,9 +97,10 @@ def extractall(self, path='.', members=None, **kwargs):
9697
members = [m if isinstance(m, tarfile.TarInfo)
9798
else name_to_member[m]
9899
for m in members]
99-
return super(SageBaseTarFile, self).extractall(path=path,
100-
members=members,
101-
**kwargs)
100+
tfile = super(SageBaseTarFile, self)
101+
if 'filter' in inspect.signature(tfile.extractall).parameters:
102+
kwargs['filter'] = 'fully_trusted'
103+
return tfile.extractall(path=path, members=members, **kwargs)
102104

103105
def extractbytes(self, member):
104106
"""

0 commit comments

Comments
 (0)