Commit Graph

265 Commits

Author SHA1 Message Date
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
Tim Peters 692323488b Add a new function imp.lock_held(), and use it to skip test_threaded_import
when that test is doomed to deadlock.
2001-08-30 05:16:13 +00:00
Barry Warsaw 928833891a Fixed typo in comment leading up to _PyImport_FixupExtension(). 2001-08-13 23:05:44 +00:00
Martin v. Löwis 11d03c57de Put conditional S_IFMT definition into pyport.h. 2001-08-08 12:54:28 +00:00
Martin v. Löwis f9836ba4fe Put conditional S_ISDIR definition(s) into pyport.h. 2001-08-08 10:28:06 +00:00
Tim Peters c173137391 Derived from SF patch #446899 Permit import of .pyw under Windows, from
David Bolen.
2001-08-04 08:12:36 +00:00
Tim Peters 6d6c1a35e0 Merge of descr-branch back into trunk. 2001-08-02 04:15:00 +00:00
Neil Schemenauer 7d4bb9f179 Add -E command line switch (ignore environment variables like PYTHONHOME
and PYTHONPATH).
2001-07-23 16:30:27 +00:00
Guido van Rossum f48f11cd79 SF Patch #441791, with changes: when "import foo.bar" fails with an
exception in the execution of bar, ensure that foo.bar exists.
(Previously, while sys.modules['foo.bar'] would exist, foo.bar would
only be created upon successful execution of bar.  This is
inconvenient; some would say wrong. :-)
2001-07-23 13:27:49 +00:00
Tim Peters 0f9431fb18 SF bug #438295: [Windows] __init__.py cause strange behavior
Probable fix (the bug report doesn't have enough info to say for sure).
find_init_module():  Insist on a case-sensitive match for __init__ files.
Given __INIT__.PY instead, find_init_module() thought that was fine, but
the later attempt to do find_module("__INIT__.PY") didn't and its caller
silently suppressed the resulting ImportError.  Now find_init_module()
refuses to accept __INIT__.PY to begin with.
Bugfix candidate; specific to platforms with case-insensitive filesystems.
2001-07-05 03:47:53 +00:00
Tim Peters cab3f68f61 SF bug #417093: Case sensitive import: dir and .py file w/ same name
Directory containing
    Spam.py
    spam/__init__.py
Then "import Spam" caused a SystemError, because code checking for
the existence of "Spam/__init__.py" finds it on a case-insensitive
filesystem, but then bails because the directory it finds it in
doesn't match case, and then old code assumed that was still an error
even though it isn't anymore.  Changed the code to just continue
looking in this case (instead of calling it an error).  So
    import Spam
and
    import spam
both work now.
2001-04-29 22:21:25 +00:00
Guido van Rossum 59d1d2b434 Iterators phase 1. This comprises:
new slot tp_iter in type object, plus new flag Py_TPFLAGS_HAVE_ITER
new C API PyObject_GetIter(), calls tp_iter
new builtin iter(), with two forms: iter(obj), and iter(function, sentinel)
new internal object types iterobject and calliterobject
new exception StopIteration
new opcodes for "for" loops, GET_ITER and FOR_ITER (also supported by dis.py)
new magic number for .pyc files
new special method for instances: __iter__() returns an iterator
iteration over dictionaries: "for x in dict" iterates over the keys
iteration over files: "for x in file" iterates over lines

TODO:

documentation
test suite
decide whether to use a different way to spell iter(function, sentinal)
decide whether "for key in dict" is a good idea
use iterators in map/filter/reduce, min/max, and elsewhere (in/not in?)
speed tuning (make next() a slot tp_next???)
2001-04-20 19:13:02 +00:00
Jeremy Hylton 37832f0c8d split long line 2001-04-13 17:50:20 +00:00
Jack Jansen 4df3c5284f Case-checking was broken on the Macintosh. Fixed. 2001-03-20 23:09:54 +00:00
Fred Drake a76ba6ed9b Add some spaces around the "=" in assignments. 2001-03-06 06:31:15 +00:00
Guido van Rossum 48a680c097 RISCOS changes by dschwertberger. 2001-03-02 06:34:14 +00:00
Tim Peters 677898a391 Thanks to Steven Majewski, finally putting MacOS X imports to bed for 2.1b1. 2001-03-02 03:28:03 +00:00
Tim Peters d1e87a8288 More MacOSX fiddling. As noted in a comment, I believe all variations
of these "search the directory" schemes (including this one) are still prone
to making mistakes.
2001-03-01 18:12:00 +00:00
Tim Peters dbe6ebbeff More fiddling w/ the new-fangled Mac import code. 2001-03-01 08:47:29 +00:00
Fred Drake c63d3e9453 Suppress a compiler warning under OpenVMS; time_t is unsigned on (at least)
the more recent versions of that platform, so we use the value (time_t)(-1)
as the error value.  This is the type used in the OpenVMS documentation:

http://www.openvms.compaq.com/commercial/c/5763p048.htm#inde

This closes SF tracker bug #404240.

Also clean up an exception message when detecting overflow of time_t values
beyond 4 bytes.
2001-03-01 06:33:32 +00:00
Tim Peters 5819aa8b32 Remove extra close curly in code #ifdef'ed out on my box. 2001-03-01 02:20:01 +00:00
Tim Peters 430f5d401d In Steven's apparent absence, check in *something* with a non-zero chance
of making new-fangled Mac imports work again.  May not work, and may not
even compile on his boxes, but should be at worst very close on both.
2001-03-01 01:30:56 +00:00
Tim Peters e860f9b983 Ack -- my eyes are getting bleary. Typos in the comment typo repairs. 2001-02-28 05:57:51 +00:00
Tim Peters f91ed2ddcf Comment typos. 2001-02-28 05:56:18 +00:00
Tim Peters 50d8d37b3f Implement PEP 235: Import on Case-Insensitive Platforms.
http://python.sourceforge.net/peps/pep-0235.html

Renamed check_case to case_ok.  Substantial code rearrangement to get
this stuff in one place in the file.  Innermost loop of find_module()
now much simpler and #ifdef-free, and I want to keep it that way (it's
bad enough that the innermost loop is itself still in an #ifdef!).

Windows semantics tested and are fine.

Jason, Cygwin *should* be fine if and only if what you did before "worked"
for case_ok.

Jack, the semantics on your flavor of Mac have definitely changed (see
the PEP), and need to be tested.  The intent is that your flavor of Mac
now work the same as everything else in the "lower left" box, including
respecting PYTHONCASEOK.

Steven, sorry, you did the most work here so far but you got screwed the
worst.  Happy to work with you on repairing it, but I don't understand
anything about all your Mac variants.  We need to add another branch (or
two, three, ...?) inside case_ok.  But we should not need to change
anything else.
2001-02-28 05:34:27 +00:00
Guido van Rossum 85cd1d690c The code in PyImport_Import() tried to save itself a bit of work and
save the __builtin__ module in a static variable.  But this doesn't
work across Py_Finalise()/Py_Initialize()!  It also doesn't work when
using multiple interpreter states created with PyInterpreterState_New().

So I'm ripping out this small optimization.

This was probably broken since PyImport_Import() was introduced in
1997!  We really need a better test suite for multiple interpreter
states and repeatedly initializing.

This fixes the problems Barry reported in Demo/embed/loop.c.
2001-02-20 21:43:24 +00:00
Marc-André Lemburg 3c61c3525f This modified version of a patch by Thomas Heller allows __import__
hooks to take over the Python import machinery at a very early stage
in the Python startup phase.

If there are still places in the Python interpreter which need to
bypass the __import__ hook, these places must now use
PyImport_ImportModuleEx() instead. So far no other places than in
the import mechanism itself have been identified.
2001-02-09 19:40:15 +00:00
Jeremy Hylton b1cbc1e36b bump the magic number; the compiler has changed since 2.1a1 2001-02-02 20:13:24 +00:00
Barry Warsaw 914a0b1db6 Steve Majewski's patch #103495, MatchFilename() and find_module()
patch for case-preserving HFS+ suport.  Untested except to verify that
it builds and doesn't break anything on Linux RH6.1.
2001-02-02 19:12:16 +00:00
Tim Peters d9b9ac855c It's unclear whether PyMarshal_XXX() are part of the public or private API.
They're named as if public, so I did a Bad Thing by changing
PyMarshal_ReadObjectFromFile() to suck up the remainder of the file in one
gulp:  anyone who counted on that leaving the file pointer merely at the
end of the next object would be screwed.  So restored
PyMarshal_ReadObjectFromFile() to its earlier state, renamed the new greedy
code to PyMarshal_ReadLastObjectFromFile(), and changed Python internals to
call the latter instead.
2001-01-28 00:27:39 +00:00
Jeremy Hylton 64949cb753 PEP 227 implementation
The majority of the changes are in the compiler.  The mainloop changes
primarily to implement the new opcodes and to pass a function's
closure to eval_code2().  Frames and functions got new slots to hold
the closure.

Include/compile.h
    Add co_freevars and co_cellvars slots to code objects.
    Update PyCode_New() to take freevars and cellvars as arguments
Include/funcobject.h
    Add func_closure slot to function objects.
    Add GetClosure()/SetClosure() functions (and corresponding
    macros) for getting at the closure.
Include/frameobject.h
    PyFrame_New() now takes a closure.
Include/opcode.h
    Add four new opcodes: MAKE_CLOSURE, LOAD_CLOSURE, LOAD_DEREF,
    STORE_DEREF.
    Remove comment about old requirement for opcodes to fit in 7
    bits.
compile.c
    Implement changes to code objects for co_freevars and co_cellvars.

    Modify symbol table to use st_cur_name (string object for the name
    of the current scope) and st_cur_children (list of nested blocks).
    Also define st_nested, which might more properly be called
    st_cur_nested.  Add several DEF_XXX flags to track def-use
    information for free variables.

    New or modified functions of note:
    com_make_closure(struct compiling *, PyCodeObject *)
        Emit LOAD_CLOSURE opcodes as needed to pass cells for free
        variables into nested scope.
    com_addop_varname(struct compiling *, int, char *)
        Emits opcodes for LOAD_DEREF and STORE_DEREF.
    get_ref_type(struct compiling *, char *name)
        Return NAME_CLOSURE if ref type is FREE or CELL
    symtable_load_symbols(struct compiling *)
        Decides what variables are cell or free based on def-use info.
        Can now raise SyntaxError if nested scopes are mixed with
        exec or from blah import *.
    make_scope_info(PyObject *, PyObject *, int, int)
        Helper functions for symtable scope stack.
    symtable_update_free_vars(struct symtable *)
        After a code block has been analyzed, it must check each of
        its children for free variables that are not defined in the
        block.  If a variable is free in a child and not defined in
        the parent, then it is defined by block the enclosing the
        current one or it is a global.  This does the right logic.
    symtable_add_use() is now a macro for symtable_add_def()
    symtable_assign(struct symtable *, node *)
        Use goto instead of for (;;)

    Fixed bug in symtable where name of keyword argument in function
    call was treated as assignment in the scope of the call site. Ex:
        def f():
            g(a=2) # a was considered a local of f

ceval.c
    eval_code2() now take one more argument, a closure.
    Implement LOAD_CLOSURE, LOAD_DEREF, STORE_DEREF, MAKE_CLOSURE>

    Also: When name error occurs for global variable, report that the
    name was global in the error mesage.

Objects/frameobject.c
    Initialize f_closure to be a tuple containing space for cellvars
    and freevars.  f_closure is NULL if neither are present.
Objects/funcobject.c
    Add support for func_closure.
Python/import.c
    Change the magic number.
Python/marshal.c
    Track changes to code objects.
2001-01-25 20:06:59 +00:00
Tim Peters 60f42b50d8 Move distributed and duplicated config for stat() and fstat() into pyport.h. 2001-01-18 03:03:16 +00:00
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