Commit Graph

159 Commits

Author SHA1 Message Date
Guido van Rossum 4c3f57cf05 SF Patch #103154 by jlt63: Cygwin Check Import Case Patch.
Note: I've reordered acconfig.h and config.h.in to obtain alphabetical
order (modulo case and leading _).
2001-01-10 20:40:46 +00:00
Guido van Rossum 215c340aa3 Rip out DOS-8x3 support. 2000-11-13 17:26:32 +00:00
Barry Warsaw 84294487df _PyImport_Fini(): Closed small memory leak when an embedded app calls
Py_Initialize()/Py_Finalize() in a loop.  _PyImport_Filetab needed to
be deallocated.  Partial closure of SF #110681, Jitterbug PR#398.
2000-10-03 16:02:05 +00:00
Tim Peters 42c83afd14 The 2.0b2 change to write .pyc files in exclusive mode (if possible)
unintentionally caused them to get written in text mode under Windows.
As a result, when .pyc files were later read-- in binary mode --the
magic number was always wrong (note that .pyc magic numbers deliberately
include \r and \n characters, so this was "good" breakage, 100% across
all .pyc files, not random corruption in a subset).  Fixed that.
2000-09-29 04:03:10 +00:00
Guido van Rossum 55a8338d7f On Unix, use O_EXCL when creating the .pyc/.pyo files, to avoid a race condition 2000-09-20 20:31:38 +00:00
Guido van Rossum 8586991099 REMOVED all CWI, CNRI and BeOpen copyright markings.
This should match the situation in the 1.6b1 tree.
2000-09-01 23:29:29 +00:00
Thomas Wouters dd13e4f91f Replace the run-time 'future-bytecode-stream-inspection' hack to find out
how 'import' was called with a compiletime mechanism: create either a tuple
of the import arguments, or None (in the case of a normal import), add it to
the code-block constants, and load it onto the stack before calling
IMPORT_NAME.
2000-08-27 20:31:27 +00:00
Thomas Wouters 434d0828d8 Support for three-token characters (**=, >>=, <<=) which was written by
Michael Hudson, and support in general for the augmented assignment syntax.
The graminit.c patch is large!
2000-08-24 20:11:32 +00:00
Barry Warsaw 45ab2b65f6 Thomas reminds me to bump the MAGIC number for the extended print
opcode additions.
2000-08-21 16:35:06 +00:00
Thomas Wouters 5215225ea1 Apply SF patch #101135, adding 'import module as m' and 'from module import
name as n'. By doing some twists and turns, "as" is not a reserved word.

There is a slight change in semantics for 'from module import name' (it will
now honour the 'global' keyword) but only in cases that are explicitly
undocumented.
2000-08-17 22:55:00 +00:00
Thomas Wouters 0be5aab04d Merge UNPACK_LIST and UNPACK_TUPLE into a single UNPACK_SEQUENCE, since they
did the same anyway.

I'm not sure what to do with Tools/compiler/compiler/* -- that isn't part of
distutils, is it ? Should it try to be compatible with old bytecode version ?
2000-08-11 22:15:52 +00:00
Thomas Wouters 2f2370bfc9 Oops. One of last nights ANSIfication patches accidentily upped the bytecode
MAGIC number. When updating it next time, be sure it's higher than 50715 *
constants. (Shouldn't be a problem if everyone keeps to the proper
algorithm.)
2000-07-23 09:20:08 +00:00
Thomas Wouters b4bd21cf79 ANSIfy as many declarations as possible. 2000-07-22 23:38:01 +00:00
Thomas Wouters f70ef4f860 Mass ANSIfication of function definitions. Doesn't cover all 'extern'
declarations yet, those come later.
2000-07-22 18:47:25 +00:00
Jack Jansen cbf630f0a9 Include macglue.h for some function prototypes, and renamed a few
mac-specific functions to have a PyMac_ name.
2000-07-11 21:59:16 +00:00
Tim Peters dbd9ba6a6c Nuke all remaining occurrences of Py_PROTO and Py_FPROTO. 2000-07-09 03:09:57 +00:00
Guido van Rossum 63e97ad4ea Jack Jansen, Mac patch:
Include stat.h if needed; different Mac filename compare
2000-07-01 01:06:56 +00:00
Guido van Rossum ffcc3813d8 Change copyright notice - 2nd try. 2000-06-30 23:58:06 +00:00
Guido van Rossum fd71b9e9d4 Change copyright notice. 2000-06-30 23:50:40 +00:00
Fred Drake 4c82b2366f Trent Mick <trentm@activestate.com>:
This patch fixes possible overflow in the use of
PyOS_GetLastModificationTime in getmtime.c and Python/import.c.

