Commit graph

122 commits

Author SHA1 Message Date
Guido van Rossum 00bc0e0a2d Patch #1272, by Christian Heimes and Alexandre Vassalotti.
Changes to make __file__ a proper Unicode object, using the default
filesystem encoding.
This is a bit tricky because the default filesystem encoding isn't
set by the time we import the first modules; at that point we fudge
things a bit.  This is okay since __file__ isn't really used much
except for error reporting.
Tested on OSX and Linux only so far.
2007-10-15 02:52:41 +00:00
Martin v. Löwis e81e9b1d3b Patch #794826: Add __file__ in dynamically loaded modules for multiple
interpreters. Fixes #698282. Will backport to 2.3.
2003-09-04 18:45:59 +00:00
Fred Drake 6049cb8918 Simplify, and avoid PyModule_GetDict() while we're at it. 2002-08-26 21:15:11 +00:00
Guido van Rossum ae9e7960d3 SF patch #471839: Bug when extensions import extensions (Shane Hathaway)
When an extension imports another extension in its
    initXXX() function, the variable _Py_PackageContext is
    prematurely reset to NULL. If the outer extension then
    calls Py_InitModule(), the extension is installed in
    sys.modules without its package name. The
    manifestation of this bug is a "SystemError:
    _PyImport_FixupExtension: module <package>.<extension>
    not loaded".

    To fix this, importdl.c just needs to retain the old
    value of _Py_PackageContext and restore it after the
    initXXX() method is called. The attached patch does this.

    This patch applies to Python 2.1.1 and the current CVS.
2001-10-16 20:07:34 +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 f70ef4f860 Mass ANSIfication of function definitions. Doesn't cover all 'extern'
declarations yet, those come later.
2000-07-22 18:47:25 +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
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 6ea9092625 Moved most of the platform-specific code to dynload_<platform>.c files.
(A few nite remain, these will probably disappear soon.)

This is part of a set of patches by Greg Stein.
1999-12-20 21:20:42 +00:00
Guido van Rossum 001b9bebca Patch by Vladimir Marangozov, inspired by a bug report from Gary
Duzan, for AIX, to support C++ objects with static initializers, when
using the genuine IBM C++ compiler (namely xlC/xlC_r).

