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

Skip to content

Commit 0063958

Browse files
committed
Minimum fixes to make freeze.py do something useful.
1 parent bf76ce1 commit 0063958

2 files changed

Lines changed: 7 additions & 8 deletions

File tree

Tools/freeze/freeze.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ def main():
201201

202202
# modules that are imported by the Python runtime
203203
implicits = []
204-
for module in ('site', 'warnings',):
204+
for module in ('site', 'warnings', 'encodings.utf_8', 'encodings.latin_1'):
205205
if module not in exclude:
206206
implicits.append(module)
207207

Tools/freeze/makeconfig.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,30 @@
33

44
# Write the config.c file
55

6-
never = ['marshal', '__main__', 'builtins', 'sys', 'exceptions', '_warnings']
6+
never = ['marshal', 'imp', '_ast', '__main__', 'builtins',
7+
'sys', 'gc', '_warnings']
78

89
def makeconfig(infp, outfp, modules, with_ifdef=0):
910
m1 = re.compile('-- ADDMODULE MARKER 1 --')
1011
m2 = re.compile('-- ADDMODULE MARKER 2 --')
11-
while 1:
12-
line = infp.readline()
13-
if not line: break
12+
for line in infp:
1413
outfp.write(line)
1514
if m1 and m1.search(line):
1615
m1 = None
1716
for mod in modules:
1817
if mod in never:
1918
continue
2019
if with_ifdef:
21-
outfp.write("#ifndef init%s\n"%mod)
22-
outfp.write('extern void init%s(void);\n' % mod)
20+
outfp.write("#ifndef PyInit_%s\n"%mod)
21+
outfp.write('extern PyObject* PyInit_%s(void);\n' % mod)
2322
if with_ifdef:
2423
outfp.write("#endif\n")
2524
elif m2 and m2.search(line):
2625
m2 = None
2726
for mod in modules:
2827
if mod in never:
2928
continue
30-
outfp.write('\t{"%s", init%s},\n' %
29+
outfp.write('\t{"%s", PyInit_%s},\n' %
3130
(mod, mod))
3231
if m1:
3332
sys.stderr.write('MARKER 1 never found\n')

0 commit comments

Comments
 (0)