Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
94f9b869
Commit
94f9b869
authored
Aug 02, 2004
by
Tim Peters
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
"Core" and "C API" news about new semantics for failing imports.
parent
cfd575d3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
1 deletion
+33
-1
Misc/NEWS
Misc/NEWS
+33
-1
No files found.
Misc/NEWS
View file @
94f9b869
...
...
@@ -12,6 +12,26 @@ What's New in Python 2.4 alpha 2?
Core and builtins
-----------------
- When importing a module M raises an exception, Python no longer leaves M
in sys.modules. Before 2.4a2 it did, and a subsequent import of M would
succeed, picking up a module object from sys.modules reflecting as much
of the initialization of M as completed before the exception was raised.
Subsequent imports got no indication that M was in a partially-
initialized state, and the importers could get into arbitrarily bad
trouble as a result (the M they got was in an unintended state,
arbitrarily far removed from M'
s
author
's intent). Now subsequent
imports of M will continue raising exceptions (but if, for example, the
source code for M is edited between import attempts, then perhaps later
attempts will succeed, or raise a different exception).
This can break existing code, but in such cases the code was probably
working before by accident. In the Python source, the only case of
breakage discovered was in a test accidentally relying on a damaged
module remaining in sys.modules. Cases are also known where tests
deliberately provoking import errors remove damaged modules from
sys.modules themselves, and such tests will break now if they do an
unconditional del sys.modules[M].
- u'
%
s
' % obj will now try obj.__unicode__() first and fallback to
obj.__str__() if no __unicode__ method can be found.
...
...
@@ -141,7 +161,7 @@ Library
- Add expansion of default values in help text: the string
"%default" in an option'
s
help
string
is
expanded
to
str
()
of
that
option
's default value, or "none" if no default value.
- Bug #955889: option default values that happen to be strings are
now processed in the same way as values from the command line; this
allows generation of nicer help when using custom types. Can
...
...
@@ -177,6 +197,18 @@ Build
C
API
-----
-
PyImport_ExecCodeModule
()
and
PyImport_ExecCodeModuleEx
():
if
an
error
occurs
while
loading
the
module
,
these
now
delete
the
module
's
entry from sys.modules. All ways of loading modules eventually call
one of these, so this is an error-case change in semantics for all
ways of loading modules. In rare cases, a module loader may wish
to keep a module object in sys.modules despite that the module'
s
code
cannot
be
executed
.
In
such
cases
,
the
module
loader
must
arrange
to
reinsert
the
name
and
module
object
in
sys
.
modules
.
PyImport_ReloadModule
()
has
been
changed
to
reinsert
the
original
module
object
into
sys
.
modules
if
the
module
reload
fails
,
so
that
its
visible
semantics
have
not
changed
.
-
A
large
pile
of
datetime
field
-
extraction
macros
is
now
documented
,
thanks
to
Anthony
Tuininga
(
patch
#
986010
).
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment