Author: Aaron Tubbs <[email protected]>
Branch:
Changeset: r82040:bd63983137b5
Date: 2016-02-01 15:55 -0800
http://bitbucket.org/pypy/pypy/changeset/bd63983137b5/
Log: Merged pypy/pypy into default
diff --git a/.hgignore b/.hgignore
--- a/.hgignore
+++ b/.hgignore
@@ -75,6 +75,7 @@
^lib_pypy/__pycache__$
^lib_pypy/ctypes_config_cache/_.+_cache\.py$
^lib_pypy/ctypes_config_cache/_.+_.+_\.py$
+^lib_pypy/_libmpdec/.+.o$
^rpython/translator/cli/query-descriptions$
^pypy/doc/discussion/.+\.html$
^include/.+\.h$
diff --git a/pypy/config/pypyoption.py b/pypy/config/pypyoption.py
--- a/pypy/config/pypyoption.py
+++ b/pypy/config/pypyoption.py
@@ -85,8 +85,7 @@
module_dependencies = {
'_multiprocessing': [('objspace.usemodules.time', True),
('objspace.usemodules.thread', True)],
- 'cpyext': [('objspace.usemodules.array', True),
- ('objspace.usemodules.micronumpy', True)],
+ 'cpyext': [('objspace.usemodules.array', True)],
'cppyy': [('objspace.usemodules.cpyext', True)],
}
module_suggests = {
diff --git a/pypy/module/cpyext/__init__.py b/pypy/module/cpyext/__init__.py
--- a/pypy/module/cpyext/__init__.py
+++ b/pypy/module/cpyext/__init__.py
@@ -36,7 +36,6 @@
import pypy.module.cpyext.object
import pypy.module.cpyext.stringobject
import pypy.module.cpyext.tupleobject
-import pypy.module.cpyext.ndarrayobject
import pypy.module.cpyext.setobject
import pypy.module.cpyext.dictobject
import pypy.module.cpyext.intobject
diff --git a/pypy/module/cpyext/api.py b/pypy/module/cpyext/api.py
--- a/pypy/module/cpyext/api.py
+++ b/pypy/module/cpyext/api.py
@@ -143,7 +143,7 @@
target.chmod(0444) # make the file read-only, to make sure that nobody
# edits it by mistake
-def copy_header_files(dstdir):
+def copy_header_files(dstdir, copy_numpy_headers):
# XXX: 20 lines of code to recursively copy a directory, really??
assert dstdir.check(dir=True)
headers = include_dir.listdir('*.h') + include_dir.listdir('*.inl')
@@ -151,15 +151,16 @@
headers.append(udir.join(name))
_copy_header_files(headers, dstdir)
- try:
- dstdir.mkdir('numpy')
- except py.error.EEXIST:
- pass
- numpy_dstdir = dstdir / 'numpy'
+ if copy_numpy_headers:
+ try:
+ dstdir.mkdir('numpy')
+ except py.error.EEXIST:
+ pass
+ numpy_dstdir = dstdir / 'numpy'
- numpy_include_dir = include_dir / 'numpy'
- numpy_headers = numpy_include_dir.listdir('*.h') +
numpy_include_dir.listdir('*.inl')
- _copy_header_files(numpy_headers, numpy_dstdir)
+ numpy_include_dir = include_dir / 'numpy'
+ numpy_headers = numpy_include_dir.listdir('*.h') +
numpy_include_dir.listdir('*.inl')
+ _copy_header_files(numpy_headers, numpy_dstdir)
class NotSpecified(object):
@@ -482,7 +483,6 @@
"PyComplex_Type": "space.w_complex",
"PyByteArray_Type": "space.w_bytearray",
"PyMemoryView_Type": "space.w_memoryview",
- "PyArray_Type": "space.gettypeobject(W_NDimArray.typedef)",
"PyBaseObject_Type": "space.w_object",
'PyNone_Type': 'space.type(space.w_None)',
'PyNotImplemented_Type': 'space.type(space.w_NotImplemented)',
@@ -773,6 +773,8 @@
"NOT_RPYTHON"
from pypy.module.cpyext.pyobject import make_ref
+ use_micronumpy = setup_micronumpy(space)
+
export_symbols = list(FUNCTIONS) + SYMBOLS_C + list(GLOBALS)
from rpython.translator.c.database import LowLevelDatabase
db = LowLevelDatabase()
@@ -1009,6 +1011,24 @@
pypy_decl_h.write('\n'.join(pypy_decls))
return functions
+separate_module_files = [source_dir / "varargwrapper.c",
+ source_dir / "pyerrors.c",
+ source_dir / "modsupport.c",
+ source_dir / "getargs.c",
+ source_dir / "abstract.c",
+ source_dir / "stringobject.c",
+ source_dir / "mysnprintf.c",
+ source_dir / "pythonrun.c",
+ source_dir / "sysmodule.c",
+ source_dir / "bufferobject.c",
+ source_dir / "cobject.c",
+ source_dir / "structseq.c",
+ source_dir / "capsule.c",
+ source_dir / "pysignals.c",
+ source_dir / "pythread.c",
+ source_dir / "missing.c",
+ ]
+
def build_eci(building_bridge, export_symbols, code):
"NOT_RPYTHON"
# Build code and get pointer to the structure
@@ -1062,24 +1082,7 @@
eci = ExternalCompilationInfo(
include_dirs=include_dirs,
- separate_module_files=[source_dir / "varargwrapper.c",
- source_dir / "pyerrors.c",
- source_dir / "modsupport.c",
- source_dir / "getargs.c",
- source_dir / "abstract.c",
- source_dir / "stringobject.c",
- source_dir / "mysnprintf.c",
- source_dir / "pythonrun.c",
- source_dir / "sysmodule.c",
- source_dir / "bufferobject.c",
- source_dir / "cobject.c",
- source_dir / "structseq.c",
- source_dir / "capsule.c",
- source_dir / "pysignals.c",
- source_dir / "pythread.c",
- source_dir / "ndarrayobject.c",
- source_dir / "missing.c",
- ],
+ separate_module_files= separate_module_files,
separate_module_sources=separate_module_sources,
compile_extra=compile_extra,
**kwds
@@ -1087,10 +1090,22 @@
return eci
+def setup_micronumpy(space):
+ use_micronumpy = space.config.objspace.usemodules.micronumpy
+ if not use_micronumpy:
+ return use_micronumpy
+ # import to register api functions by side-effect
+ import pypy.module.cpyext.ndarrayobject
+ global GLOBALS, SYMBOLS_C, separate_module_files
+ GLOBALS["PyArray_Type#"]= ('PyTypeObject*',
"space.gettypeobject(W_NDimArray.typedef)")
+ SYMBOLS_C += ['PyArray_Type', '_PyArray_FILLWBYTE', '_PyArray_ZEROS']
+ separate_module_files.append(source_dir / "ndarrayobject.c")
+ return use_micronumpy
def setup_library(space):
"NOT_RPYTHON"
from pypy.module.cpyext.pyobject import make_ref
+ use_micronumpy = setup_micronumpy(space)
export_symbols = list(FUNCTIONS) + SYMBOLS_C + list(GLOBALS)
from rpython.translator.c.database import LowLevelDatabase
@@ -1151,7 +1166,7 @@
setup_init_functions(eci, translating=True)
trunk_include = pypydir.dirpath() / 'include'
- copy_header_files(trunk_include)
+ copy_header_files(trunk_include, use_micronumpy)
def _load_from_cffi(space, name, path, initptr):
from pypy.module._cffi_backend import cffi1_module
diff --git a/pypy/module/cpyext/include/stringobject.h
b/pypy/module/cpyext/include/stringobject.h
--- a/pypy/module/cpyext/include/stringobject.h
+++ b/pypy/module/cpyext/include/stringobject.h
@@ -7,8 +7,8 @@
extern "C" {
#endif
-#define PyString_GET_SIZE(op) PyString_Size(op)
-#define PyString_AS_STRING(op) PyString_AsString(op)
+#define PyString_GET_SIZE(op) PyString_Size((PyObject*)(op))
+#define PyString_AS_STRING(op) PyString_AsString((PyObject*)(op))
typedef struct {
PyObject_HEAD
diff --git a/pypy/module/cpyext/test/test_api.py
b/pypy/module/cpyext/test/test_api.py
--- a/pypy/module/cpyext/test/test_api.py
+++ b/pypy/module/cpyext/test/test_api.py
@@ -98,7 +98,7 @@
def test_copy_header_files(tmpdir):
- api.copy_header_files(tmpdir)
+ api.copy_header_files(tmpdir, True)
def check(name):
f = tmpdir.join(name)
assert f.check(file=True)
diff --git a/pypy/objspace/std/mapdict.py b/pypy/objspace/std/mapdict.py
--- a/pypy/objspace/std/mapdict.py
+++ b/pypy/objspace/std/mapdict.py
@@ -116,7 +116,7 @@
def _find_map_attr(self, name, index):
while isinstance(self, PlainAttribute):
- if name == self.name and index == self.index:
+ if index == self.index and name == self.name:
return self
self = self.back
return None
@@ -156,7 +156,6 @@
jit.isconstant(name) and
jit.isconstant(index))
def add_attr(self, obj, name, index, w_value):
- # grumble, jit needs this
attr = self._get_new_attr(name, index)
oldattr = obj._get_mapdict_map()
if not jit.we_are_jitted():
@@ -296,7 +295,7 @@
new_obj._get_mapdict_map().add_attr(new_obj, self.name, self.index,
w_value)
def delete(self, obj, name, index):
- if name == self.name and index == self.index:
+ if index == self.index and name == self.name:
# ok, attribute is deleted
if not self.ever_mutated:
self.ever_mutated = True
diff --git a/pypy/objspace/std/setobject.py b/pypy/objspace/std/setobject.py
--- a/pypy/objspace/std/setobject.py
+++ b/pypy/objspace/std/setobject.py
@@ -942,7 +942,7 @@
return False
if w_set.length() == 0:
return True
- # it's possible to have 0-lenght strategy that's not empty
+ # it's possible to have 0-length strategy that's not empty
if w_set.strategy is w_other.strategy:
return self._issubset_unwrapped(w_set, w_other)
if not self.may_contain_equal_elements(w_other.strategy):
diff --git a/rpython/rtyper/tool/test/test_rffi_platform.py
b/rpython/rtyper/tool/test/test_rffi_platform.py
--- a/rpython/rtyper/tool/test/test_rffi_platform.py
+++ b/rpython/rtyper/tool/test/test_rffi_platform.py
@@ -277,10 +277,14 @@
assert not rffi_platform.has("x", "#include
<some/path/which/cannot/exist>")
def test_has_0002():
+ if platform.name == 'msvc':
+ py.test.skip('no m.lib in msvc')
assert rffi_platform.has("pow", "#include <math.h>", libraries=["m"])
def test_has_0003():
"""multiple libraries"""
+ if platform.name == 'msvc':
+ py.test.skip('no m.lib in msvc')
assert rffi_platform.has("pow", "#include <math.h>", libraries=["m", "c"])
def test_has_0004():
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit