Merge branches/pep-0384.

This commit is contained in:
Martin v. Löwis 2010-12-03 20:14:31 +00:00
parent c4df784514
commit 4d0d471a80
102 changed files with 2835 additions and 75 deletions

View file

@ -727,7 +727,7 @@ builtin_eval(PyObject *self, PyObject *args)
"code object passed to eval() may not contain free variables");
return NULL;
}
return PyEval_EvalCode((PyCodeObject *) cmd, globals, locals);
return PyEval_EvalCode(cmd, globals, locals);
}
cf.cf_flags = PyCF_SOURCE_IS_UTF8;
@ -803,7 +803,7 @@ builtin_exec(PyObject *self, PyObject *args)
"contain free variables");
return NULL;
}
v = PyEval_EvalCode((PyCodeObject *) prog, globals, locals);
v = PyEval_EvalCode(prog, globals, locals);
}
else {
char *str;

View file

@ -755,7 +755,7 @@ static int _Py_TracingPossible = 0;
PyObject *
PyEval_EvalCode(PyCodeObject *co, PyObject *globals, PyObject *locals)
PyEval_EvalCode(PyObject *co, PyObject *globals, PyObject *locals)
{
return PyEval_EvalCodeEx(co,
globals, locals,
@ -3059,10 +3059,11 @@ exit_eval_frame:
the test in the if statements in Misc/gdbinit (pystack and pystackv). */
PyObject *
PyEval_EvalCodeEx(PyCodeObject *co, PyObject *globals, PyObject *locals,
PyEval_EvalCodeEx(PyObject *_co, PyObject *globals, PyObject *locals,
PyObject **args, int argcount, PyObject **kws, int kwcount,
PyObject **defs, int defcount, PyObject *kwdefs, PyObject *closure)
{
PyCodeObject* co = (PyCodeObject*)_co;
register PyFrameObject *f;
register PyObject *retval = NULL;
register PyObject **fastlocals, **freevars;
@ -3968,7 +3969,7 @@ fast_function(PyObject *func, PyObject ***pp_stack, int n, int na, int nk)
d = &PyTuple_GET_ITEM(argdefs, 0);
nd = Py_SIZE(argdefs);
}
return PyEval_EvalCodeEx(co, globals,
return PyEval_EvalCodeEx((PyObject*)co, globals,
(PyObject *)NULL, (*pp_stack)-n, na,
(*pp_stack)-2*nk, nk, d, nd, kwdefs,
PyFunction_GET_CLOSURE(func));

View file

@ -53,6 +53,8 @@ const struct filedescr _PyImport_DynLoadFiletab[] = {
#else /* !__VMS */
{"." SOABI ".so", "rb", C_EXTENSION},
{"module." SOABI ".so", "rb", C_EXTENSION},
{".abi" PYTHON_ABI_STRING ".so", "rb", C_EXTENSION},
{"module.abi" PYTHON_ABI_STRING ".so", "rb", C_EXTENSION},
{".so", "rb", C_EXTENSION},
{"module.so", "rb", C_EXTENSION},
#endif /* __VMS */

View file

@ -134,6 +134,15 @@ static char *GetPythonImport (HINSTANCE hModule)
!strncmp(import_name,"python",6)) {
char *pch;
#ifndef _DEBUG
/* In a release version, don't claim that python3.dll is
a Python DLL. */
if (strcmp(import_name, "python3.dll") == 0) {
import_data += 20;
continue;
}
#endif
/* Ensure python prefix is followed only
by numbers to the end of the basename */
pch = import_name + 6;
@ -162,13 +171,16 @@ static char *GetPythonImport (HINSTANCE hModule)
return NULL;
}
dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname,
const char *pathname, FILE *fp)
{
dl_funcptr p;
char funcname[258], *import_python;
#ifndef _DEBUG
_Py_CheckPython3();
#endif
PyOS_snprintf(funcname, sizeof(funcname), "PyInit_%.200s", shortname);
{

View file

@ -806,7 +806,7 @@ PyImport_ExecCodeModuleWithPathnames(char *name, PyObject *co, char *pathname,
PyErr_Clear(); /* Not important enough to report */
Py_DECREF(v);
v = PyEval_EvalCode((PyCodeObject *)co, d, d);
v = PyEval_EvalCode(co, d, d);
if (v == NULL)
goto error;
Py_DECREF(v);

View file

@ -1755,7 +1755,7 @@ run_mod(mod_ty mod, const char *filename, PyObject *globals, PyObject *locals,
co = PyAST_Compile(mod, filename, flags, arena);
if (co == NULL)
return NULL;
v = PyEval_EvalCode(co, globals, locals);
v = PyEval_EvalCode((PyObject*)co, globals, locals);
Py_DECREF(co);
return v;
}
@ -1785,7 +1785,7 @@ run_pyc_file(FILE *fp, const char *filename, PyObject *globals,
return NULL;
}
co = (PyCodeObject *)v;
v = PyEval_EvalCode(co, globals, locals);
v = PyEval_EvalCode((PyObject*)co, globals, locals);
if (v && flags)
flags->cf_flags |= (co->co_flags & PyCF_MASK);
Py_DECREF(co);
@ -1817,6 +1817,14 @@ Py_CompileStringFlags(const char *str, const char *filename, int start,
return (PyObject *)co;
}
/* For use in Py_LIMITED_API */
#undef Py_CompileString
PyObject *
PyCompileString(const char *str, const char *filename, int start)
{
return Py_CompileStringFlags(str, filename, start, NULL);
}
struct symtable *
Py_SymtableString(const char *str, const char *filename, int start)
{