Changeset 10 for python/trunk/Python


Ignore:
Timestamp:
Sep 3, 2010, 5:33:06 PM (15 years ago)
Author:
Yuri Dario
Message:

python: merged offline changes.

Location:
python/trunk/Python
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • python/trunk/Python/dynload_shlib.c

    r2 r10  
    2121#else
    2222#if defined(PYOS_OS2) && defined(PYCC_GCC)
     23#ifdef __KLIBC__
     24#error "kLIBC has dlfcn.h and shouldn't get here!"
     25#endif
    2326#include "dlfcn.h"
    2427#endif
    2528#endif
    2629
    27 #if (defined(__OpenBSD__) || defined(__NetBSD__)) && !defined(__ELF__)
     30#if ((defined(__OpenBSD__) || defined(__NetBSD__)) && !defined(__ELF__)) \
     31    || (defined(__OS2__) && defined(__KLIBC__))
    2832#define LEAD_UNDERSCORE "_"
    2933#else
     
    3741        {"module.dll", "rb", C_EXTENSION},
    3842#else
    39 #if defined(PYOS_OS2) && defined(PYCC_GCC)
     43#if (defined(PYOS_OS2) && defined(PYCC_GCC)) || (defined(__OS2__) && defined(__KLIBC__))
    4044        {".pyd", "rb", C_EXTENSION},
    4145        {".dll", "rb", C_EXTENSION},
     
    128132#endif
    129133
     134#if (defined(PYOS_OS2) && defined(PYCC_GCC))
     135        // resolve unixroot
     136        if (_realrealpath( pathname, pathbuf, sizeof(pathbuf))!=0)
     137                pathname = pathbuf;
     138#endif
     139
    130140        handle = dlopen(pathname, dlopenflags);
    131141
  • python/trunk/Python/import.c

    r2 r10  
    15641564#include <dirent.h>
    15651565
     1566#elif defined(__KLIBC__)
     1567#include <stdlib.h>
     1568
    15661569#elif defined(PYOS_OS2)
    15671570#define INCL_DOS
     
    16831686
    16841687/* OS/2 */
     1688#elif defined(__KLIBC__)
     1689        char canon[MAXPATHLEN+1];
     1690        size_t canonlen;
     1691        char *p, *p2;
     1692
     1693        if (Py_GETENV("PYTHONCASEOK") != NULL)
     1694                return 1;
     1695
     1696        /* This resolves case differences and return and native OS/2
     1697           path. Unfortunately, it'll also resolve symbolic links
     1698           while of course will screw up a bit... */
     1699        if (!_realrealpath(buf, canon, sizeof(canon)))
     1700                return 0;
     1701        canonlen = strlen(canon);
     1702        if (canonlen < namelen)
     1703                return 0;
     1704        p = strrchr(canon, SEP);
     1705        p2 = strrchr(p ? p : canon, ALTSEP);
     1706        if (p2)
     1707                p = p2;
     1708
     1709        return strncmp(p ? p + 1 : canon, name, namelen) == 0;
     1710
    16851711#elif defined(PYOS_OS2)
    16861712        HDIR hdir = 1;
  • python/trunk/Python/pystrtod.c

    r2 r10  
    33#include <Python.h>
    44#include <locale.h>
     5#ifdef __EMX__
     6#include <float.h>
     7#endif
     8
    59
    610/* ascii character tests (as opposed to locale tests) */
     
    4145PyOS_ascii_strtod(const char *nptr, char **endptr)
    4246{
     47#ifdef __EMX__
     48_control87(MCW_EM, MCW_EM);
     49#endif
    4350        char *fail_pos;
    4451        double val = -1.0;
     
    173180        }
    174181        else {
     182//sigfpe here
    175183                val = strtod(digits_pos, &fail_pos);
    176184        }
  • python/trunk/Python/sysmodule.c

    r2 r10  
    15561556                        /* It's a symlink */
    15571557                        link[nr] = '\0';
    1558                         if (link[0] == SEP)
     1558                        if (IS_ABSPATH(link))
    15591559                                argv0 = link; /* Link to absolute path */
    1560                         else if (strchr(link, SEP) == NULL)
     1560                        else if (!HAS_ANYSEP(link))
    15611561                                ; /* Link without path */
    15621562                        else {
    15631563                                /* Must join(dirname(argv0), link) */
    15641564                                char *q = strrchr(argv0, SEP);
     1565#ifdef ALTSEP
     1566                                char *q2 = strrchr(q ? q : argv0, ALTSEP);
     1567                                if (q2)
     1568                                        q = q2;
     1569#endif
     1570#ifdef DRVSEP
     1571                                if (!q && HAS_DRV(argv0))
     1572                                        q = strchr(argv0, DRVSEP);
     1573#endif
     1574
    15651575                                if (q == NULL)
    15661576                                        argv0 = link; /* argv0 without path */
     
    15681578                                        /* Must make a copy */
    15691579                                        strcpy(argv0copy, argv0);
    1570                                         q = strrchr(argv0copy, SEP);
     1580                                        q = &argv0copy[q - argv0];
    15711581                                        strcpy(q+1, link);
    15721582                                        argv0 = argv0copy;
     
    16091619#endif
    16101620                        p = strrchr(argv0, SEP);
     1621#ifdef ALTSEP
     1622                        {
     1623                                char *p2 = strrchr(p ? p : argv0, ALTSEP);
     1624                                if (p2 != NULL)
     1625                                        p = p2;
     1626                        }
     1627#endif
     1628#ifdef DRVSEP
     1629                        if (p == NULL && HAS_DRV(argv0))
     1630                                p = strchr(argv0, DRVSEP);
     1631#endif
    16111632                }
    16121633                if (p != NULL) {
  • python/trunk/Python/traceback.c

    r2 r10  
    158158                                        if (strlen(namebuf) != len)
    159159                                                continue; /* v contains '\0' */
    160                                         if (len > 0 && namebuf[len-1] != SEP)
     160                                        if (len > 0 && IS_SEP(namebuf[len-1]))
    161161                                                namebuf[len++] = SEP;
    162162                                        strcpy(namebuf+len, tail);
Note: See TracChangeset for help on using the changeset viewer.