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

Skip to content

Commit 791dc2f

Browse files
committed
compile _bytesio and _stringio into the binary and initalize stdio before site fixing #3279
Reviewer: Alexandre Vassalotti
1 parent a741ebf commit 791dc2f

4 files changed

Lines changed: 9 additions & 5 deletions

File tree

Misc/NEWS

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ What's New in Python 3.0 release candidate 1
1212
Core and Builtins
1313
-----------------
1414

15+
- Issue #3279: Importing site at interpreter was failing silently because the
16+
site module uses the open builtin which was not initialized at the time.
17+
1518
- Issue #3660: Corrected a reference leak in str.encode() when the encoder
1619
does not return a bytes object.
1720

@@ -125,6 +128,8 @@ Extension Modules
125128
update this code in Python 3.0 by hand. Update the 2.6 one and then
126129
do "2to3".
127130

131+
- The _bytesio and _stringio modules are now compiled into the python binary.
132+
128133
Tools/Demos
129134
-----------
130135

Modules/Setup.dist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ _sre _sre.c # Fredrik Lundh's new regular expressions
113113
_codecs _codecsmodule.c # access to the builtin codecs and codec registry
114114
_fileio _fileio.c # Standard I/O baseline
115115
_weakref _weakref.c # weak references
116+
_bytesio _bytesio.c # For Lib/io.py
117+
_stringio _stringio.c # For Lib/io.py
116118

117119
# The zipimport module is always imported at startup. Having it as a
118120
# builtin module avoids some bootstrapping problems and reduces overhead.

Python/pythonrun.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,11 +239,11 @@ Py_InitializeEx(int install_sigs)
239239
}
240240

241241
initmain(); /* Module __main__ */
242-
if (!Py_NoSiteFlag)
243-
initsite(); /* Module site */
244242
if (initstdio() < 0)
245243
Py_FatalError(
246244
"Py_Initialize: can't initialize sys standard streams");
245+
if (!Py_NoSiteFlag)
246+
initsite(); /* Module site */
247247

248248
/* auto-thread-state API, if available */
249249
#ifdef WITH_THREAD

setup.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -439,9 +439,6 @@ def detect_modules(self):
439439
exts.append( Extension('operator', ['operator.c']) )
440440
# _functools
441441
exts.append( Extension("_functools", ["_functoolsmodule.c"]) )
442-
# Memory-based IO accelerator modules
443-
exts.append( Extension("_bytesio", ["_bytesio.c"]) )
444-
exts.append( Extension("_stringio", ["_stringio.c"]) )
445442
# C-optimized pickle replacement
446443
exts.append( Extension("_pickle", ["_pickle.c"]) )
447444
# atexit

0 commit comments

Comments
 (0)