Currently PyOS_GetLastModificationTime returns a C long. This can
overflow on Win64 where sizeof(time_t) > sizeof(long). Besides it
should logically return a time_t anyway (this patch changes this).

As well, import.c uses PyOS_GetLastModificationTime for .pyc
timestamping.  There has been recent discussion about the .pyc header
format on python-dev.  This patch adds oveflow checking to import.c so
that an exception will be raised if the modification time
overflows. There are a few other minor 64-bit readiness changes made
to the module as well:

- size_t instead of int or long for function-local buffer and string
length variables

- one buffer overflow check was added (raises an exception on possible
overflow, this overflow chance exists on 32-bit platforms as well), no
other possible buffer overflows existed (from my analysis anyway)

Closes SourceForge patch #100509.
2000-06-30 16:18:57 +00:00
Jeremy Hylton 9262b8ab1f another typo caught by Rob Hooft 2000-06-30 04:59:17 +00:00
Guido van Rossum b18618dab7 Vladimir Marangozov's long-awaited malloc restructuring.
For more comments, read the patches@python.org archives.
For documentation read the comments in mymalloc.h and objimpl.h.

(This is not exactly what Vladimir posted to the patches list; I've
made a few changes, and Vladimir sent me a fix in private email for a
problem that only occurs in debug mode.  I'm also holding back on his
change to main.c, which seems unnecessary to me.)
2000-05-03 23:44:39 +00:00
Guido van Rossum 96774c1347 Marc-Andre Lemburg:
Changed all references to the MAGIC constant to use a global
pyc_magic instead. This global is initially set to MAGIC, but can be
changed by the _PyImport_Init() function to provide for
special features implemented in the compiler which are settable
using command line switches and affect the way PYC files are
generated.

Currently this change is only done for the -U flag.
2000-05-01 20:19:08 +00:00
Guido van Rossum 22b65a8edc Robin Becker: The following patch seems to fix a module case bug in
1.6a2 caused by wrong return values in routine allcaps83.  [GvR: I
also changed the case for end-s>8 to return 0.]
2000-05-01 17:36:58 +00:00
Guido van Rossum 1cb6cd0ec5 As Marc-Andre Lemburg points out, the magic number needs to change
because we've added Unicode marshalling to the repertoire.
2000-04-28 19:03:54 +00:00
Guido van Rossum b33aa1a51e Jack Jansen: The new version of the GUSI i/o library on the Macintosh
has a few slightly different calls from the old one.
2000-04-24 15:08:18 +00:00
Guido van Rossum 43713e5a28 Massive patch by Skip Montanaro to add ":name" to as many
PyArg_ParseTuple() format string arguments as possible.
2000-02-29 13:59:29 +00:00
Guido van Rossum 96a8fb7e99 Cleanup patches from Greg Stein:
* in import.c, #ifdef out references to dynamic loading based on
  HAVE_DYNAMIC_LOADING

* clean out the platform-specific crud from importdl.c.
  [ maybe fold this function into import.c and drop the importdl.c file? Greg.]

* change GetDynLoadFunc's "funcname" parameter to "shortname". change
  "name" to "fqname" for clarification.

* each GetDynLoadFunc now creates its own funcname value.

  WARNING: as I mentioned previously, we may run into an issue with a
  missing "_" on some platforms. Testing will show this pretty quickly,
  however.

* move pathname munging into dynload_shlib.c
1999-12-22 14:09:35 +00:00
Guido van Rossum ed1170e49f In _PyImport_Init(), dynamically construct the table of legal suffixes
from two static tables (one standard, one provided by the platform's
dynload_*.c variant).

