[pypy-commit] pypy py3.5: hg merge default
rlamy
pypy.commits at gmail.com
Thu Jan 31 11:12:10 EST 2019
Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: py3.5
Changeset: r95756:e01a180ee74a
Date: 2019-01-31 16:11 +0000
http://bitbucket.org/pypy/pypy/changeset/e01a180ee74a/
Log: hg merge default
diff --git a/extra_tests/cffi_tests/cffi0/test_function.py b/extra_tests/cffi_tests/cffi0/test_function.py
--- a/extra_tests/cffi_tests/cffi0/test_function.py
+++ b/extra_tests/cffi_tests/cffi0/test_function.py
@@ -46,14 +46,15 @@
assert x != math.sin(1.23) # rounding effects
assert abs(x - math.sin(1.23)) < 1E-6
- def test_lround_no_return_value(self):
+ def test_getenv_no_return_value(self):
# check that 'void'-returning functions work too
ffi = FFI(backend=self.Backend())
ffi.cdef("""
- void lround(double x);
+ void getenv(char *);
""")
- m = ffi.dlopen(lib_m)
- x = m.lround(1.23)
+ needs_dlopen_none()
+ m = ffi.dlopen(None)
+ x = m.getenv(b"FOO")
assert x is None
def test_dlopen_filename(self):
diff --git a/pypy/doc/interpreter.rst b/pypy/doc/interpreter.rst
--- a/pypy/doc/interpreter.rst
+++ b/pypy/doc/interpreter.rst
@@ -156,7 +156,7 @@
environment found in `Frames`. Frames and Functions have references
to a code object. Here is a list of Code attributes:
-* ``co_flags`` flags if this code object has nested scopes/generators
+* ``co_flags`` flags if this code object has nested scopes/generators/etc.
* ``co_stacksize`` the maximum depth the stack can reach while executing the code
* ``co_code`` the actual bytecode string
diff --git a/pypy/doc/release-v7.0.0.rst b/pypy/doc/release-v7.0.0.rst
--- a/pypy/doc/release-v7.0.0.rst
+++ b/pypy/doc/release-v7.0.0.rst
@@ -107,7 +107,10 @@
``PyOS_InputHook``, ``PyErr_FormatFromCause`` (Py3.6),
* Implement new wordcode instruction encoding (Py3.6)
* Log additional gc-minor and gc-collect-step info in the PYPYLOG
-* Set ``reverse-debugger`` active by default. For more information, see
+* The ``reverse-debugger`` (revdb) branch has been merged to the default
+ branch, so it should always be up-to-date. You still need a special pypy
+ build, but you can compile it from the same source as the one we distribute
+ for the v7.0.0 release. For more information, see
https://bitbucket.org/pypy/revdb
* Support underscores in numerical literals like ``'4_2'`` (Py3.6)
* Pre-emptively raise MemoryError if the size of dequeue in ``_collections.deque``
@@ -126,7 +129,8 @@
* Speed up ``max(list-of-int)`` from non-jitted code
* Fix Windows ``os.listdir()`` for some cases (see CPython #32539)
* Add ``select.PIPE_BUF``
-* Use ``subprocess`` to avoid shell injection in ``shutil`` module
+* Use ``subprocess`` to avoid shell injection in ``shutil`` module - backport
+ of https://bugs.python.org/issue34540
* Rename ``_Py_ZeroStruct`` to ``_Py_FalseStruct`` (Py3.5, Py3.6)
* Remove some cpyext names for Py3.5, Py3.6
* Enable use of unicode file names in ``dlopen``
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
@@ -512,6 +512,7 @@
header = DEFAULT_HEADER
if func.__name__ in FUNCTIONS_BY_HEADER[header]:
raise ValueError("%s already registered" % func.__name__)
+ func._revdb_c_only_ = True # hack for revdb
api_function = COnlyApiFunction(argtypes, restype, func)
FUNCTIONS_BY_HEADER[header][func.__name__] = api_function
return api_function
diff --git a/rpython/rlib/rgc.py b/rpython/rlib/rgc.py
--- a/rpython/rlib/rgc.py
+++ b/rpython/rlib/rgc.py
@@ -67,7 +67,7 @@
"""Returns True if we have a "split GC address space", i.e. if
we are translating with an option that doesn't support taking raw
addresses inside GC objects and "hacking" at them. This is
- notably the case with --reversedb."""
+ notably the case with --revdb."""
return False
# for test purposes we allow objects to be pinned and use
diff --git a/rpython/rlib/src/boehm-rawrefcount.c b/rpython/rlib/src/boehm-rawrefcount.c
--- a/rpython/rlib/src/boehm-rawrefcount.c
+++ b/rpython/rlib/src/boehm-rawrefcount.c
@@ -191,6 +191,7 @@
#endif
assert(result->ob_refcnt == REFCNT_FROM_PYPY);
result->ob_refcnt = 1;
+ result->ob_pypy_link = 0;
p->pyobj = NULL;
*pp = p->next_in_bucket;
p->next_in_bucket = hash_free_list;
diff --git a/rpython/translator/revdb/gencsupp.py b/rpython/translator/revdb/gencsupp.py
--- a/rpython/translator/revdb/gencsupp.py
+++ b/rpython/translator/revdb/gencsupp.py
@@ -51,6 +51,10 @@
## return False
def prepare_function(funcgen):
+ if getattr(getattr(funcgen.graph, 'func', None), '_revdb_c_only_', False):
+ extra_enter_text = 'RPY_REVDB_C_ONLY_ENTER'
+ extra_return_text = 'RPY_REVDB_C_ONLY_LEAVE'
+ return extra_enter_text, extra_return_text
stack_bottom = False
for block in funcgen.graph.iterblocks():
for op in block.operations:
diff --git a/rpython/translator/revdb/src-revdb/revdb.c b/rpython/translator/revdb/src-revdb/revdb.c
--- a/rpython/translator/revdb/src-revdb/revdb.c
+++ b/rpython/translator/revdb/src-revdb/revdb.c
@@ -253,7 +253,10 @@
"(use REVDB=logfile)\n", (int)getpid());
}
- rpy_revdb.buf_p = rpy_rev_buffer + sizeof(int16_t);
+ if (rpy_rev_fileno >= 0)
+ rpy_revdb.buf_p = rpy_rev_buffer + sizeof(int16_t);
+ else
+ rpy_revdb.buf_p = NULL;
rpy_revdb.buf_limit = rpy_rev_buffer + sizeof(rpy_rev_buffer) - 32;
rpy_revdb.unique_id_seen = 1;
@@ -269,17 +272,23 @@
ssize_t full_size;
assert(rpy_revdb.lock);
+ if (rpy_revdb.buf_p == NULL)
+ return;
+ assert(rpy_rev_fileno >= 0);
+
/* write the current buffer content to the OS */
full_size = rpy_revdb.buf_p - rpy_rev_buffer;
rpy_revdb.buf_p = rpy_rev_buffer + sizeof(int16_t);
- if (rpy_rev_fileno >= 0)
- write_all(rpy_rev_buffer, full_size);
+ write_all(rpy_rev_buffer, full_size);
}
static ssize_t current_packet_size(void)
{
/* must be called with the lock held */
- return rpy_revdb.buf_p - (rpy_rev_buffer + sizeof(int16_t));
+ if (rpy_revdb.buf_p != NULL)
+ return rpy_revdb.buf_p - (rpy_rev_buffer + sizeof(int16_t));
+ else
+ return 0;
}
RPY_EXTERN
@@ -327,6 +336,11 @@
rpy_reverse_db_flush();
assert(current_packet_size() == 0);
+ if (rpy_rev_fileno < 0)
+ return;
+ /* should not be here from the middle of a @c_only function */
+ assert(rpy_revdb.buf_p != NULL);
+
*(int16_t *)p = async_code;
memcpy(rpy_revdb.buf_p, &content, sizeof(uint64_t));
rpy_revdb.buf_p += sizeof(uint64_t);
@@ -472,6 +486,9 @@
if (rpy_rev_fileno < 0)
return 1;
+ /* should not be here from the middle of a @c_only function */
+ assert(rpy_revdb.buf_p != NULL);
+
base_offset = lseek(rpy_rev_fileno, 0, SEEK_CUR);
if (base_offset < 0) {
perror("lseek");
@@ -488,6 +505,9 @@
if (rpy_rev_fileno < 0)
return;
+ /* should not be here from the middle of a @c_only function */
+ assert(rpy_revdb.buf_p != NULL);
+
base_offset = lseek(rpy_rev_fileno, 0, SEEK_CUR);
if (base_offset < 0) {
perror("lseek");
@@ -1033,9 +1053,9 @@
" echo 0 | sudo tee /proc/sys/kernel/randomize_va_space\n"
"\n"
"It has been reported that on Linux kernel 4.12.4-1-ARCH,\n"
- "ASLR cannot be disabled at all for libpypy-c.so. For now\n"
- "there is no good solution. Either you downgrade the\n"
- "kernel, or you translate with --no-shared (and you loose\n"
+ "ASLR cannot be disabled at all for libpypy-c.so. It works\n"
+ "again in kernel 4.19 (and maybe sooner). Either change\n"
+ "kernels, or translate with --no-shared (but then you loose\n"
"PyPy's cpyext ability).\n"
"\n", argv[0]);
exit(1);
diff --git a/rpython/translator/revdb/src-revdb/revdb_include.h b/rpython/translator/revdb/src-revdb/revdb_include.h
--- a/rpython/translator/revdb/src-revdb/revdb_include.h
+++ b/rpython/translator/revdb/src-revdb/revdb_include.h
@@ -16,7 +16,8 @@
#endif
bool_t watch_enabled;
int lock;
- char *buf_p, *buf_limit, *buf_readend;
+ char *buf_p; /* NULL during recording if recording is actually disabled */
+ char *buf_limit, *buf_readend;
uint64_t stop_point_seen, stop_point_break;
uint64_t unique_id_seen, unique_id_break;
} rpy_revdb_t;
@@ -85,9 +86,13 @@
{ \
decl_e = variable; \
_RPY_REVDB_PRINT("[ wr ]", _e); \
- memcpy(rpy_revdb.buf_p, &_e, sizeof(_e)); \
- if ((rpy_revdb.buf_p += sizeof(_e)) > rpy_revdb.buf_limit) \
- rpy_reverse_db_flush(); \
+ char *_dst = rpy_revdb.buf_p; \
+ if (_dst) { \
+ memcpy(_dst, &_e, sizeof(_e)); \
+ if ((rpy_revdb.buf_p = _dst + sizeof(_e)) \
+ > rpy_revdb.buf_limit) \
+ rpy_reverse_db_flush(); \
+ } \
}
#define _RPY_REVDB_EMIT_REPLAY(decl_e, variable) \
@@ -179,6 +184,13 @@
rpy_reverse_db_bad_acquire_gil("release"); \
}
+#define RPY_REVDB_C_ONLY_ENTER \
+ char *saved_bufp = rpy_revdb.buf_p; \
+ rpy_revdb.buf_p = NULL;
+
+#define RPY_REVDB_C_ONLY_LEAVE \
+ rpy_revdb.buf_p = saved_bufp;
+
#define RPY_REVDB_CALLBACKLOC(locnum) \
rpy_reverse_db_callback_loc(locnum)
More information about the pypy-commit
mailing list