See accompanying patches to configure.in and acconfig.h.
1999-11-16 15:54:16 +00:00
Guido van Rossum 933c91ebcf Vladimir Marangozov fixes an AIX-specific problem, writing:
"""
Following up Robin Dunn's troubles with freeze, here's a patch that
fixes an oddity regarding the import logic of shared modules on AIX.

Symbol resolution of shared modules is now handled properly for the cases
when the python library is linked to a binary with an arbitrary name.
This includes the standard python[version] executable, but also applications
that are embedding the python core (i.e. linked with libpython[version].a,
the latter being static or shared).
"""
1999-08-04 18:00:12 +00:00
Guido van Rossum 54ecc3d24f Patches by William Lewis for Nextstep descendants. 1999-01-27 17:53:11 +00:00
Guido van Rossum df69365f5f Ty Sarna writes:
The following patches (relative to 1.5.2b1) enable Python dynamic
loading to work on NetBSD platforms that use ELF (presnetly mips and
alpha systems).  They automaticly determine wether the system is ELF or
a.out rather than using astatic list of platforms so that when other
NetBSD platforms move to ELF, python will continue to work without
change.
1999-01-07 21:50:41 +00:00
Guido van Rossum cad3d47f1e Chris Herborth writes:
Donn Cave tells me the PyImport_BeImageID() function isn't needed anymore.
1999-01-04 16:45:59 +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 2f3667a7b9 Replace fprintf(stderr, ...) with PySys_WriteStderr(...). 1998-10-12 18:23:55 +00:00
Guido van Rossum 0f8b30f8ce On Win32, use
LoadLibraryEx(pathname, NULL, LOAD_WITH_ALTERED_SEARCH_PATH)
to search dependent DLLs in the directory of the pathname.
1998-10-08 01:44:41 +00:00
Guido van Rossum e364b7d46a Renamed thread.h to pythread.h.
(Also removed whitespace after # in some BEOS related cpp directives.)
1998-10-01 20:43:23 +00:00
Guido van Rossum 65f15d435e In FreeBSD when using ELF, an underscore is needed in front of the
function name.  (Vladimir Kushnir by way of Thomas Gellekum.)
1998-09-30 14:34:52 +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 ab076fdb6f Ted Horst writes in psa-members@python.org:
This is a patch that Bill Bummgarner did for 1.4 that hasn't made its
way into the distribution yet.  This is important if you want to use
the ObjC module.
1998-08-24 14:15:44 +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 bb71ab68f9 Reindented some OS/2 and hpux code that looked ugly or at least
inconsistent.
1998-07-08 13:47:12 +00:00
Guido van Rossum a5e1b008a9 Windows-specific hack to make sure that when LoadLibrary() is called,
the filename contains at least a rudimentary pathname.
(The bad part is that we need to call getcwd() because only a prefix
of ".\\" is not enough -- we prefix the drive letter.)
1998-06-27 21:53:17 +00:00
Guido van Rossum 6b077878a5 Remove use of RTLD_GLOBAL. 1998-05-18 13:42:45 +00:00
Guido van Rossum 859b16c847 In debug mode on MS Windows, DLLs are called foo_d.pyd or foo_d.dll. 1998-05-15 20:22:08 +00:00
Guido van Rossum 1f74016735 Support for OpenBSD :-( 1998-04-13 15:27:21 +00:00
Guido van Rossum cecadc469b Move #include <sys/param.h> to before osdefs.h (Donn Cave). 1998-04-10 23:45:14 +00:00
Guido van Rossum 42e8e5d164 Protect PyErr_Format format string argument from overflow. 1998-01-19 22:23:08 +00:00
Guido van Rossum 15af20a337 Better #ifdefs for NetBSD, taking into account that at least on netBSD
1.3, dlopen() etc. are fully implemented, including dlerror().
From Jaromir Dolecek and Ty Sarna.
1998-01-19 22:03:52 +00:00
Guido van Rossum 08052c7bb6 Add the flag RTLD_GLOBAL to the dlopen() options.
This exports symbols defined by the loaded extension to other
extensions (loaded later).

(I'm not quite sure about this but suppose it can't hurt...)
1997-12-02 20:43:18 +00:00
Guido van Rossum 8e9ebfd337 os2 patch by Jeff Rush 1997-11-22 21:53:48 +00:00
Guido van Rossum 2e58ff3ef5 Fix importing of shared libraries from inside packages.
This is a bit of a hack: when the shared library is loaded, the module
name is "package.module", but the module calls Py_InitModule*() with just
"module" for the name.  The shared library loader squirrels away the true
name of the module in _Py_PackageContext, and Py_InitModule*() will
substitute this (if the name actually matches).
1997-11-19 18:53:33 +00:00
Guido van Rossum 3b31cd2fe7 Shared libraries didn't quite work under AIX because of the change in
status of the GNU readline interface.  Here's a patch, by Vladimir
Marangozov.
1997-10-10 17:40:00 +00:00
Guido van Rossum 54dec59b56 set sharedlib extensions properly for NeXT (Ted Horst) 1997-08-16 14:38:09 +00:00
Guido van Rossum 25ce566661 The last of the mass checkins for separate (sub)interpreters.
Everything should now work again.

See the comments for the .h files mass checkin (e.g. pystate.h) for
more detail.
1997-08-02 03:10:38 +00:00
Guido van Rossum ef3d02ebb9 Removed some variables that are used to exchange data between import.c and
importdl.c: the MAXSUFFIXSIZE macro is now defined in importdl.h, and
the modules dictionary is now passed using PyImport_GetModuleDict().

Also undefine USE_SHLIB for AIX -- in AIX 4.2 and up, dlfcn.h exists
but we don't want to use it.
1997-07-21 14:54:36 +00:00
Guido van Rossum af5dfb4ceb One last rename glitch: import_modules -> _PyImport_Modules. 1997-05-14 17:36:12 +00:00
Guido van Rossum 9218b70bdc Remove 2 out of 3 __FreeBSD__ tests.
These are no longer needed as of FreeBSD 2.0.5, according to
Thomas Gellekum <tg@ihf.rwth-aachen.de>.
1997-05-05 15:03:26 +00:00
Guido van Rossum bc2472db8e Avoid some potential (though unlikely) sprintf buffer overflows. 1997-04-30 19:07:54 +00:00
Guido van Rossum 79f25d9a7b Quickly renamed the remaining files -- this directory is done. 1997-04-29 20:08:16 +00:00
Guido van Rossum 1d2e240954 (Jack:) On the Mac, don't automatically enable dynamic loading. 1997-04-11 19:22:06 +00:00
Guido van Rossum 644a12b00c Tweaks to keep the Microsoft compiler quier. 1997-04-09 19:24:53 +00:00
Guido van Rossum 3afb5959aa Some extra flags that an HPUX user wants me to add. 1996-12-05 23:15:35 +00:00
Guido van Rossum d266eb460e New permission notice, includes CNRI. 1996-10-25 14:44:06 +00:00
Guido van Rossum 9b38a145e2 Rationalized MS ifdefs 1996-09-11 23:12:24 +00:00
Guido van Rossum 504f4a9901 Don't require <dlfcn.h> -- rely on existence of dlopen(). 1996-08-20 19:59:07 +00:00
Guido van Rossum 1e6124902a Many little fixes:
- support for SCO_SV dynamic loading
- on Mac, auto-detect dynamic loading by __CFM68K__ or _powerc)
- on Mac, long shared library extension is .cfm68k.slb or .ppc.slb
- on hp, don't redefine hpux if already defined
- add __file__ property to successfully loaded module
1996-08-19 22:12:10 +00:00
Guido van Rossum 0bbf253e97 Insert "./" in front of pathname when it contains no '/' (if USE_SHLIB) 1996-08-09 20:55:05 +00:00
Guido van Rossum d5962adb44 Changes for AIX sharedlibs. 1996-07-31 22:44:53 +00:00
Guido van Rossum 3823420ca4 If NO_DYNAMIC_LINK is defined, load_dynamic_module() will always fail. 1996-07-31 17:55:19 +00:00
Guido van Rossum 236f62da7a Corrections to aix_loaderror(), by Manus Hand. 1996-06-26 21:07:08 +00:00
Guido van Rossum dadc824c6e removed verbose decl; added win3.1 dynamic linking. 1996-05-23 22:51:40 +00:00
Guido van Rossum e71a947f8e Under NT, change "long" sharedlib extension to ".dll". (Mark H.) 1996-04-09 02:39:15 +00:00
Guido van Rossum 25e852985f __FreeBSD__ shared libraries 1996-02-25 05:02:29 +00:00
Guido van Rossum ff4af06735 __hpux -> hpux equivalence 1996-01-12 01:17:50 +00:00
Jack Jansen 0a72e8d4d2 Added missing include for <Aliases.h> 1995-10-23 13:54:01 +00:00
Guido van Rossum 11a3f0c2bc NT specific change for nicer error message (Mark H) 1995-07-18 14:40:09 +00:00
Jack Jansen eceb3e3f0a Porting to CW CFM68K 1995-06-27 13:15:15 +00:00
Guido van Rossum 75f288de71 re-enabled NeXT dynamic linking (#ifdef NeXT) 1995-06-14 22:07:26 +00:00
Jack Jansen 5d9acb6b9e Mac dynloading is now enabled by USE_MAC_DYNAMIC_LOADING.
Mac dynloading changed to allow multiple modules to live in with each
other in the same file.
1995-06-14 14:54:25 +00:00
Sjoerd Mullender fbe6d33ffd Check if we've already loaded a dynamic module under a different name. 1995-06-12 15:51:34 +00:00
Guido van Rossum 0fbec64c56 for BorlandC 1995-02-27 10:15:36 +00:00
Guido van Rossum 3097c3a87e change ifdefs and fix "%#s" format 1995-02-21 21:02:46 +00:00
Guido van Rossum 6a75d26622 ported to 68K Mac; changed suffix to .slb 1995-02-18 14:51:15 +00:00
Jack Jansen 4e04373073 Added code to import dynamic modules using mac CFM. 1995-02-13 22:42:34 +00:00
Guido van Rossum 46c76a6c66 added changes for NetBSD dynamic linking; removed shared linking for NeXT 1995-01-20 16:53:54 +00:00
Guido van Rossum 6da5bfad0f remove nogus reload check 1995-01-09 17:46:45 +00:00
Guido van Rossum 5fb1da76ff NT dlls have .pyd extension instead of .dll 1995-01-07 12:36:02 +00:00
Guido van Rossum 6d023c98b0 Added 1995 to copyright message.
bltinmodule.c: fixed coerce() nightmare in ternary pow().
modsupport.c (initmodule2): pass METH_FREENAME flag to newmethodobject().
pythonrun.c: move flushline() into and around print_error().
1995-01-04 19:12:13 +00:00
Guido van Rossum 1ae940a587 Lots of changes, most minor (fatal() instead of abort(), use of
err_fetch/err_restore and so on).  But...
NOTE: import.c has been rewritten and all the DL stuff is now in the
new file importdl.c.
1995-01-02 19:04:15 +00:00