This is part of a set of patches by Greg Stein.
1999-12-20 21:23:41 +00:00
Guido van Rossum 2571cc8bf5 Changes by Mark Hammond for Windows CE. Mostly of the form
#ifdef DONT_HAVE_header_H ... #endif around #include <header.h>.
1999-04-07 16:07:23 +00:00
Barry Warsaw 3879333b9e PyImport_ReloadModule(): Nailed a small memory leak. In the
else-clause of the subname test, the parentname object was never
DECREF'd.
1999-01-27 17:54:20 +00:00
Guido van Rossum 6058eb49ee Improve comment for PyImport_Import() as suggested by Bill Tutt. 1998-12-21 19:51:00 +00:00
Guido van Rossum 65d5b5763c Thanks to Chris Herborth, the thread primitives now have proper Py*
names in the source code (they already had those for the linker,
through some smart macros; but the source still had the old, un-Py names).
1998-12-21 19:32:43 +00:00
Guido van Rossum 66468568df Jim Fulton writes:
"""
I had originally not realized that PyEval_GetGlobals did not
INCREF it's return value.  The fix is to add the INCREF,
as shown below.
"""
1998-10-22 15:46:50 +00:00
Guido van Rossum 2f3667a7b9 Replace fprintf(stderr, ...) with PySys_WriteStderr(...). 1998-10-12 18:23:55 +00:00
Guido van Rossum 49b560698b Renamed thread.h to pythread.h. 1998-10-01 20:42:43 +00:00
Guido van Rossum 566373e974 While scalling sys.modules, skip entries that don't have string keys,
to protect us from jokers who put items with non-string keys in
sys.modules.  Reported by Greg Stein.
1998-10-01 15:24:50 +00:00
Guido van Rossum a0f0a33d05 Mac-specific mod to enable aliases on import paths.
(Jack Jansen and/or Just van Rossum)
1998-09-14 13:40:53 +00:00
Guido van Rossum afd3daedde __file__ used to be always set to the .pyc (or .pyo) file, even if
that file in fact did not exist or at least was not used.  Change this
so that __file__ is *only* set to the .pyc/.pyo file when it actually
read the code object from it; otherwise __file__ is set to the .py
file.
1998-08-25 18:44:34 +00:00
Guido van Rossum 0506a431d5 Patch by Just van Rossum that changes how we search for submodules of
frozen packages.  (I *think* this means that we can now have a
built-in module bar that's a submodule of a frozen package foo, by
registering the built-in module with a name "foo.bar" in the table of
builtin modules.)
1998-08-11 15:07:39 +00:00
Guido van Rossum 0f84a349bb Added handling for Mac code resource modules (Jack Jansen). 1998-08-06 13:36:01 +00:00
Guido van Rossum 1a8791e0b8 Changes for BeOS, QNX and long long, by Chris Herborth. 1998-08-04 22:46:29 +00:00
Guido van Rossum b68cd421e1 Fix two smal memory leaks discovered by Vadim Chugunov. 1998-07-01 17:36:26 +00:00
Guido van Rossum 323bf5e1f7 Ignore Windows case check for ALL CAPS 8.3 files 1998-06-24 03:54:06 +00:00
Guido van Rossum 9c0afe5dc7 Fix a curious bug: statements like "import sys.time" would succeed,
because the path through the code would notice that sys.__path__ did
not exist and it would fall back to the default path (builtins +
sys.path) instead of failing).  No longer.
1998-05-19 15:09:05 +00:00
Guido van Rossum 09cae1f8cd New APIs for embedding applications that want to add their own entries
to the table of built-in modules.  This should normally be called
*before* Py_Initialize().  When the malloc() or realloc() call fails,
-1 is returned and the existing table is unchanged.

After a similar function by Just van Rossum.

int PyImport_ExtendInittab(struct _inittab *newtab);
int PyImport_AppendInittab(char *name, void (*initfunc)());
1998-05-14 02:32:54 +00:00
Guido van Rossum 111c20b992 Reject empty module names -- otherwise __import__("") does something
weird!
1998-04-11 17:38:22 +00:00
Guido van Rossum 8766a7797e Comment out a label on an #endif. 1998-04-10 23:44:32 +00:00
Guido van Rossum 39b0f8976c Address warnings issued by the MSVC++ compiler 1998-04-10 21:52:06 +00:00
Guido van Rossum a5568d349b Support for frozen packages, matching the revamped Tools/freeze.
Frozen packages are indicated by a negative size (the code string
is the __import__.py file).  A frozen package module has its __path__
set to a string, the package name.
1998-03-05 03:45:08 +00:00