mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Remove the exceptions builtin module, all the exceptions are already builtin.
This commit is contained in:
parent
f543348fff
commit
2633c69fae
15 changed files with 34 additions and 66 deletions
|
@ -294,20 +294,20 @@ class StructureTestCase(unittest.TestCase):
|
||||||
# In Python 2.5, Exception is a new-style class, and the repr changed
|
# In Python 2.5, Exception is a new-style class, and the repr changed
|
||||||
if issubclass(Exception, object):
|
if issubclass(Exception, object):
|
||||||
self.failUnlessEqual(msg,
|
self.failUnlessEqual(msg,
|
||||||
"(Phone) <type 'exceptions.TypeError'>: "
|
"(Phone) <type 'TypeError'>: "
|
||||||
"expected string or Unicode object, int found")
|
"expected string or Unicode object, int found")
|
||||||
else:
|
else:
|
||||||
self.failUnlessEqual(msg,
|
self.failUnlessEqual(msg,
|
||||||
"(Phone) exceptions.TypeError: "
|
"(Phone) TypeError: "
|
||||||
"expected string or Unicode object, int found")
|
"expected string or Unicode object, int found")
|
||||||
|
|
||||||
cls, msg = self.get_except(Person, "Someone", ("a", "b", "c"))
|
cls, msg = self.get_except(Person, "Someone", ("a", "b", "c"))
|
||||||
self.failUnlessEqual(cls, RuntimeError)
|
self.failUnlessEqual(cls, RuntimeError)
|
||||||
if issubclass(Exception, object):
|
if issubclass(Exception, object):
|
||||||
self.failUnlessEqual(msg,
|
self.failUnlessEqual(msg,
|
||||||
"(Phone) <type 'exceptions.ValueError'>: too many initializers")
|
"(Phone) <type 'ValueError'>: too many initializers")
|
||||||
else:
|
else:
|
||||||
self.failUnlessEqual(msg, "(Phone) exceptions.ValueError: too many initializers")
|
self.failUnlessEqual(msg, "(Phone) ValueError: too many initializers")
|
||||||
|
|
||||||
|
|
||||||
def get_except(self, func, *args):
|
def get_except(self, func, *args):
|
||||||
|
|
|
@ -488,12 +488,12 @@ INFO:a.b.c.d:Info 5
|
||||||
-- log_test4 begin ---------------------------------------------------
|
-- log_test4 begin ---------------------------------------------------
|
||||||
config0: ok.
|
config0: ok.
|
||||||
config1: ok.
|
config1: ok.
|
||||||
config2: <type 'exceptions.AttributeError'>
|
config2: <type 'AttributeError'>
|
||||||
config3: <type 'exceptions.KeyError'>
|
config3: <type 'KeyError'>
|
||||||
-- log_test4 end ---------------------------------------------------
|
-- log_test4 end ---------------------------------------------------
|
||||||
-- log_test5 begin ---------------------------------------------------
|
-- log_test5 begin ---------------------------------------------------
|
||||||
ERROR:root:just testing
|
ERROR:root:just testing
|
||||||
<type 'exceptions.KeyError'>... Don't panic!
|
<type 'KeyError'>... Don't panic!
|
||||||
-- log_test5 end ---------------------------------------------------
|
-- log_test5 end ---------------------------------------------------
|
||||||
-- logrecv output begin ---------------------------------------------------
|
-- logrecv output begin ---------------------------------------------------
|
||||||
ERR -> CRITICAL: Message 0 (via logrecv.tcp.ERR)
|
ERR -> CRITICAL: Message 0 (via logrecv.tcp.ERR)
|
||||||
|
|
|
@ -15,15 +15,6 @@ from test.test_support import TESTFN, unlink, run_unittest
|
||||||
|
|
||||||
class ExceptionTests(unittest.TestCase):
|
class ExceptionTests(unittest.TestCase):
|
||||||
|
|
||||||
def testReload(self):
|
|
||||||
# Reloading the built-in exceptions module failed prior to Py2.2, while it
|
|
||||||
# should act the same as reloading built-in sys.
|
|
||||||
try:
|
|
||||||
import exceptions
|
|
||||||
reload(exceptions)
|
|
||||||
except ImportError as e:
|
|
||||||
self.fail("reloading exceptions: %s" % e)
|
|
||||||
|
|
||||||
def raise_catch(self, exc, excname):
|
def raise_catch(self, exc, excname):
|
||||||
try:
|
try:
|
||||||
raise exc, "spam"
|
raise exc, "spam"
|
||||||
|
@ -289,7 +280,7 @@ class ExceptionTests(unittest.TestCase):
|
||||||
if type(e) is not exc:
|
if type(e) is not exc:
|
||||||
raise
|
raise
|
||||||
# Verify module name
|
# Verify module name
|
||||||
self.assertEquals(type(e).__module__, 'exceptions')
|
self.assertEquals(type(e).__module__, '__builtin__')
|
||||||
# Verify no ref leaks in Exc_str()
|
# Verify no ref leaks in Exc_str()
|
||||||
s = str(e)
|
s = str(e)
|
||||||
for checkArgName in expected:
|
for checkArgName in expected:
|
||||||
|
|
|
@ -1691,7 +1691,7 @@ Our ill-behaved code should be invoked during GC:
|
||||||
>>> g.next()
|
>>> g.next()
|
||||||
>>> del g
|
>>> del g
|
||||||
>>> sys.stderr.getvalue().startswith(
|
>>> sys.stderr.getvalue().startswith(
|
||||||
... "Exception exceptions.RuntimeError: 'generator ignored GeneratorExit' in "
|
... "Exception RuntimeError: 'generator ignored GeneratorExit' in "
|
||||||
... )
|
... )
|
||||||
True
|
True
|
||||||
>>> sys.stderr = old
|
>>> sys.stderr = old
|
||||||
|
@ -1808,7 +1808,7 @@ to test.
|
||||||
... del l
|
... del l
|
||||||
... err = sys.stderr.getvalue().strip()
|
... err = sys.stderr.getvalue().strip()
|
||||||
... err.startswith(
|
... err.startswith(
|
||||||
... "Exception exceptions.RuntimeError: RuntimeError() in <"
|
... "Exception RuntimeError: RuntimeError() in <"
|
||||||
... )
|
... )
|
||||||
... err.endswith("> ignored")
|
... err.endswith("> ignored")
|
||||||
... len(err.splitlines())
|
... len(err.splitlines())
|
||||||
|
|
|
@ -87,7 +87,7 @@ absolute_import_test = [
|
||||||
"a.module",
|
"a.module",
|
||||||
["a", "a.module",
|
["a", "a.module",
|
||||||
"b", "b.x", "b.y", "b.z",
|
"b", "b.x", "b.y", "b.z",
|
||||||
"__future__", "sys", "exceptions"],
|
"__future__", "sys", "gc"],
|
||||||
["blahblah", "z"], [],
|
["blahblah", "z"], [],
|
||||||
"""\
|
"""\
|
||||||
mymodule.py
|
mymodule.py
|
||||||
|
@ -96,11 +96,11 @@ a/module.py
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
import sys # sys
|
import sys # sys
|
||||||
import blahblah # fails
|
import blahblah # fails
|
||||||
import exceptions # exceptions
|
import gc # gc
|
||||||
import b.x # b.x
|
import b.x # b.x
|
||||||
from b import y # b.y
|
from b import y # b.y
|
||||||
from b.z import * # b.z.*
|
from b.z import * # b.z.*
|
||||||
a/exceptions.py
|
a/gc.py
|
||||||
a/sys.py
|
a/sys.py
|
||||||
import mymodule
|
import mymodule
|
||||||
a/b/__init__.py
|
a/b/__init__.py
|
||||||
|
@ -123,7 +123,7 @@ relative_import_test = [
|
||||||
"a.b.c", "a.b.c.moduleC",
|
"a.b.c", "a.b.c.moduleC",
|
||||||
"a.b.c.d", "a.b.c.e",
|
"a.b.c.d", "a.b.c.e",
|
||||||
"a.b.x",
|
"a.b.x",
|
||||||
"exceptions"],
|
"gc"],
|
||||||
[], [],
|
[], [],
|
||||||
"""\
|
"""\
|
||||||
mymodule.py
|
mymodule.py
|
||||||
|
@ -131,8 +131,8 @@ a/__init__.py
|
||||||
from .b import y, z # a.b.y, a.b.z
|
from .b import y, z # a.b.y, a.b.z
|
||||||
a/module.py
|
a/module.py
|
||||||
from __future__ import absolute_import # __future__
|
from __future__ import absolute_import # __future__
|
||||||
import exceptions # exceptions
|
import gc # gc
|
||||||
a/exceptions.py
|
a/gc.py
|
||||||
a/sys.py
|
a/sys.py
|
||||||
a/b/__init__.py
|
a/b/__init__.py
|
||||||
from ..b import x # a.b.x
|
from ..b import x # a.b.x
|
||||||
|
@ -170,7 +170,7 @@ a/__init__.py
|
||||||
a/another.py
|
a/another.py
|
||||||
a/module.py
|
a/module.py
|
||||||
from .b import y, z # a.b.y, a.b.z
|
from .b import y, z # a.b.y, a.b.z
|
||||||
a/exceptions.py
|
a/gc.py
|
||||||
a/sys.py
|
a/sys.py
|
||||||
a/b/__init__.py
|
a/b/__init__.py
|
||||||
from .c import moduleC # a.b.c.moduleC
|
from .c import moduleC # a.b.c.moduleC
|
||||||
|
|
|
@ -104,9 +104,9 @@ class ReferencesTestCase(TestBase):
|
||||||
def check(proxy):
|
def check(proxy):
|
||||||
proxy.bar
|
proxy.bar
|
||||||
|
|
||||||
self.assertRaises(weakref.ReferenceError, check, ref1)
|
self.assertRaises(ReferenceError, check, ref1)
|
||||||
self.assertRaises(weakref.ReferenceError, check, ref2)
|
self.assertRaises(ReferenceError, check, ref2)
|
||||||
self.assertRaises(weakref.ReferenceError, bool, weakref.proxy(C()))
|
self.assertRaises(ReferenceError, bool, weakref.proxy(C()))
|
||||||
self.assert_(self.cbcalled == 2)
|
self.assert_(self.cbcalled == 2)
|
||||||
|
|
||||||
def check_basic_ref(self, factory):
|
def check_basic_ref(self, factory):
|
||||||
|
|
|
@ -169,7 +169,7 @@ def format_exception_only(etype, value):
|
||||||
|
|
||||||
stype = etype.__name__
|
stype = etype.__name__
|
||||||
smod = etype.__module__
|
smod = etype.__module__
|
||||||
if smod not in ("exceptions", "__main__", "__builtin__"):
|
if smod not in ("__main__", "__builtin__"):
|
||||||
stype = smod + '.' + stype
|
stype = smod + '.' + stype
|
||||||
|
|
||||||
if not issubclass(etype, SyntaxError):
|
if not issubclass(etype, SyntaxError):
|
||||||
|
|
|
@ -20,8 +20,6 @@ from _weakref import (
|
||||||
ProxyType,
|
ProxyType,
|
||||||
ReferenceType)
|
ReferenceType)
|
||||||
|
|
||||||
from exceptions import ReferenceError
|
|
||||||
|
|
||||||
|
|
||||||
ProxyTypes = (ProxyType, CallableProxyType)
|
ProxyTypes = (ProxyType, CallableProxyType)
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,8 @@ TO DO
|
||||||
Core and Builtins
|
Core and Builtins
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
|
- Remove the exceptions module, all the exceptions are already builtin.
|
||||||
|
|
||||||
- input() becomes raw_input(): the name input() now implements the
|
- input() becomes raw_input(): the name input() now implements the
|
||||||
functionality formerly known as raw_input(); the name raw_input()
|
functionality formerly known as raw_input(); the name raw_input()
|
||||||
is no longer defined.
|
is no longer defined.
|
||||||
|
|
|
@ -10,20 +10,11 @@
|
||||||
#include "osdefs.h"
|
#include "osdefs.h"
|
||||||
|
|
||||||
#define MAKE_IT_NONE(x) (x) = Py_None; Py_INCREF(Py_None);
|
#define MAKE_IT_NONE(x) (x) = Py_None; Py_INCREF(Py_None);
|
||||||
#define EXC_MODULE_NAME "exceptions."
|
|
||||||
|
|
||||||
/* NOTE: If the exception class hierarchy changes, don't forget to update
|
/* NOTE: If the exception class hierarchy changes, don't forget to update
|
||||||
* Lib/test/exception_hierarchy.txt
|
* Lib/test/exception_hierarchy.txt
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PyDoc_STRVAR(exceptions_doc, "Python's standard exception class hierarchy.\n\
|
|
||||||
\n\
|
|
||||||
Exceptions found here are defined both in the exceptions module and the\n\
|
|
||||||
built-in namespace. It is recommended that user-defined exceptions\n\
|
|
||||||
inherit from Exception. See the documentation for the exception\n\
|
|
||||||
inheritance hierarchy.\n\
|
|
||||||
");
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* BaseException
|
* BaseException
|
||||||
*/
|
*/
|
||||||
|
@ -282,7 +273,7 @@ static PyGetSetDef BaseException_getset[] = {
|
||||||
static PyTypeObject _PyExc_BaseException = {
|
static PyTypeObject _PyExc_BaseException = {
|
||||||
PyObject_HEAD_INIT(NULL)
|
PyObject_HEAD_INIT(NULL)
|
||||||
0, /*ob_size*/
|
0, /*ob_size*/
|
||||||
EXC_MODULE_NAME "BaseException", /*tp_name*/
|
"BaseException", /*tp_name*/
|
||||||
sizeof(PyBaseExceptionObject), /*tp_basicsize*/
|
sizeof(PyBaseExceptionObject), /*tp_basicsize*/
|
||||||
0, /*tp_itemsize*/
|
0, /*tp_itemsize*/
|
||||||
(destructor)BaseException_dealloc, /*tp_dealloc*/
|
(destructor)BaseException_dealloc, /*tp_dealloc*/
|
||||||
|
@ -333,7 +324,7 @@ PyObject *PyExc_BaseException = (PyObject *)&_PyExc_BaseException;
|
||||||
static PyTypeObject _PyExc_ ## EXCNAME = { \
|
static PyTypeObject _PyExc_ ## EXCNAME = { \
|
||||||
PyObject_HEAD_INIT(NULL) \
|
PyObject_HEAD_INIT(NULL) \
|
||||||
0, \
|
0, \
|
||||||
EXC_MODULE_NAME # EXCNAME, \
|
# EXCNAME, \
|
||||||
sizeof(PyBaseExceptionObject), \
|
sizeof(PyBaseExceptionObject), \
|
||||||
0, (destructor)BaseException_dealloc, 0, 0, 0, 0, 0, 0, 0, \
|
0, (destructor)BaseException_dealloc, 0, 0, 0, 0, 0, 0, 0, \
|
||||||
0, 0, 0, 0, 0, 0, 0, \
|
0, 0, 0, 0, 0, 0, 0, \
|
||||||
|
@ -349,7 +340,7 @@ PyObject *PyExc_ ## EXCNAME = (PyObject *)&_PyExc_ ## EXCNAME
|
||||||
static PyTypeObject _PyExc_ ## EXCNAME = { \
|
static PyTypeObject _PyExc_ ## EXCNAME = { \
|
||||||
PyObject_HEAD_INIT(NULL) \
|
PyObject_HEAD_INIT(NULL) \
|
||||||
0, \
|
0, \
|
||||||
EXC_MODULE_NAME # EXCNAME, \
|
# EXCNAME, \
|
||||||
sizeof(Py ## EXCSTORE ## Object), \
|
sizeof(Py ## EXCSTORE ## Object), \
|
||||||
0, (destructor)EXCSTORE ## _dealloc, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
|
0, (destructor)EXCSTORE ## _dealloc, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
|
||||||
0, 0, 0, 0, 0, \
|
0, 0, 0, 0, 0, \
|
||||||
|
@ -365,7 +356,7 @@ PyObject *PyExc_ ## EXCNAME = (PyObject *)&_PyExc_ ## EXCNAME
|
||||||
static PyTypeObject _PyExc_ ## EXCNAME = { \
|
static PyTypeObject _PyExc_ ## EXCNAME = { \
|
||||||
PyObject_HEAD_INIT(NULL) \
|
PyObject_HEAD_INIT(NULL) \
|
||||||
0, \
|
0, \
|
||||||
EXC_MODULE_NAME # EXCNAME, \
|
# EXCNAME, \
|
||||||
sizeof(Py ## EXCSTORE ## Object), 0, \
|
sizeof(Py ## EXCSTORE ## Object), 0, \
|
||||||
(destructor)EXCSTORE ## _dealloc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
|
(destructor)EXCSTORE ## _dealloc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
|
||||||
(reprfunc)EXCSTR, 0, 0, 0, \
|
(reprfunc)EXCSTR, 0, 0, 0, \
|
||||||
|
@ -1632,7 +1623,7 @@ UnicodeEncodeError_str(PyObject *self)
|
||||||
static PyTypeObject _PyExc_UnicodeEncodeError = {
|
static PyTypeObject _PyExc_UnicodeEncodeError = {
|
||||||
PyObject_HEAD_INIT(NULL)
|
PyObject_HEAD_INIT(NULL)
|
||||||
0,
|
0,
|
||||||
EXC_MODULE_NAME "UnicodeEncodeError",
|
"UnicodeEncodeError",
|
||||||
sizeof(PyUnicodeErrorObject), 0,
|
sizeof(PyUnicodeErrorObject), 0,
|
||||||
(destructor)UnicodeError_dealloc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
(destructor)UnicodeError_dealloc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
(reprfunc)UnicodeEncodeError_str, 0, 0, 0,
|
(reprfunc)UnicodeEncodeError_str, 0, 0, 0,
|
||||||
|
@ -1704,7 +1695,7 @@ UnicodeDecodeError_str(PyObject *self)
|
||||||
static PyTypeObject _PyExc_UnicodeDecodeError = {
|
static PyTypeObject _PyExc_UnicodeDecodeError = {
|
||||||
PyObject_HEAD_INIT(NULL)
|
PyObject_HEAD_INIT(NULL)
|
||||||
0,
|
0,
|
||||||
EXC_MODULE_NAME "UnicodeDecodeError",
|
"UnicodeDecodeError",
|
||||||
sizeof(PyUnicodeErrorObject), 0,
|
sizeof(PyUnicodeErrorObject), 0,
|
||||||
(destructor)UnicodeError_dealloc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
(destructor)UnicodeError_dealloc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
(reprfunc)UnicodeDecodeError_str, 0, 0, 0,
|
(reprfunc)UnicodeDecodeError_str, 0, 0, 0,
|
||||||
|
@ -1802,7 +1793,7 @@ UnicodeTranslateError_str(PyObject *self)
|
||||||
static PyTypeObject _PyExc_UnicodeTranslateError = {
|
static PyTypeObject _PyExc_UnicodeTranslateError = {
|
||||||
PyObject_HEAD_INIT(NULL)
|
PyObject_HEAD_INIT(NULL)
|
||||||
0,
|
0,
|
||||||
EXC_MODULE_NAME "UnicodeTranslateError",
|
"UnicodeTranslateError",
|
||||||
sizeof(PyUnicodeErrorObject), 0,
|
sizeof(PyUnicodeErrorObject), 0,
|
||||||
(destructor)UnicodeError_dealloc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
(destructor)UnicodeError_dealloc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
(reprfunc)UnicodeTranslateError_str, 0, 0, 0,
|
(reprfunc)UnicodeTranslateError_str, 0, 0, 0,
|
||||||
|
@ -1956,17 +1947,10 @@ SimpleExtendsException(PyExc_Warning, UnicodeWarning,
|
||||||
*/
|
*/
|
||||||
PyObject *PyExc_MemoryErrorInst=NULL;
|
PyObject *PyExc_MemoryErrorInst=NULL;
|
||||||
|
|
||||||
/* module global functions */
|
|
||||||
static PyMethodDef functions[] = {
|
|
||||||
/* Sentinel */
|
|
||||||
{NULL, NULL}
|
|
||||||
};
|
|
||||||
|
|
||||||
#define PRE_INIT(TYPE) if (PyType_Ready(&_PyExc_ ## TYPE) < 0) \
|
#define PRE_INIT(TYPE) if (PyType_Ready(&_PyExc_ ## TYPE) < 0) \
|
||||||
Py_FatalError("exceptions bootstrapping error.");
|
Py_FatalError("exceptions bootstrapping error.");
|
||||||
|
|
||||||
#define POST_INIT(TYPE) Py_INCREF(PyExc_ ## TYPE); \
|
#define POST_INIT(TYPE) Py_INCREF(PyExc_ ## TYPE); \
|
||||||
PyModule_AddObject(m, # TYPE, PyExc_ ## TYPE); \
|
|
||||||
if (PyDict_SetItemString(bdict, # TYPE, PyExc_ ## TYPE)) \
|
if (PyDict_SetItemString(bdict, # TYPE, PyExc_ ## TYPE)) \
|
||||||
Py_FatalError("Module dictionary insertion problem.");
|
Py_FatalError("Module dictionary insertion problem.");
|
||||||
|
|
||||||
|
@ -1996,7 +1980,7 @@ InvalidParameterHandler(
|
||||||
PyMODINIT_FUNC
|
PyMODINIT_FUNC
|
||||||
_PyExc_Init(void)
|
_PyExc_Init(void)
|
||||||
{
|
{
|
||||||
PyObject *m, *bltinmod, *bdict;
|
PyObject *bltinmod, *bdict;
|
||||||
|
|
||||||
PRE_INIT(BaseException)
|
PRE_INIT(BaseException)
|
||||||
PRE_INIT(Exception)
|
PRE_INIT(Exception)
|
||||||
|
@ -2053,10 +2037,6 @@ _PyExc_Init(void)
|
||||||
PRE_INIT(ImportWarning)
|
PRE_INIT(ImportWarning)
|
||||||
PRE_INIT(UnicodeWarning)
|
PRE_INIT(UnicodeWarning)
|
||||||
|
|
||||||
m = Py_InitModule4("exceptions", functions, exceptions_doc,
|
|
||||||
(PyObject *)NULL, PYTHON_API_VERSION);
|
|
||||||
if (m == NULL) return;
|
|
||||||
|
|
||||||
bltinmod = PyImport_ImportModule("__builtin__");
|
bltinmod = PyImport_ImportModule("__builtin__");
|
||||||
if (bltinmod == NULL)
|
if (bltinmod == NULL)
|
||||||
Py_FatalError("exceptions bootstrapping error.");
|
Py_FatalError("exceptions bootstrapping error.");
|
||||||
|
|
|
@ -161,7 +161,6 @@ struct _inittab _PyImport_Inittab[] = {
|
||||||
{"__main__", NULL},
|
{"__main__", NULL},
|
||||||
{"__builtin__", NULL},
|
{"__builtin__", NULL},
|
||||||
{"sys", NULL},
|
{"sys", NULL},
|
||||||
{"exceptions", NULL},
|
|
||||||
|
|
||||||
{"_types", init_types},
|
{"_types", init_types},
|
||||||
|
|
||||||
|
|
|
@ -172,7 +172,6 @@ struct _inittab _PyImport_Inittab[] = {
|
||||||
{"__main__", NULL},
|
{"__main__", NULL},
|
||||||
{"__builtin__", NULL},
|
{"__builtin__", NULL},
|
||||||
{"sys", NULL},
|
{"sys", NULL},
|
||||||
{"exceptions", NULL},
|
|
||||||
|
|
||||||
/* This lives in gcmodule.c */
|
/* This lives in gcmodule.c */
|
||||||
{"gc", initgc},
|
{"gc", initgc},
|
||||||
|
|
|
@ -612,7 +612,8 @@ PyErr_WriteUnraisable(PyObject *obj)
|
||||||
PyFile_WriteString("<unknown>", f);
|
PyFile_WriteString("<unknown>", f);
|
||||||
else {
|
else {
|
||||||
char* modstr = PyString_AsString(moduleName);
|
char* modstr = PyString_AsString(moduleName);
|
||||||
if (modstr)
|
if (modstr &&
|
||||||
|
strcmp(modstr, "__builtin__") != 0)
|
||||||
{
|
{
|
||||||
PyFile_WriteString(modstr, f);
|
PyFile_WriteString(modstr, f);
|
||||||
PyFile_WriteString(".", f);
|
PyFile_WriteString(".", f);
|
||||||
|
|
|
@ -221,7 +221,6 @@ Py_InitializeEx(int install_sigs)
|
||||||
|
|
||||||
/* initialize builtin exceptions */
|
/* initialize builtin exceptions */
|
||||||
_PyExc_Init();
|
_PyExc_Init();
|
||||||
_PyImport_FixupExtension("exceptions", "exceptions");
|
|
||||||
|
|
||||||
/* phase 2 of builtins */
|
/* phase 2 of builtins */
|
||||||
_PyImport_FixupExtension("__builtin__", "__builtin__");
|
_PyImport_FixupExtension("__builtin__", "__builtin__");
|
||||||
|
@ -1168,7 +1167,7 @@ PyErr_Display(PyObject *exception, PyObject *value, PyObject *tb)
|
||||||
err = PyFile_WriteString("<unknown>", f);
|
err = PyFile_WriteString("<unknown>", f);
|
||||||
else {
|
else {
|
||||||
char* modstr = PyString_AsString(moduleName);
|
char* modstr = PyString_AsString(moduleName);
|
||||||
if (modstr && strcmp(modstr, "exceptions"))
|
if (modstr && strcmp(modstr, "__builtin__"))
|
||||||
{
|
{
|
||||||
err = PyFile_WriteString(modstr, f);
|
err = PyFile_WriteString(modstr, f);
|
||||||
err += PyFile_WriteString(".", f);
|
err += PyFile_WriteString(".", f);
|
||||||
|
|
|
@ -63,7 +63,6 @@ struct _inittab _PyImport_Inittab[] = {
|
||||||
{"__main__", NULL},
|
{"__main__", NULL},
|
||||||
{"__builtin__", NULL},
|
{"__builtin__", NULL},
|
||||||
{"sys", NULL},
|
{"sys", NULL},
|
||||||
{"exceptions", NULL},
|
|
||||||
|
|
||||||
/* This lives in gcmodule.c */
|
/* This lives in gcmodule.c */
|
||||||
{"gc", initgc},
|
{"gc", initgc},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue