Commit Graph

240 Commits

Author SHA1 Message Date
Tim Peters 1cd701732f PyImport_ExecCodeModuleEx(): remove module from sys.modules in error cases.
PyImport_ReloadModule():  restore the module to sys.modules in error cases.
load_package():  semantic-neutral refactoring from an earlier stab at
                 this patch; giving it a common error exit made the code
                 easier to follow, so retaining that part.
_RemoveModule():  new little utility to delete a key from sys.modules.
2004-08-02 03:52:12 +00:00
Tim Peters a7c650934d lock_held() docs: Use True/False instead of 1/0. The LaTeX docs were
already correct, so not changed here.
2004-08-01 23:26:05 +00:00
Tim Peters 86c7d2f220 Trimmed trailing whitespace. 2004-08-01 23:24:21 +00:00
Martin v. Löwis ef82d2fdfe Patch #923098: Share interned strings in marshal. 2004-06-27 16:51:46 +00:00
Thomas Heller 25653242fe Fix a refcount bug in an obscure code corner.
Already backported.
2004-06-07 15:04:10 +00:00
Fred Drake 8759090562 starting to add comments to explain what's here 2004-05-28 20:21:36 +00:00
Jeremy Hylton d4ceb31664 Bump the magic number to avoid sharing bytecode between 2.3 and 2.4.
Revise the long comment that explained details of the magic number
in gory detail.
2004-04-01 02:45:22 +00:00
Armin Rigo 01ab279056 Marshal clean-up (SF patch #873224) 2004-03-26 15:09:27 +00:00
Nicholas Bastin e5662aedef Changed random calls to PyThreadState_Get() to use the macro 2004-03-24 22:22:12 +00:00
Martin v. Löwis 83969eeeeb Decref all if ensure_fromlist fails. Fixes #876533.
Backported to 2.3.
2004-03-23 16:28:13 +00:00
Jeremy Hylton ecd9129c94 Add comment to mollify Tim. 2004-01-02 23:25:32 +00:00
Jack Jansen eddc1449ba Getting rid of all the code inside #ifdef macintosh too. 2003-11-20 01:44:59 +00:00
Walter Dörwald f0dfc7ac5c Fix a bunch of typos in documentation, docstrings and comments.
(From SF patch #810751)
2003-10-20 14:01:56 +00:00
Jason Tishler 6bc06eca70 Bug #794140: cygwin builds do not embed
The embed2.diff patch solves the user's problem by exporting the missing
symbols from the Python core so Python can be embedded in another Cygwin
application (well, at lest vim).
2003-09-04 11:59:50 +00:00
Fred Drake 1e5fc55c4d - fix typo
- there's a weird variable name here (zimpimport), but I'll leave that
  for someone that's familiar with the ZIP import support
2003-07-11 15:01:02 +00:00
Neil Schemenauer 00b0966f20 Don't use the module object setattr when importing submodules. Instead,
operate on the module dictionary directly.  This prevents spurious
depreciation warnings from being raised if a submodule name shadows
a builtin name.
2003-06-16 21:03:07 +00:00
Neal Norwitz a11e4c13b1 SF patch #708201, unchecked return value in import.c by Jason Harper
Will backport.
2003-03-23 14:31:01 +00:00
Neal Norwitz 08ea61ad45 Remove PyArg_ParseTuple() for methods which take no args,
use METH_NOARGS instead
2003-02-17 18:18:00 +00:00
Neal Norwitz 2294c0d4ec Cleanup from patch #683257:
Add missing INCREFs and re-indent returns to be consistent.
 Add \n\ for lines in docstring
 Add a pathetic test
 Add docs
2003-02-12 23:02:21 +00:00
Guido van Rossum c4f4ca91e1 Provide access to the import lock, fixing SF bug #580952. This is
mostly from SF patch #683257, but I had to change unlock_import() to
return an error value to avoid fatal error.

Should this be backported?  The patch requested this, but it's a new
feature.
2003-02-12 21:46:11 +00:00
Jack Jansen 9363dca3f8 MacPython-OS9 specific fix: If there are non-string items on sys.path don't try to intern them. This has the theoretical problem that resource filenames on sys.path cannot be unicode objects, but in practice that shouldn't matter. 2003-01-24 16:15:45 +00:00
Just van Rossum 52e14d640b PEP 302 + zipimport:
- new import hooks in import.c, exposed in the sys module
- new module called 'zipimport'
- various changes to allow bootstrapping from zip files

I hope I didn't break the Windows build (or anything else for that
matter), but then again, it's been sitting on sf long enough...

Regarding the latest discussions on python-dev: zipimport sets
pkg.__path__ as specified in PEP 273, and likewise, sys.path item such as
/path/to/Archive.zip/subdir/ are supported again.
2002-12-30 22:08:05 +00:00
Just van Rossum 8982595870 Backing out patch #642578 in anticipation of final acceptance of PEP 302. 2002-12-25 23:13:34 +00:00
Jack Jansen 72f3b7a5de Added missing casts. 2002-12-13 15:23:10 +00:00
Martin v. Löwis 79acb9edfa Patch #614055: Support OpenVMS. 2002-12-06 12:48:53 +00:00
Just van Rossum 3eb166b49b Slightly improved version of patch #642578: "Expose PyImport_FrozenModules
in imp". This adds two functions to the imp module: get_frozenmodules()
and set_frozenmodules().
2002-11-29 20:47:40 +00:00
Guido van Rossum f689492070 Because MWH changed the bytecode again, moved the magic number *back*
to 62011.  This should get the snake-farm to throw away its old .pyc
files, amongst others.
2002-08-31 15:16:14 +00:00
Michael W. Hudson dd32a91cc0 This is my patch
[ 587993 ] SET_LINENO killer

Remove SET_LINENO.  Tracing is now supported by inspecting co_lnotab.

Many sundry changes to document and adapt to this change.
2002-08-15 14:59:02 +00:00
Martin v. Löwis 6238d2b024 Patch #569753: Remove support for WIN16.
Rename all occurrences of MS_WIN32 to MS_WINDOWS.
2002-06-30 15:26:10 +00:00
Walter Dörwald 3430d70e03 Apply diff2.txt from SF patch http://www.python.org/sf/566999
This patch enhances Python/import.c/find_module() so
that unicode objects found in sys.path will be treated
as legal directory names (The current code ignores
anything that is not a str). The unicode name is
converted to str using Py_FileSystemDefaultEncoding.
2002-06-17 10:43:59 +00:00
Neal Norwitz 7fdcb41131 Fix SF bug # 561858 Assertion with very long lists
Write 4 bytes for co_stacksize, etc. to prevent writing out
bad .pyc files which can cause a crash when read back in.
2002-06-14 01:07:39 +00:00
Martin v. Löwis 14f8b4cfcb Patch #568124: Add doc string macros. 2002-06-13 20:33:02 +00:00
Guido van Rossum 5e2c5fa1bd imp_load_module(): correct and comment the sense of the test for '+'
in the mode (it's forbidden).
2002-05-30 17:33:07 +00:00
Jeremy Hylton 4ae6faed9f Cover a few corners in the 'U' mode integration to make imp work.
get_file() must convert 'U' to "r" PY_STDIOTEXTMODE before calling
fopen().

imp_load_module() must accept 'r' or 'U' or something with '+'.

Also reflow some long lines.
2002-05-30 17:15:25 +00:00
Jack Jansen c88da1faa5 File modes in filedescr entries are also passed to Python, so we now put "U"
in there, and convert it to "rb" (or "r" for non-universal-newline builds)
before passing it to fopen().

Fixes #561326.
2002-05-28 10:58:19 +00:00
Jack Jansen 7b8c7546eb Mass checkin of universal newline support.
Highlights: import and friends will understand any of \r, \n and \r\n
as end of line. Python file input will do the same if you use mode 'U'.
Everything can be disabled by configuring with --without-universal-newlines.

See PEP278 for details.
2002-04-14 20:12:41 +00:00
Jack Jansen 8ab04b4d65 Got rid of ifdefs for long-obsolete GUSI versions. 2002-04-11 20:46:23 +00:00
Guido van Rossum 50ee94fd41 is_builtin() is not a Boolean -- it can return -1, 0, 1. [SF #541652] 2002-04-09 18:00:58 +00:00
Guido van Rossum b8bff3f4a9 Return bools from functions named is_<whatever>(). 2002-04-07 06:34:38 +00:00
Neal Norwitz 031829d3ef Use symbolic METH_VARARGS instead of 1 for ml_flags 2002-03-31 14:37:44 +00:00
Tim Peters 1f7df3595a Remove the CACHE_HASH and INTERN_STRINGS preprocessor symbols. 2002-03-29 03:29:08 +00:00
Andrew MacIntyre d940054ad4 OS/2 EMX port changes (Python part of patch #450267):
Python/
    dynload_shlib.c  // EMX port emulates dlopen() etc. for DL extensions
    import.c         // changes to support 8.3 DLL name limit (VACPP+EMX)
                     //  and case sensitive import semantics
    importdl.h
    thread_os2.h
2002-02-26 11:41:34 +00:00
Marc-André Lemburg bd3be8f0ca Fix to the UTF-8 encoder: it failed on 0-length input strings.
Fix for the UTF-8 decoder: it will now accept isolated surrogates
(previously it raised an exception which causes round-trips to
fail).

Added new tests for UTF-8 round-trip safety (we rely on UTF-8 for
marshalling Unicode objects, so we better make sure it works for
all Unicode code points, including isolated surrogates).

Bumped the PYC magic in a non-standard way -- please review. This
was needed because the old PYC format used illegal UTF-8 sequences
for isolated high surrogates which now raise an exception.
2002-02-07 11:33:49 +00:00
Martin v. Löwis cdc4451222 Include <unistd.h> in Python.h. Fixes #500924. 2002-01-12 11:05:12 +00:00
Tim Peters 36515e28ed Since the MAGIC number scheme is going to break on January 1st, document
what it is more carefully and point out some of the subtleties.
2001-11-18 04:06:29 +00:00
Jack Jansen 550fdae2f5 On the macintosh don't take a quick exit in find_module() for frozen submodule imports: the frozen import goes through a different mechanism. 2001-10-30 13:08:39 +00:00
Fred Drake 9cd0efcee9 Use PyDict_Copy() and PyDict_Update() instead of using PyObject_CallMethod()
to call the corresponding methods.  This is not a performance improvement
since the times are still swamped by disk I/O, but cleans up the code just
a little.
2001-10-25 21:38:59 +00:00
Guido van Rossum e2ae77b8b8 SF patch #474590 -- RISC OS support 2001-10-24 20:42:55 +00:00
Guido van Rossum 8f4d3316de First part of SF patch #416704: More robust freeze, by Toby Dickenson.
This fixes the behavior reported by SF bug #404545, where a file
x.y.py could be imported by the statement "import x.y" when there's a
frozen package x (I believe even if x.y also exists as a frozen
module).
2001-10-18 18:54:11 +00:00
Greg Ward 201baee7ea Remove a couple of unused local variables (bug #445960, compiler warnings
on IRIX 6.5).
2001-10-04 14:52:06 +00:00