[pypy-commit] pypy default: try a new ip for testing timeout

2014-04-23 Thread bdkearns
Author: Brian Kearns bdkea...@gmail.com
Branch: 
Changeset: r70882:31e6f79cf3eb
Date: 2014-04-23 02:26 -0400
http://bitbucket.org/pypy/pypy/changeset/31e6f79cf3eb/

Log:try a new ip for testing timeout

diff --git a/rpython/rlib/test/test_rsocket.py 
b/rpython/rlib/test/test_rsocket.py
--- a/rpython/rlib/test/test_rsocket.py
+++ b/rpython/rlib/test/test_rsocket.py
@@ -340,12 +340,8 @@
 def test_connect_with_timeout_fail():
 s = RSocket()
 s.settimeout(0.1)
-if sys.platform == 'win32':
-addr = '169.254.169.254'
-else:
-addr = '240.240.240.240'
 with py.test.raises(SocketTimeout):
-s.connect(INETAddress(addr, 12345))
+s.connect(INETAddress('10.255.255.10', 12345))
 s.close()
 
 def test_connect_with_timeout_succeed():
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy reflex-support: open up a few more 'dummy' tests

2014-04-23 Thread wlav
Author: Wim Lavrijsen wlavrij...@lbl.gov
Branch: reflex-support
Changeset: r70884:6400eef5ba99
Date: 2014-04-22 23:30 -0700
http://bitbucket.org/pypy/pypy/changeset/6400eef5ba99/

Log:open up a few more 'dummy' tests

diff --git a/pypy/module/cppyy/capi/capi_types.py 
b/pypy/module/cppyy/capi/capi_types.py
--- a/pypy/module/cppyy/capi/capi_types.py
+++ b/pypy/module/cppyy/capi/capi_types.py
@@ -1,7 +1,7 @@
 from rpython.rtyper.lltypesystem import rffi, lltype
 
 # shared ll definitions
-_C_OPAQUE_PTR = rffi.VOIDP
+_C_OPAQUE_PTR = rffi.LONG
 _C_OPAQUE_NULL = lltype.nullptr(rffi.LONGP.TO)# ALT: _C_OPAQUE_PTR.TO
 
 C_SCOPE = _C_OPAQUE_PTR
diff --git a/pypy/module/cppyy/include/capi.h b/pypy/module/cppyy/include/capi.h
--- a/pypy/module/cppyy/include/capi.h
+++ b/pypy/module/cppyy/include/capi.h
@@ -7,11 +7,11 @@
 extern C {
 #endif // ifdef __cplusplus
 
-typedef void* cppyy_scope_t;
+typedef long cppyy_scope_t;
 typedef cppyy_scope_t cppyy_type_t;
-typedef void* cppyy_object_t;
-typedef void* cppyy_method_t;
-typedef long  cppyy_index_t;
+typedef long cppyy_object_t;
+typedef long cppyy_method_t;
+typedef long cppyy_index_t;
 typedef void* (*cppyy_methptrgetter_t)(cppyy_object_t);
 
 /* name to opaque C++ scope representation 
 */
diff --git a/pypy/module/cppyy/include/cppyy.h 
b/pypy/module/cppyy/include/cppyy.h
--- a/pypy/module/cppyy/include/cppyy.h
+++ b/pypy/module/cppyy/include/cppyy.h
@@ -17,7 +17,7 @@
 #ifdef __cplusplus
 struct CPPYY_G__p2p {
 #else
-#typedef struct
+typedef struct {
 #endif
   long i;
   int reftype;
diff --git a/pypy/module/cppyy/interp_cppyy.py 
b/pypy/module/cppyy/interp_cppyy.py
--- a/pypy/module/cppyy/interp_cppyy.py
+++ b/pypy/module/cppyy/interp_cppyy.py
@@ -718,7 +718,6 @@
 def get_method_names(self):
 return self.space.newlist([self.space.wrap(name) for name in 
self.methods])
 
-@jit.elidable_promote('0')
 def get_overload(self, name):
 try:
 return self.methods[name]
@@ -731,7 +730,6 @@
 def get_datamember_names(self):
 return self.space.newlist([self.space.wrap(name) for name in 
self.datamembers])
 
-@jit.elidable_promote('0')
 def get_datamember(self, name):
 try:
 return self.datamembers[name]
@@ -741,7 +739,7 @@
 self.datamembers[name] = new_dm
 return new_dm
 
-@jit.elidable_promote('0')
+@jit.elidable_promote()
 def dispatch(self, name, signature):
 overload = self.get_overload(name)
 sig = '(%s)' % signature
diff --git a/pypy/module/cppyy/src/dummy_backend.cxx 
b/pypy/module/cppyy/src/dummy_backend.cxx
--- a/pypy/module/cppyy/src/dummy_backend.cxx
+++ b/pypy/module/cppyy/src/dummy_backend.cxx
@@ -5,6 +5,7 @@
 #include string
 #include vector
 
+#include assert.h
 #include stdlib.h
 #include string.h
 
@@ -15,22 +16,26 @@
 typedef std::mapstd::string, cppyy_scope_t  Handles_t;
 static Handles_t s_handles;
 
-class Cppyy_PseudoInfo {
-public:
-Cppyy_PseudoInfo(int num_methods=0, const char* methods[]=0) :
-m_num_methods(num_methods) {
-   m_methods.reserve(num_methods);
-   for (int i=0; i  num_methods; ++i) {
-   m_methods.push_back(methods[i]);
-   } 
-}
+struct Cppyy_PseudoMethodInfo {
+Cppyy_PseudoMethodInfo(const std::string name,
+   const std::vectorstd::string argtypes,
+   const std::string returntype) :
+m_name(name), m_argtypes(argtypes), m_returntype(returntype) {}
 
-public:
-int m_num_methods;
-std::vectorstd::string m_methods;
+std::string m_name;
+std::vectorstd::string m_argtypes;
+std::string m_returntype;
 };
 
-typedef std::mapcppyy_scope_t, Cppyy_PseudoInfo Scopes_t;
+struct Cppyy_PseudoClassInfo {
+Cppyy_PseudoClassInfo() {}
+Cppyy_PseudoClassInfo(const std::vectorCppyy_PseudoMethodInfo methods) :
+m_methods(methods ) {}
+
+std::vectorCppyy_PseudoMethodInfo m_methods;
+};
+
+typedef std::mapcppyy_scope_t, Cppyy_PseudoClassInfo Scopes_t;
 static Scopes_t s_scopes;
 
 struct Cppyy_InitPseudoReflectionInfo {
@@ -38,8 +43,31 @@
 // class example01 --
 static long s_scope_id = 0;
 s_handles[example01] = (cppyy_scope_t)++s_scope_id;
-const char* methods[] = {staticAddToDouble};
-Cppyy_PseudoInfo info(1, methods);
+
+std::vectorCppyy_PseudoMethodInfo methods;
+
+// static double staticAddToDouble(double a);
+std::vectorstd::string argtypes;
+argtypes.push_back(double);
+methods.push_back(Cppyy_PseudoMethodInfo(staticAddToDouble, 
argtypes, double));
+
+// static int staticAddOneToInt(int a);
+// static int staticAddOneToInt(int a, int b);
+argtypes.clear();
+argtypes.push_back(int);
+methods.push_back(Cppyy_PseudoMethodInfo(staticAddOneToInt, 
argtypes, int));
+argtypes.push_back(int);

[pypy-commit] pypy default: simplify

2014-04-23 Thread bdkearns
Author: Brian Kearns bdkea...@gmail.com
Branch: 
Changeset: r70886:4cedca9c5099
Date: 2014-04-23 02:47 -0400
http://bitbucket.org/pypy/pypy/changeset/4cedca9c5099/

Log:simplify

diff --git a/pypy/module/cppyy/converter.py b/pypy/module/cppyy/converter.py
--- a/pypy/module/cppyy/converter.py
+++ b/pypy/module/cppyy/converter.py
@@ -6,7 +6,7 @@
 from rpython.rlib.rarithmetic import r_singlefloat
 from rpython.rlib import jit_libffi, rfloat
 
-from pypy.module._rawffi.interp_rawffi import unpack_simple_shape
+from pypy.module._rawffi.interp_rawffi import letter2tp
 from pypy.module._rawffi.array import W_Array, W_ArrayInstance
 
 from pypy.module.cppyy import helper, capi, ffitypes
@@ -132,7 +132,7 @@
 def __getattr__(self, name):
 if name.startswith('array_'):
 typecode = name[len('array_'):]
-arr = self.space.interp_w(W_Array, unpack_simple_shape(self.space, 
self.space.wrap(typecode)))
+arr = self.space.interp_w(W_Array, letter2tp(self.space, typecode))
 setattr(self, name, arr)
 return arr
 raise AttributeError(name)
@@ -409,7 +409,7 @@
 if ptrval == 0:
 from pypy.module.cppyy import interp_cppyy
 return interp_cppyy.get_nullptr(space)
-arr = space.interp_w(W_Array, unpack_simple_shape(space, 
space.wrap('P')))
+arr = space.interp_w(W_Array, letter2tp(space, 'P'))
 return arr.fromaddress(space, ptrval, sys.maxint)
 
 def to_memory(self, space, w_obj, w_value, offset):
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] stmgc default: Add description

2014-04-23 Thread arigo
Author: Armin Rigo ar...@tunes.org
Branch: 
Changeset: r1178:3f334984ef30
Date: 2014-04-23 09:43 +0200
http://bitbucket.org/pypy/stmgc/changeset/3f334984ef30/

Log:Add description

diff --git a/c7/stm/core.h b/c7/stm/core.h
--- a/c7/stm/core.h
+++ b/c7/stm/core.h
@@ -151,7 +151,10 @@
 /* This lock is acquired when that segment calls synchronize_object_now.
On the rare event of a page_privatize(), the latter will acquire
all the locks in all segments.  Otherwise, for the common case,
-   it's cheap. */
+   it's cheap.  (The set of all 'privatization_lock' in all segments
+   works like one single read-write lock, with page_privatize() acquiring
+   the write lock; but this variant is more efficient for the case of
+   many reads / rare writes.) */
 uint8_t privatization_lock;
 
 /* In case of abort, we restore the 'shadowstack' field and the
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: move dump_storage to tests and don't use it during normal run (it's mostly

2014-04-23 Thread fijal
Author: Maciej Fijalkowski fij...@gmail.com
Branch: 
Changeset: r70887:c95bd1d4e622
Date: 2014-04-23 10:16 +0200
http://bitbucket.org/pypy/pypy/changeset/c95bd1d4e622/

Log:move dump_storage to tests and don't use it during normal run (it's
mostly useless and very verbose)

diff --git a/rpython/jit/metainterp/resume.py b/rpython/jit/metainterp/resume.py
--- a/rpython/jit/metainterp/resume.py
+++ b/rpython/jit/metainterp/resume.py
@@ -385,7 +385,6 @@
 self._add_pending_fields(pending_setfields)
 
 storage.rd_consts = self.memo.consts
-dump_storage(storage, liveboxes)
 return liveboxes[:]
 
 def _number_virtuals(self, liveboxes, optimizer, num_env_virtuals):
@@ -1457,50 +1456,3 @@
 
 def int_add_const(self, base, offset):
 return base + offset
-
-# 
-
-def dump_storage(storage, liveboxes):
-For profiling only.
-debug_start(jit-resume)
-if have_debug_prints():
-debug_print('Log storage', compute_unique_id(storage))
-frameinfo = storage.rd_frame_info_list
-while frameinfo is not None:
-try:
-jitcodename = frameinfo.jitcode.name
-except AttributeError:
-jitcodename = str(compute_unique_id(frameinfo.jitcode))
-debug_print('\tjitcode/pc', jitcodename,
-frameinfo.pc,
-'at', compute_unique_id(frameinfo))
-frameinfo = frameinfo.prev
-numb = storage.rd_numb
-while numb:
-debug_print('\tnumb', str([untag(numb.nums[i])
-   for i in range(len(numb.nums))]),
-'at', compute_unique_id(numb))
-numb = numb.prev
-for const in storage.rd_consts:
-debug_print('\tconst', const.repr_rpython())
-for box in liveboxes:
-if box is None:
-debug_print('\tbox', 'None')
-else:
-debug_print('\tbox', box.repr_rpython())
-if storage.rd_virtuals is not None:
-for virtual in storage.rd_virtuals:
-if virtual is None:
-debug_print('\t\t', 'None')
-else:
-virtual.debug_prints()
-if storage.rd_pendingfields:
-debug_print('\tpending setfields')
-for i in range(len(storage.rd_pendingfields)):
-lldescr = storage.rd_pendingfields[i].lldescr
-num = storage.rd_pendingfields[i].num
-fieldnum = storage.rd_pendingfields[i].fieldnum
-itemindex = storage.rd_pendingfields[i].itemindex
-debug_print(\t\t, str(lldescr), str(untag(num)), 
str(untag(fieldnum)), itemindex)
-
-debug_stop(jit-resume)
diff --git a/rpython/jit/metainterp/test/test_resume.py 
b/rpython/jit/metainterp/test/test_resume.py
--- a/rpython/jit/metainterp/test/test_resume.py
+++ b/rpython/jit/metainterp/test/test_resume.py
@@ -31,7 +31,55 @@
 except KeyError:
 value = self.values[box] = OptValue(box)
 return value
-
+
+
+# 
+
+def dump_storage(storage, liveboxes):
+For profiling only.
+debug_start(jit-resume)
+if have_debug_prints():
+debug_print('Log storage', compute_unique_id(storage))
+frameinfo = storage.rd_frame_info_list
+while frameinfo is not None:
+try:
+jitcodename = frameinfo.jitcode.name
+except AttributeError:
+jitcodename = str(compute_unique_id(frameinfo.jitcode))
+debug_print('\tjitcode/pc', jitcodename,
+frameinfo.pc,
+'at', compute_unique_id(frameinfo))
+frameinfo = frameinfo.prev
+numb = storage.rd_numb
+while numb:
+debug_print('\tnumb', str([untag(numb.nums[i])
+   for i in range(len(numb.nums))]),
+'at', compute_unique_id(numb))
+numb = numb.prev
+for const in storage.rd_consts:
+debug_print('\tconst', const.repr_rpython())
+for box in liveboxes:
+if box is None:
+debug_print('\tbox', 'None')
+else:
+debug_print('\tbox', box.repr_rpython())
+if storage.rd_virtuals is not None:
+for virtual in storage.rd_virtuals:
+if virtual is None:
+debug_print('\t\t', 'None')
+else:
+virtual.debug_prints()
+if storage.rd_pendingfields:
+debug_print('\tpending setfields')
+for i in range(len(storage.rd_pendingfields)):
+lldescr = storage.rd_pendingfields[i].lldescr
+num = storage.rd_pendingfields[i].num
+fieldnum = 

[pypy-commit] stmgc default: add function to hint another thread to commit soon. used in contention.c to

2014-04-23 Thread Raemi
Author: Remi Meier remi.me...@inf.ethz.ch
Branch: 
Changeset: r1179:c79d45878460
Date: 2014-04-23 14:56 +0200
http://bitbucket.org/pypy/stmgc/changeset/c79d45878460/

Log:add function to hint another thread to commit soon. used in
contention.c to advise committing transactions that cause others to
abort.

diff --git a/c7/demo/demo2.c b/c7/demo/demo2.c
--- a/c7/demo/demo2.c
+++ b/c7/demo/demo2.c
@@ -44,6 +44,7 @@
 visit((object_t **)n-next);
 }
 
+void stmcb_commit_soon() {}
 
 nodeptr_t global_chained_list;
 
diff --git a/c7/demo/demo_largemalloc.c b/c7/demo/demo_largemalloc.c
--- a/c7/demo/demo_largemalloc.c
+++ b/c7/demo/demo_largemalloc.c
@@ -23,6 +23,8 @@
 abort();
 }
 
+void stmcb_commit_soon() {}
+
 //
 
 #define ARENA_SIZE  (1024*1024*1024)
diff --git a/c7/demo/demo_random.c b/c7/demo/demo_random.c
--- a/c7/demo/demo_random.c
+++ b/c7/demo/demo_random.c
@@ -79,6 +79,8 @@
 assert(n-next == *last_next);
 }
 
+void stmcb_commit_soon() {}
+
 int get_rand(int max)
 {
 if (max == 0)
diff --git a/c7/demo/demo_simple.c b/c7/demo/demo_simple.c
--- a/c7/demo/demo_simple.c
+++ b/c7/demo/demo_simple.c
@@ -39,6 +39,8 @@
 visit((object_t **)n-next);
 }
 
+void stmcb_commit_soon() {}
+
 
 
 static sem_t done;
diff --git a/c7/stm/contention.c b/c7/stm/contention.c
--- a/c7/stm/contention.c
+++ b/c7/stm/contention.c
@@ -164,7 +164,8 @@
 
 change_timing_state(wait_category);
 
-/* XXX should also tell other_pseg please commit soon */
+/* tell the other to commit ASAP */
+signal_other_to_commit_soon(contmgr.other_pseg);
 
 dprintf((pausing...\n));
 cond_signal(C_AT_SAFE_POINT);
@@ -180,6 +181,9 @@
 }
 
 else if (!contmgr.abort_other) {
+/* tell the other to commit ASAP, since it causes aborts */
+signal_other_to_commit_soon(contmgr.other_pseg);
+
 dprintf((abort in contention\n));
 STM_SEGMENT-nursery_end = abort_category;
 abort_with_mutex();
@@ -256,6 +260,10 @@
 abort_data_structures_from_segment_num(other_segment_num);
 }
 dprintf((killed other thread\n));
+
+/* we should commit soon, we caused an abort */
+
//signal_other_to_commit_soon(get_priv_segment(STM_SEGMENT-segment_num));
+stmcb_commit_soon();
 }
 }
 
diff --git a/c7/stm/contention.h b/c7/stm/contention.h
--- a/c7/stm/contention.h
+++ b/c7/stm/contention.h
@@ -4,7 +4,8 @@
 static void inevitable_contention_management(uint8_t other_segment_num);
 
 static inline bool is_abort(uintptr_t nursery_end) {
-return (nursery_end = _STM_NSE_SIGNAL_MAX  nursery_end != NSE_SIGPAUSE);
+return (nursery_end = _STM_NSE_SIGNAL_MAX  nursery_end != NSE_SIGPAUSE
+ nursery_end != NSE_SIGCOMMITSOON);
 }
 
 static inline bool is_aborting_now(uint8_t other_segment_num) {
diff --git a/c7/stm/nursery.h b/c7/stm/nursery.h
--- a/c7/stm/nursery.h
+++ b/c7/stm/nursery.h
@@ -1,6 +1,7 @@
 
 /* '_stm_nursery_section_end' is either NURSERY_END or NSE_SIGxxx */
 #define NSE_SIGPAUSE   STM_TIME_WAIT_OTHER
+#define NSE_SIGCOMMITSOON   STM_TIME_SYNC_COMMIT_SOON
 
 
 static uint32_t highest_overflow_number;
diff --git a/c7/stm/sync.c b/c7/stm/sync.c
--- a/c7/stm/sync.c
+++ b/c7/stm/sync.c
@@ -2,6 +2,10 @@
 #include sys/prctl.h
 #include asm/prctl.h
 
+#ifndef _STM_CORE_H_
+# error must be compiled via stmgc.c
+#endif
+
 
 /* Each segment can be in one of three possible states, described by
the segment variable 'safe_point':
@@ -260,6 +264,16 @@
 static bool _safe_points_requested = false;
 #endif
 
+static void signal_other_to_commit_soon(struct stm_priv_segment_info_s 
*other_pseg)
+{
+assert(_has_mutex());
+/* never overwrite abort signals or safepoint requests
+   (too messy to deal with) */
+if (!is_abort(other_pseg-pub.nursery_end)
+ !pause_signalled)
+other_pseg-pub.nursery_end = NSE_SIGCOMMITSOON;
+}
+
 static void signal_everybody_to_pause_running(void)
 {
 assert(_safe_points_requested == false);
@@ -323,7 +337,20 @@
 if (STM_SEGMENT-nursery_end == NURSERY_END)
 break;/* no safe point requested */
 
+if (STM_SEGMENT-nursery_end == NSE_SIGCOMMITSOON) {
+if (previous_state == -1) {
+previous_state = 
change_timing_state(STM_TIME_SYNC_COMMIT_SOON);
+}
+
+stmcb_commit_soon();
+if (!pause_signalled) {
+STM_SEGMENT-nursery_end = NURSERY_END;
+break;
+}
+STM_SEGMENT-nursery_end = NSE_SIGPAUSE;
+}
 assert(STM_SEGMENT-nursery_end == NSE_SIGPAUSE);
+assert(pause_signalled);
 
 /* If we are requested to enter a safe-point, we cannot proceed now.
Wait until the safe-point request is removed for us. */
diff --git a/c7/stm/timing.c b/c7/stm/timing.c
--- a/c7/stm/timing.c
+++ b/c7/stm/timing.c
@@ 

[pypy-commit] cffi default: Issue 153: Generate same C code for CPython 2 and 3

2014-04-23 Thread dalcinl
Author: Lisandro Dalcin dalc...@gmail.com
Branch: 
Changeset: r1503:bcedf12c6e01
Date: 2014-04-23 16:10 +0300
http://bitbucket.org/cffi/cffi/changeset/bcedf12c6e01/

Log:Issue 153: Generate same C code for CPython 2 and 3

- CPython 2 and 3: make ffi.ferify() generate identical C code
- CPython 3: fix refcount management in case of errors at import

diff --git a/cffi/vengine_cpy.py b/cffi/vengine_cpy.py
--- a/cffi/vengine_cpy.py
+++ b/cffi/vengine_cpy.py
@@ -96,36 +96,47 @@
 #
 # standard init.
 modname = self.verifier.get_module_name()
-if sys.version_info = (3,):
-prnt('static struct PyModuleDef _cffi_module_def = {')
-prnt('  PyModuleDef_HEAD_INIT,')
-prnt('  %s,' % modname)
-prnt('  NULL,')
-prnt('  -1,')
-prnt('  _cffi_methods,')
-prnt('  NULL, NULL, NULL, NULL')
-prnt('};')
-prnt()
-initname = 'PyInit_%s' % modname
-createmod = 'PyModule_Create(_cffi_module_def)'
-errorcase = 'return NULL'
-finalreturn = 'return lib'
-else:
-initname = 'init%s' % modname
-createmod = 'Py_InitModule(%s, _cffi_methods)' % modname
-errorcase = 'return'
-finalreturn = 'return'
+constants = self._chained_list_constants[False]
+prnt('#if PY_MAJOR_VERSION = 3')
+prnt()
+prnt('static struct PyModuleDef _cffi_module_def = {')
+prnt('  PyModuleDef_HEAD_INIT,')
+prnt('  %s,' % modname)
+prnt('  NULL,')
+prnt('  -1,')
+prnt('  _cffi_methods,')
+prnt('  NULL, NULL, NULL, NULL')
+prnt('};')
+prnt()
 prnt('PyMODINIT_FUNC')
-prnt('%s(void)' % initname)
+prnt('PyInit_%s(void)' % modname)
 prnt('{')
 prnt('  PyObject *lib;')
-prnt('  lib = %s;' % createmod)
-prnt('  if (lib == NULL || %s  0)' % (
-self._chained_list_constants[False],))
-prnt('%s;' % errorcase)
-prnt('  _cffi_init();')
-prnt('  %s;' % finalreturn)
+prnt('  lib = PyModule_Create(_cffi_module_def);')
+prnt('  if (lib == NULL)')
+prnt('return NULL;')
+prnt('  if (%s  0 || _cffi_init()  0) {' % (constants,))
+prnt('Py_DECREF(lib);')
+prnt('return NULL;')
+prnt('  }')
+prnt('  return lib;')
 prnt('}')
+prnt()
+prnt('#else')
+prnt()
+prnt('PyMODINIT_FUNC')
+prnt('init%s(void)' % modname)
+prnt('{')
+prnt('  PyObject *lib;')
+prnt('  lib = Py_InitModule(%s, _cffi_methods);' % modname)
+prnt('  if (lib == NULL)')
+prnt('return;')
+prnt('  if (%s  0 || _cffi_init()  0)' % (constants,))
+prnt('return;')
+prnt('  return;')
+prnt('}')
+prnt()
+prnt('#endif')
 
 def load_library(self):
 # XXX review all usages of 'self' here!
@@ -894,25 +905,32 @@
 return PyBool_FromLong(was_alive);
 }
 
-static void _cffi_init(void)
+static int _cffi_init(void)
 {
-PyObject *module = PyImport_ImportModule(_cffi_backend);
-PyObject *c_api_object;
+PyObject *module, *c_api_object = NULL;
 
+module = PyImport_ImportModule(_cffi_backend);
 if (module == NULL)
-return;
+goto failure;
 
 c_api_object = PyObject_GetAttrString(module, _C_API);
 if (c_api_object == NULL)
-return;
+goto failure;
 if (!PyCapsule_CheckExact(c_api_object)) {
-Py_DECREF(c_api_object);
 PyErr_SetNone(PyExc_ImportError);
-return;
+goto failure;
 }
 memcpy(_cffi_exports, PyCapsule_GetPointer(c_api_object, cffi),
_CFFI_NUM_EXPORTS * sizeof(void *));
+
+Py_DECREF(module);
 Py_DECREF(c_api_object);
+return 0;
+
+  failure:
+Py_XDECREF(module);
+Py_XDECREF(c_api_object);
+return -1;
 }
 
 #define _cffi_type(num) ((CTypeDescrObject *)PyList_GET_ITEM(_cffi_types, num))
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] stmgc marker: in-progress: record markers corresponding to old_modified_objects

2014-04-23 Thread arigo
Author: Armin Rigo ar...@tunes.org
Branch: marker
Changeset: r1180:3cdcd273d6d3
Date: 2014-04-23 17:01 +0200
http://bitbucket.org/pypy/stmgc/changeset/3cdcd273d6d3/

Log:in-progress: record markers corresponding to old_modified_objects

diff --git a/c7/stm/core.c b/c7/stm/core.c
--- a/c7/stm/core.c
+++ b/c7/stm/core.c
@@ -86,6 +86,13 @@
Add it to the list 'modified_old_objects'. */
 LIST_APPEND(STM_PSEGMENT-modified_old_objects, obj);
 
+/* Add the current marker, recording where we wrote to this object */
+uintptr_t marker[2];
+marker_fetch(STM_SEGMENT-running_thread, marker);
+STM_PSEGMENT-modified_old_objects_markers =
+list_append2(STM_PSEGMENT-modified_old_objects_markers,
+ marker[0], marker[1]);
+
 /* We need to privatize the pages containing the object, if they
are still SHARED_PAGE.  The common case is that there is only
one page in total. */
@@ -223,12 +230,17 @@
 }
 
 assert(list_is_empty(STM_PSEGMENT-modified_old_objects));
+assert(list_is_empty(STM_PSEGMENT-modified_old_objects_markers));
 assert(list_is_empty(STM_PSEGMENT-young_weakrefs));
 assert(tree_is_cleared(STM_PSEGMENT-young_outside_nursery));
 assert(tree_is_cleared(STM_PSEGMENT-nursery_objects_shadows));
 assert(tree_is_cleared(STM_PSEGMENT-callbacks_on_abort));
 assert(STM_PSEGMENT-objects_pointing_to_nursery == NULL);
 assert(STM_PSEGMENT-large_overflow_objects == NULL);
+#ifndef NDEBUG
+/* this should not be used when objects_pointing_to_nursery == NULL */
+STM_PSEGMENT-modified_old_objects_markers_num_old = 9L;
+#endif
 
 check_nursery_at_transaction_start();
 }
@@ -458,6 +470,7 @@
 }));
 
 list_clear(STM_PSEGMENT-modified_old_objects);
+list_clear(STM_PSEGMENT-modified_old_objects_markers);
 }
 
 static void _finish_transaction(int attribute_to)
@@ -596,6 +609,7 @@
 }));
 
 list_clear(pseg-modified_old_objects);
+list_clear(pseg-modified_old_objects_markers);
 }
 
 static void abort_data_structures_from_segment_num(int segment_num)
diff --git a/c7/stm/core.h b/c7/stm/core.h
--- a/c7/stm/core.h
+++ b/c7/stm/core.h
@@ -78,9 +78,17 @@
 /* List of old objects (older than the current transaction) that the
current transaction attempts to modify.  This is used to track
the STM status: they are old objects that where written to and
-   that need to be copied to other segments upon commit. */
+   that need to be copied to other segments upon commit.  Note that
+   every object takes three list items: the object, and two words for
+   the location marker. */
 struct list_s *modified_old_objects;
 
+/* For each entry in 'modified_old_objects', we have two entries
+   in the following list, which give the marker at the time we added
+   the entry to modified_old_objects. */
+struct list_s *modified_old_objects_markers;
+uintptr_t modified_old_objects_markers_num_old;
+
 /* List of out-of-nursery objects that may contain pointers to
nursery objects.  This is used to track the GC status: they are
all objects outside the nursery on which an stm_write() occurred
diff --git a/c7/stm/gcpage.c b/c7/stm/gcpage.c
--- a/c7/stm/gcpage.c
+++ b/c7/stm/gcpage.c
@@ -418,6 +418,19 @@
 }
 }
 
+static void mark_visit_from_markers(void)
+{
+long j;
+for (j = 1; j = NB_SEGMENTS; j++) {
+char *base = get_segment_base(j);
+struct list_s *lst = get_priv_segment(j)-modified_old_objects_markers;
+uintptr_t i;
+for (i = list_count(lst); i  0; i -= 2) {
+mark_visit_object((object_t *)list_item(lst, i - 1), base);
+}
+}
+}
+
 static void clean_up_segment_lists(void)
 {
 long i;
@@ -520,6 +533,7 @@
 /* marking */
 LIST_CREATE(mark_objects_to_trace);
 mark_visit_from_modified_objects();
+mark_visit_from_markers();
 mark_visit_from_roots();
 LIST_FREE(mark_objects_to_trace);
 
diff --git a/c7/stm/list.h b/c7/stm/list.h
--- a/c7/stm/list.h
+++ b/c7/stm/list.h
@@ -33,6 +33,18 @@
 
 #define LIST_APPEND(lst, e)   ((lst) = list_append((lst), (uintptr_t)(e)))
 
+static inline struct list_s *list_append2(struct list_s *lst,
+  uintptr_t item0, uintptr_t item1)
+{
+uintptr_t index = lst-count;
+lst-count += 2;
+if (UNLIKELY(index = lst-last_allocated))
+lst = _list_grow(lst, index + 1);
+lst-items[index + 0] = item0;
+lst-items[index + 1] = item1;
+return lst;
+}
+
 
 static inline void list_clear(struct list_s *lst)
 {
@@ -66,6 +78,11 @@
 lst-items[index] = newitem;
 }
 
+static inline uintptr_t *list_ptr_to_item(struct list_s *lst, uintptr_t index)
+{
+return lst-items[index];
+}
+
 #define LIST_FOREACH_R(lst, TYPE, CODE) \
 do {\
 struct list_s 

[pypy-commit] cffi default: CPython: Initialize all slots of PyMethodDef table

2014-04-23 Thread dalcinl
Author: Lisandro Dalcin dalc...@gmail.com
Branch: 
Changeset: r1504:cc11d18fb59b
Date: 2014-04-23 17:35 +0300
http://bitbucket.org/cffi/cffi/changeset/cc11d18fb59b/

Log:CPython: Initialize all slots of PyMethodDef table

- Silent GCC -Wmissing-field-initializers

diff --git a/cffi/vengine_cpy.py b/cffi/vengine_cpy.py
--- a/cffi/vengine_cpy.py
+++ b/cffi/vengine_cpy.py
@@ -89,8 +89,8 @@
 # by generate_cpy_function_method().
 prnt('static PyMethodDef _cffi_methods[] = {')
 self._generate(method)
-prnt('  {_cffi_setup, _cffi_setup, METH_VARARGS},')
-prnt('  {NULL, NULL}/* Sentinel */')
+prnt('  {_cffi_setup, _cffi_setup, METH_VARARGS, NULL},')
+prnt('  {NULL, NULL, 0, NULL}/* Sentinel */')
 prnt('};')
 prnt()
 #
@@ -405,7 +405,7 @@
 meth = 'METH_O'
 else:
 meth = 'METH_VARARGS'
-self._prnt('  {%s, _cffi_f_%s, %s},' % (name, name, meth))
+self._prnt('  {%s, _cffi_f_%s, %s, NULL},' % (name, name, meth))
 
 _loading_cpy_function = _loaded_noop
 
@@ -492,8 +492,8 @@
 if tp.fldnames is None:
 return # nothing to do with opaque structs
 layoutfuncname = '_cffi_layout_%s_%s' % (prefix, name)
-self._prnt('  {%s, %s, METH_NOARGS},' % (layoutfuncname,
-   layoutfuncname))
+self._prnt('  {%s, %s, METH_NOARGS, NULL},' % (layoutfuncname,
+ layoutfuncname))
 
 def _loading_struct_or_union(self, tp, prefix, name, module):
 if tp.fldnames is None:
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: Speed up zlib a bit by using memcpy in place a loop

2014-04-23 Thread alex_gaynor
Author: Alex Gaynor alex.gay...@gmail.com
Branch: 
Changeset: r70888:c65c33511bc7
Date: 2014-04-23 10:34 -0700
http://bitbucket.org/pypy/pypy/changeset/c65c33511bc7/

Log:Speed up zlib a bit by using memcpy in place a loop

diff --git a/rpython/rlib/rzlib.py b/rpython/rlib/rzlib.py
--- a/rpython/rlib/rzlib.py
+++ b/rpython/rlib/rzlib.py
@@ -3,7 +3,9 @@
 
 from rpython.rlib import rgc
 from rpython.rlib.rstring import StringBuilder
+from rpython.rtyper.annlowlevel import llstr
 from rpython.rtyper.lltypesystem import rffi, lltype
+from rpython.rtyper.lltypesystem.rstr import copy_string_to_raw
 from rpython.rtyper.tool import rffi_platform
 from rpython.translator.platform import platform as compiler, CompilationError
 from rpython.translator.tool.cbuild import ExternalCompilationInfo
@@ -347,8 +349,7 @@
 
 # Prepare the input buffer for the stream
 with lltype.scoped_alloc(rffi.CCHARP.TO, len(data)) as inbuf:
-for i in xrange(len(data)):
-inbuf[i] = data[i]
+copy_string_to_raw(llstr(data), inbuf, 0, len(data))
 stream.c_next_in = rffi.cast(Bytefp, inbuf)
 rffi.setintfield(stream, 'c_avail_in', len(data))
 
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: Remove an unused library from rlib

2014-04-23 Thread alex_gaynor
Author: Alex Gaynor alex.gay...@gmail.com
Branch: 
Changeset: r70889:7c640eb29429
Date: 2014-04-23 11:08 -0700
http://bitbucket.org/pypy/pypy/changeset/7c640eb29429/

Log:Remove an unused library from rlib

diff --git a/rpython/rlib/bitmanipulation.py b/rpython/rlib/bitmanipulation.py
deleted file mode 100644
--- a/rpython/rlib/bitmanipulation.py
+++ /dev/null
@@ -1,32 +0,0 @@
-from rpython.rlib import unroll
-
-
-class BitSplitter(dict):
-def __getitem__(self, lengths):
-if isinstance(lengths, int):
-lengths = (lengths, )
-if lengths in self:
-return dict.__getitem__(self, lengths)
-unrolling_lenghts = unroll.unrolling_iterable(lengths)
-def splitbits(integer):
-result = ()
-sum = 0
-for length in unrolling_lenghts:
-sum += length
-n = integer  ((1length) - 1)
-assert n = 0
-result += (n, )
-integer = integer  length
-assert sum = 32
-return result
-splitbits.func_name += _ + _.join([str(i) for i in lengths])
-self[lengths] = splitbits
-return splitbits
-
-def _freeze_(self):
-# as this class is not in __builtin__, we need to explicitly tell
-# the flow space that the object is frozen and the accesses can
-# be constant-folded.
-return True
-
-splitter = BitSplitter()
diff --git a/rpython/rlib/test/test_bitmanipulation.py 
b/rpython/rlib/test/test_bitmanipulation.py
deleted file mode 100644
--- a/rpython/rlib/test/test_bitmanipulation.py
+++ /dev/null
@@ -1,15 +0,0 @@
-from rpython.rlib.bitmanipulation import splitter
-
-
-def test_simple_splitbits():
-assert ((1, ) * 4) == splitter[8,8,8,8](0x01010101)
-assert ((255, ) * 4) == splitter[8,8,8,8](0xFfFfFfFf)
-
-def test_fancy_splitbits():
-assert (4,3,2,1) == splitter[8,8,8,8](0x01020304)
-assert (1,3,7,15) == splitter[1,2,3,4](0xFfFfFfFf)
-
-def test_format_splitbits():
-x = 0xAA
-assert (x  3, ) == splitter[2](x)
- 
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: fix ufunc reduce with single axis tuple (issue1718)

2014-04-23 Thread bdkearns
Author: Brian Kearns bdkea...@gmail.com
Branch: 
Changeset: r70890:d91034c74551
Date: 2014-04-23 15:17 -0400
http://bitbucket.org/pypy/pypy/changeset/d91034c74551/

Log:fix ufunc reduce with single axis tuple (issue1718)

diff --git a/pypy/module/micronumpy/compile.py 
b/pypy/module/micronumpy/compile.py
--- a/pypy/module/micronumpy/compile.py
+++ b/pypy/module/micronumpy/compile.py
@@ -136,6 +136,11 @@
 def newcomplex(self, r, i):
 return ComplexObject(r, i)
 
+def getitem(self, obj, index):
+assert isinstance(obj, ListObject)
+assert isinstance(index, IntObject)
+return obj.items[index.intval]
+
 def listview(self, obj, number=-1):
 assert isinstance(obj, ListObject)
 if number != -1:
diff --git a/pypy/module/micronumpy/test/test_ndarray.py 
b/pypy/module/micronumpy/test/test_ndarray.py
--- a/pypy/module/micronumpy/test/test_ndarray.py
+++ b/pypy/module/micronumpy/test/test_ndarray.py
@@ -1506,6 +1506,9 @@
 from numpypy import array, zeros
 a = array([-1.2, 3.4, 5.7, -3.0, 2.7])
 assert a.max() == 5.7
+assert a.max().shape == ()
+assert a.max(axis=(0,)) == 5.7
+assert a.max(axis=(0,)).shape == ()
 assert a.max(keepdims=True) == 5.7
 assert a.max(keepdims=True).shape == (1,)
 b = array([])
@@ -1521,6 +1524,9 @@
 from numpypy import array, zeros
 a = array([-1.2, 3.4, 5.7, -3.0, 2.7])
 assert a.min() == -3.0
+assert a.min().shape == ()
+assert a.min(axis=(0,)) == -3.0
+assert a.min(axis=(0,)).shape == ()
 assert a.min(keepdims=True) == -3.0
 assert a.min(keepdims=True).shape == (1,)
 b = array([])
diff --git a/pypy/module/micronumpy/test/test_ufuncs.py 
b/pypy/module/micronumpy/test/test_ufuncs.py
--- a/pypy/module/micronumpy/test/test_ufuncs.py
+++ b/pypy/module/micronumpy/test/test_ufuncs.py
@@ -772,6 +772,7 @@
 
 a = zeros((2, 2)) + 1
 assert (add.reduce(a, axis=1) == [2, 2]).all()
+assert (add.reduce(a, axis=(1,)) == [2, 2]).all()
 exc = raises(ValueError, add.reduce, a, axis=2)
 assert exc.value[0] == 'axis' entry is out of bounds
 
diff --git a/pypy/module/micronumpy/ufuncs.py b/pypy/module/micronumpy/ufuncs.py
--- a/pypy/module/micronumpy/ufuncs.py
+++ b/pypy/module/micronumpy/ufuncs.py
@@ -178,6 +178,8 @@
 if space.is_none(w_axis):
 axis = maxint
 else:
+if space.isinstance_w(w_axis, space.w_tuple) and 
space.len_w(w_axis) == 1:
+w_axis = space.getitem(w_axis, space.wrap(0))
 axis = space.int_w(w_axis)
 if axis  -shapelen or axis = shapelen:
 raise oefmt(space.w_ValueError, 'axis' entry is out of 
bounds)
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: copy release announcement from release-2.3.x branch

2014-04-23 Thread mattip
Author: Matti Picus matti.pi...@gmail.com
Branch: 
Changeset: r70891:eca7b4daa067
Date: 2014-04-23 22:41 +0300
http://bitbucket.org/pypy/pypy/changeset/eca7b4daa067/

Log:copy release announcement from release-2.3.x branch

diff --git a/pypy/doc/release-2.3.0.rst b/pypy/doc/release-2.3.0.rst
new file mode 100644
--- /dev/null
+++ b/pypy/doc/release-2.3.0.rst
@@ -0,0 +1,88 @@
+===
+PyPy 2.3 -  TODO
+===
+
+We're pleased to announce PyPy 2.3, which targets version 2.7.6 of the Python
+language. This release updates the stdlib from 2.7.3, jumping directly to 
2.7.6.
+
+This release also contains several bugfixes and performance improvements. 
+
+You can download the PyPy 2.3 release here:
+
+http://pypy.org/download.html
+
+We would like to thank our donors for the continued support of the PyPy
+project. We showed quite a bit of progress on all three projects (see below)
+and we're slowly running out of funds.
+Please consider donating more so we can finish those projects!  The three
+projects are:
+
+* Py3k (supporting Python 3.x): the release PyPy3 2.2 is imminent.
+
+* STM (software transactional memory): a preview will be released very soon,
+  as soon as we fix a few bugs
+
+* NumPy: the work done is included in the PyPy 2.2 release. More details below.
+
+.. _`Raspberry Pi Foundation`: http://www.raspberrypi.org
+
+What is PyPy?
+=
+
+PyPy is a very compliant Python interpreter, almost a drop-in replacement for
+CPython 2.7. It's fast (`pypy 2.2 and cpython 2.7.2`_ performance comparison)
+due to its integrated tracing JIT compiler.
+
+This release supports x86 machines running Linux 32/64, Mac OS X 64, Windows
+32, or ARM (ARMv6 or ARMv7, with VFPv3).
+
+Work on the native Windows 64 is still stalling, we would welcome a volunteer
+to handle that.
+
+.. _`pypy 2.2 and cpython 2.7.2`: http://speed.pypy.org
+
+Highlights
+==
+
+* Our Garbage Collector is now incremental.  It should avoid almost
+  all pauses due to a major collection taking place.  Previously, it
+  would pause the program (rarely) to walk all live objects, which
+  could take arbitrarily long if your process is using a whole lot of
+  RAM.  Now the same work is done in steps.  This should make PyPy
+  more responsive, e.g. in games.  There are still other pauses, from
+  the GC and the JIT, but they should be on the order of 5
+  milliseconds each.
+
+* The JIT counters for hot code were never reset, which meant that a
+  process running for long enough would eventually JIT-compile more
+  and more rarely executed code.  Not only is it useless to compile
+  such code, but as more compiled code means more memory used, this
+  gives the impression of a memory leak.  This has been tentatively
+  fixed by decreasing the counters from time to time.
+
+* NumPy has been split: now PyPy only contains the core module, called
+  ``_numpypy``.  The ``numpy`` module itself has been moved to
+  ``https://bitbucket.org/pypy/numpy`` and ``numpypy`` disappeared.
+  You need to install NumPy separately with a virtualenv:
+  ``pip install git+https://bitbucket.org/pypy/numpy.git``;
+  or directly:
+  ``git clone https://bitbucket.org/pypy/numpy.git``;
+  ``cd numpy``; ``pypy setup.py install``.
+
+* non-inlined calls have less overhead
+
+* Things that use ``sys.set_trace`` are now JITted (like coverage)
+
+* JSON decoding is now very fast (JSON encoding was already very fast)
+
+* various buffer copying methods experience speedups (like list-of-ints to
+  ``int[]`` buffer from cffi)
+
+* We finally wrote (hopefully) all the missing ``os.xxx()`` functions,
+  including ``os.startfile()`` on Windows and a handful of rare ones
+  on Posix.
+
+* numpy has a rudimentary C API that cooperates with ``cpyext``
+
+Cheers,
+Armin Rigo and Maciej Fijalkowski
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy reflex-support: merge default into branch

2014-04-23 Thread wlav
Author: Wim Lavrijsen wlavrij...@lbl.gov
Branch: reflex-support
Changeset: r70894:72e0d4578688
Date: 2014-04-23 12:48 -0700
http://bitbucket.org/pypy/pypy/changeset/72e0d4578688/

Log:merge default into branch

diff --git a/pypy/doc/release-2.3.0.rst b/pypy/doc/release-2.3.0.rst
new file mode 100644
--- /dev/null
+++ b/pypy/doc/release-2.3.0.rst
@@ -0,0 +1,88 @@
+===
+PyPy 2.3 -  TODO
+===
+
+We're pleased to announce PyPy 2.3, which targets version 2.7.6 of the Python
+language. This release updates the stdlib from 2.7.3, jumping directly to 
2.7.6.
+
+This release also contains several bugfixes and performance improvements. 
+
+You can download the PyPy 2.3 release here:
+
+http://pypy.org/download.html
+
+We would like to thank our donors for the continued support of the PyPy
+project. We showed quite a bit of progress on all three projects (see below)
+and we're slowly running out of funds.
+Please consider donating more so we can finish those projects!  The three
+projects are:
+
+* Py3k (supporting Python 3.x): the release PyPy3 2.2 is imminent.
+
+* STM (software transactional memory): a preview will be released very soon,
+  as soon as we fix a few bugs
+
+* NumPy: the work done is included in the PyPy 2.2 release. More details below.
+
+.. _`Raspberry Pi Foundation`: http://www.raspberrypi.org
+
+What is PyPy?
+=
+
+PyPy is a very compliant Python interpreter, almost a drop-in replacement for
+CPython 2.7. It's fast (`pypy 2.2 and cpython 2.7.2`_ performance comparison)
+due to its integrated tracing JIT compiler.
+
+This release supports x86 machines running Linux 32/64, Mac OS X 64, Windows
+32, or ARM (ARMv6 or ARMv7, with VFPv3).
+
+Work on the native Windows 64 is still stalling, we would welcome a volunteer
+to handle that.
+
+.. _`pypy 2.2 and cpython 2.7.2`: http://speed.pypy.org
+
+Highlights
+==
+
+* Our Garbage Collector is now incremental.  It should avoid almost
+  all pauses due to a major collection taking place.  Previously, it
+  would pause the program (rarely) to walk all live objects, which
+  could take arbitrarily long if your process is using a whole lot of
+  RAM.  Now the same work is done in steps.  This should make PyPy
+  more responsive, e.g. in games.  There are still other pauses, from
+  the GC and the JIT, but they should be on the order of 5
+  milliseconds each.
+
+* The JIT counters for hot code were never reset, which meant that a
+  process running for long enough would eventually JIT-compile more
+  and more rarely executed code.  Not only is it useless to compile
+  such code, but as more compiled code means more memory used, this
+  gives the impression of a memory leak.  This has been tentatively
+  fixed by decreasing the counters from time to time.
+
+* NumPy has been split: now PyPy only contains the core module, called
+  ``_numpypy``.  The ``numpy`` module itself has been moved to
+  ``https://bitbucket.org/pypy/numpy`` and ``numpypy`` disappeared.
+  You need to install NumPy separately with a virtualenv:
+  ``pip install git+https://bitbucket.org/pypy/numpy.git``;
+  or directly:
+  ``git clone https://bitbucket.org/pypy/numpy.git``;
+  ``cd numpy``; ``pypy setup.py install``.
+
+* non-inlined calls have less overhead
+
+* Things that use ``sys.set_trace`` are now JITted (like coverage)
+
+* JSON decoding is now very fast (JSON encoding was already very fast)
+
+* various buffer copying methods experience speedups (like list-of-ints to
+  ``int[]`` buffer from cffi)
+
+* We finally wrote (hopefully) all the missing ``os.xxx()`` functions,
+  including ``os.startfile()`` on Windows and a handful of rare ones
+  on Posix.
+
+* numpy has a rudimentary C API that cooperates with ``cpyext``
+
+Cheers,
+Armin Rigo and Maciej Fijalkowski
diff --git a/pypy/module/cppyy/capi/loadable_capi.py 
b/pypy/module/cppyy/capi/loadable_capi.py
--- a/pypy/module/cppyy/capi/loadable_capi.py
+++ b/pypy/module/cppyy/capi/loadable_capi.py
@@ -216,11 +216,20 @@
 'stdstring2stdstring'  : ([c_object], 
c_object),
 }
 
+# size/offset are backend-specific but fixed after load
+self.c_sizeof_farg = 0
+self.c_offset_farg = 0
+
+
 def load_reflection_library(space):
 state = space.fromcache(State)
 if state.library is None:
 from pypy.module._cffi_backend.libraryobj import W_Library
 state.library = W_Library(space, reflection_library, 
rdynload.RTLD_LOCAL | rdynload.RTLD_LAZY)
+if state.library:
+# fix constants
+state.c_sizeof_farg = _cdata_to_size_t(space, call_capi(space, 
'function_arg_sizeof', []))
+state.c_offset_farg = _cdata_to_size_t(space, call_capi(space, 
'function_arg_typeoffset', []))
 return state.library
 
 def verify_backend(space):
@@ -340,12 +349,12 @@
 return _cdata_to_ptr(space, call_capi(space, 

[pypy-commit] pypy default: fixes to elidable; now warning free

2014-04-23 Thread wlav
Author: Wim Lavrijsen wlavrij...@lbl.gov
Branch: 
Changeset: r70892:a637c43f17fa
Date: 2014-04-23 12:45 -0700
http://bitbucket.org/pypy/pypy/changeset/a637c43f17fa/

Log:fixes to elidable; now warning free

diff --git a/pypy/module/cppyy/capi/loadable_capi.py 
b/pypy/module/cppyy/capi/loadable_capi.py
--- a/pypy/module/cppyy/capi/loadable_capi.py
+++ b/pypy/module/cppyy/capi/loadable_capi.py
@@ -216,11 +216,20 @@
 'stdstring2stdstring'  : ([c_object], 
c_object),
 }
 
+# size/offset are backend-specific but fixed after load
+self.c_sizeof_farg = 0
+self.c_offset_farg = 0
+
+
 def load_reflection_library(space):
 state = space.fromcache(State)
 if state.library is None:
 from pypy.module._cffi_backend.libraryobj import W_Library
 state.library = W_Library(space, reflection_library, 
rdynload.RTLD_LOCAL | rdynload.RTLD_LAZY)
+if state.library:
+# fix constants
+state.c_sizeof_farg = _cdata_to_size_t(space, call_capi(space, 
'function_arg_sizeof', []))
+state.c_offset_farg = _cdata_to_size_t(space, call_capi(space, 
'function_arg_typeoffset', []))
 return state.library
 
 def verify_backend(space):
@@ -340,12 +349,12 @@
 return _cdata_to_ptr(space, call_capi(space, 'allocate_function_args', 
[_Arg(l=size)]))
 def c_deallocate_function_args(space, cargs):
 call_capi(space, 'deallocate_function_args', [_Arg(vp=cargs)])
-@jit.elidable
 def c_function_arg_sizeof(space):
-return _cdata_to_size_t(space, call_capi(space, 'function_arg_sizeof', []))
-@jit.elidable
+state = space.fromcache(State)
+return state.c_sizeof_farg
 def c_function_arg_typeoffset(space):
-return _cdata_to_size_t(space, call_capi(space, 'function_arg_typeoffset', 
[]))
+state = space.fromcache(State)
+return state.c_offset_farg
 
 # scope reflection information ---
 def c_is_namespace(space, scope):
@@ -365,13 +374,12 @@
 def c_base_name(space, cppclass, base_index):
 args = [_Arg(l=cppclass.handle), _Arg(l=base_index)]
 return charp2str_free(space, call_capi(space, 'base_name', args))
-@jit.elidable_promote('2')
 def c_is_subtype(space, derived, base):
+jit.promote(base)
 if derived == base:
 return bool(1)
 return space.bool_w(call_capi(space, 'is_subtype', 
[_Arg(l=derived.handle), _Arg(l=base.handle)]))
 
-@jit.elidable_promote('1,2,4')
 def _c_base_offset(space, derived_h, base_h, address, direction):
 args = [_Arg(l=derived_h), _Arg(l=base_h), _Arg(l=address), 
_Arg(l=direction)]
 return _cdata_to_size_t(space, call_capi(space, 'base_offset', args))
diff --git a/pypy/module/cppyy/interp_cppyy.py 
b/pypy/module/cppyy/interp_cppyy.py
--- a/pypy/module/cppyy/interp_cppyy.py
+++ b/pypy/module/cppyy/interp_cppyy.py
@@ -604,12 +604,10 @@
 def get_returntype(self):
 return self.space.wrap(self.converter.name)
 
-@jit.elidable_promote()
 def _get_offset(self, cppinstance):
 if cppinstance:
 assert lltype.typeOf(cppinstance.cppclass.handle) == 
lltype.typeOf(self.scope.handle)
-offset = self.offset + capi.c_base_offset(self.space,
-cppinstance.cppclass, self.scope, cppinstance.get_rawobject(), 
1)
+offset = self.offset + 
cppinstance.cppclass.get_base_offset(cppinstance, self.scope)
 else:
 offset = self.offset
 return offset
@@ -739,7 +737,6 @@
 self.datamembers[name] = new_dm
 return new_dm
 
-@jit.elidable_promote()
 def dispatch(self, name, signature):
 overload = self.get_overload(name)
 sig = '(%s)' % signature
@@ -908,6 +905,10 @@
 def find_datamember(self, name):
 raise self.missing_attribute_error(name)
 
+def get_base_offset(self, cppinstance, calling_scope):
+assert self == cppinstance.cppclass
+return 0
+
 def get_cppthis(self, cppinstance, calling_scope):
 assert self == cppinstance.cppclass
 return cppinstance.get_rawobject()
@@ -939,10 +940,15 @@
 
 class W_ComplexCPPClass(W_CPPClass):
 
-def get_cppthis(self, cppinstance, calling_scope):
+def get_base_offset(self, cppinstance, calling_scope):
 assert self == cppinstance.cppclass
 offset = capi.c_base_offset(self.space,
 self, calling_scope, 
cppinstance.get_rawobject(), 1)
+return offset
+
+def get_cppthis(self, cppinstance, calling_scope):
+assert self == cppinstance.cppclass
+offset = self.get_base_offset(cppinstance, calling_scope)
 return capi.direct_ptradd(cppinstance.get_rawobject(), offset)
 
 W_ComplexCPPClass.typedef = TypeDef(
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: merge default into branch

2014-04-23 Thread wlav
Author: Wim Lavrijsen wlavrij...@lbl.gov
Branch: 
Changeset: r70893:822c0b8d758b
Date: 2014-04-23 12:46 -0700
http://bitbucket.org/pypy/pypy/changeset/822c0b8d758b/

Log:merge default into branch

diff --git a/pypy/doc/release-2.3.0.rst b/pypy/doc/release-2.3.0.rst
new file mode 100644
--- /dev/null
+++ b/pypy/doc/release-2.3.0.rst
@@ -0,0 +1,88 @@
+===
+PyPy 2.3 -  TODO
+===
+
+We're pleased to announce PyPy 2.3, which targets version 2.7.6 of the Python
+language. This release updates the stdlib from 2.7.3, jumping directly to 
2.7.6.
+
+This release also contains several bugfixes and performance improvements. 
+
+You can download the PyPy 2.3 release here:
+
+http://pypy.org/download.html
+
+We would like to thank our donors for the continued support of the PyPy
+project. We showed quite a bit of progress on all three projects (see below)
+and we're slowly running out of funds.
+Please consider donating more so we can finish those projects!  The three
+projects are:
+
+* Py3k (supporting Python 3.x): the release PyPy3 2.2 is imminent.
+
+* STM (software transactional memory): a preview will be released very soon,
+  as soon as we fix a few bugs
+
+* NumPy: the work done is included in the PyPy 2.2 release. More details below.
+
+.. _`Raspberry Pi Foundation`: http://www.raspberrypi.org
+
+What is PyPy?
+=
+
+PyPy is a very compliant Python interpreter, almost a drop-in replacement for
+CPython 2.7. It's fast (`pypy 2.2 and cpython 2.7.2`_ performance comparison)
+due to its integrated tracing JIT compiler.
+
+This release supports x86 machines running Linux 32/64, Mac OS X 64, Windows
+32, or ARM (ARMv6 or ARMv7, with VFPv3).
+
+Work on the native Windows 64 is still stalling, we would welcome a volunteer
+to handle that.
+
+.. _`pypy 2.2 and cpython 2.7.2`: http://speed.pypy.org
+
+Highlights
+==
+
+* Our Garbage Collector is now incremental.  It should avoid almost
+  all pauses due to a major collection taking place.  Previously, it
+  would pause the program (rarely) to walk all live objects, which
+  could take arbitrarily long if your process is using a whole lot of
+  RAM.  Now the same work is done in steps.  This should make PyPy
+  more responsive, e.g. in games.  There are still other pauses, from
+  the GC and the JIT, but they should be on the order of 5
+  milliseconds each.
+
+* The JIT counters for hot code were never reset, which meant that a
+  process running for long enough would eventually JIT-compile more
+  and more rarely executed code.  Not only is it useless to compile
+  such code, but as more compiled code means more memory used, this
+  gives the impression of a memory leak.  This has been tentatively
+  fixed by decreasing the counters from time to time.
+
+* NumPy has been split: now PyPy only contains the core module, called
+  ``_numpypy``.  The ``numpy`` module itself has been moved to
+  ``https://bitbucket.org/pypy/numpy`` and ``numpypy`` disappeared.
+  You need to install NumPy separately with a virtualenv:
+  ``pip install git+https://bitbucket.org/pypy/numpy.git``;
+  or directly:
+  ``git clone https://bitbucket.org/pypy/numpy.git``;
+  ``cd numpy``; ``pypy setup.py install``.
+
+* non-inlined calls have less overhead
+
+* Things that use ``sys.set_trace`` are now JITted (like coverage)
+
+* JSON decoding is now very fast (JSON encoding was already very fast)
+
+* various buffer copying methods experience speedups (like list-of-ints to
+  ``int[]`` buffer from cffi)
+
+* We finally wrote (hopefully) all the missing ``os.xxx()`` functions,
+  including ``os.startfile()`` on Windows and a handful of rare ones
+  on Posix.
+
+* numpy has a rudimentary C API that cooperates with ``cpyext``
+
+Cheers,
+Armin Rigo and Maciej Fijalkowski
diff --git a/pypy/module/cppyy/converter.py b/pypy/module/cppyy/converter.py
--- a/pypy/module/cppyy/converter.py
+++ b/pypy/module/cppyy/converter.py
@@ -6,7 +6,7 @@
 from rpython.rlib.rarithmetic import r_singlefloat
 from rpython.rlib import jit_libffi, rfloat
 
-from pypy.module._rawffi.interp_rawffi import unpack_simple_shape
+from pypy.module._rawffi.interp_rawffi import letter2tp
 from pypy.module._rawffi.array import W_Array, W_ArrayInstance
 
 from pypy.module.cppyy import helper, capi, ffitypes
@@ -132,7 +132,7 @@
 def __getattr__(self, name):
 if name.startswith('array_'):
 typecode = name[len('array_'):]
-arr = self.space.interp_w(W_Array, unpack_simple_shape(self.space, 
self.space.wrap(typecode)))
+arr = self.space.interp_w(W_Array, letter2tp(self.space, typecode))
 setattr(self, name, arr)
 return arr
 raise AttributeError(name)
@@ -409,7 +409,7 @@
 if ptrval == 0:
 from pypy.module.cppyy import interp_cppyy
 return interp_cppyy.get_nullptr(space)
-arr = space.interp_w(W_Array, 

[pypy-commit] pypy.org extradoc: Oups, forgot to update the value here too

2014-04-23 Thread arigo
Author: Armin Rigo ar...@tunes.org
Branch: extradoc
Changeset: r490:ca5bf8248220
Date: 2014-04-23 22:10 +0200
http://bitbucket.org/pypy/pypy.org/changeset/ca5bf8248220/

Log:Oups, forgot to update the value here too

diff --git a/don1.html b/don1.html
--- a/don1.html
+++ b/don1.html
@@ -9,7 +9,7 @@
 script
   $(function() {
 $(#progressbar).progressbar({
-  value: 44.3
+  value: 48.3
});
   });
 /script
diff --git a/don3.html b/don3.html
--- a/don3.html
+++ b/don3.html
@@ -9,7 +9,7 @@
 script
   $(function() {
 $(#progressbar).progressbar({
-  value: 76.5
+  value: 79.6
});
   });
 /script
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy.org extradoc: update the values

2014-04-23 Thread arigo
Author: Armin Rigo ar...@tunes.org
Branch: extradoc
Changeset: r491:fe20b1d536e4
Date: 2014-04-23 22:20 +0200
http://bitbucket.org/pypy/pypy.org/changeset/fe20b1d536e4/

Log:update the values

diff --git a/don1.html b/don1.html
--- a/don1.html
+++ b/don1.html
@@ -9,13 +9,13 @@
 script
   $(function() {
 $(#progressbar).progressbar({
-  value: 48.3
+  value: 48.4
});
   });
 /script
 
!-- Income:PyPy:Donations:Py3k / 0.95 --
-   $50742 of $105000 (48.3%)
+   $50852 of $105000 (48.4%)
div id=progressbar
/div
 
diff --git a/don3.html b/don3.html
--- a/don3.html
+++ b/don3.html
@@ -9,13 +9,13 @@
 script
   $(function() {
 $(#progressbar).progressbar({
-  value: 79.6
+  value: 80.2
});
   });
 /script
 
!-- Income:PyPy:Donations:Numpy / 0.95 --
-   $47796 of $6 (79.6%)
+   $48121 of $6 (80.2%)
div id=progressbar
/div
 
diff --git a/don4.html b/don4.html
--- a/don4.html
+++ b/don4.html
@@ -9,15 +9,15 @@
 script
   $(function() {
 $(#progressbar).progressbar({
-  value: 0.0
+  value: 2.6
});
   });
 /script
 
+   2nd call:
!-- Income:PyPy:Donations:Transactional Memory from April 8, 2014,
divided by 0.9 --
-   2nd call: $0 of $8 (0.0%)
-   brfont size=-2(does not update automatically)/font
+   $2097 of $8 (2.6%)
div id=progressbar
/div
 
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: create rsre_core.BufMatchContext, use to avoid copying

2014-04-23 Thread bdkearns
Author: Brian Kearns bdkea...@gmail.com
Branch: 
Changeset: r70895:42dcc26ee1d1
Date: 2014-04-23 16:11 -0400
http://bitbucket.org/pypy/pypy/changeset/42dcc26ee1d1/

Log:create rsre_core.BufMatchContext, use to avoid copying

diff --git a/pypy/module/_sre/interp_sre.py b/pypy/module/_sre/interp_sre.py
--- a/pypy/module/_sre/interp_sre.py
+++ b/pypy/module/_sre/interp_sre.py
@@ -34,8 +34,8 @@
 
 def slice_w(space, ctx, start, end, w_default):
 if 0 = start = end:
-if isinstance(ctx, rsre_core.StrMatchContext):
-return space.wrap(ctx._string[start:end])
+if isinstance(ctx, rsre_core.BufMatchContext):
+return space.wrap(ctx._buffer.getslice(start, end, 1, end-start))
 elif isinstance(ctx, rsre_core.UnicodeMatchContext):
 return space.wrap(ctx._unicodestr[start:end])
 else:
@@ -98,7 +98,7 @@
  space.wrap(cannot copy this pattern object))
 
 def make_ctx(self, w_string, pos=0, endpos=sys.maxint):
-Make a StrMatchContext or a UnicodeMatchContext for searching
+Make a BufMatchContext or a UnicodeMatchContext for searching
 in the given w_string object.
 space = self.space
 if pos  0:
@@ -114,12 +114,14 @@
 return rsre_core.UnicodeMatchContext(self.code, unicodestr,
  pos, endpos, self.flags)
 else:
-str = space.bufferstr_w(w_string)
-if pos  len(str):
-pos = len(str)
-if endpos  len(str):
-endpos = len(str)
-return rsre_core.StrMatchContext(self.code, str,
+buf = space.buffer_w(w_string)
+size = buf.getlength()
+assert size = 0
+if pos  size:
+pos = size
+if endpos  size:
+endpos = size
+return rsre_core.BufMatchContext(self.code, buf,
  pos, endpos, self.flags)
 
 def getmatch(self, ctx, found):
@@ -477,8 +479,8 @@
 
 def fget_string(self, space):
 ctx = self.ctx
-if isinstance(ctx, rsre_core.StrMatchContext):
-return space.wrap(ctx._string)
+if isinstance(ctx, rsre_core.BufMatchContext):
+return space.wrap(ctx._buffer.as_str())
 elif isinstance(ctx, rsre_core.UnicodeMatchContext):
 return space.wrap(ctx._unicodestr)
 else:
diff --git a/rpython/rlib/rsre/rsre_core.py b/rpython/rlib/rsre/rsre_core.py
--- a/rpython/rlib/rsre/rsre_core.py
+++ b/rpython/rlib/rsre/rsre_core.py
@@ -62,7 +62,8 @@
 # Install a copy of the function under the name '_spec_funcname' in each
 # concrete subclass
 specialized_methods = []
-for prefix, concreteclass in [('str', StrMatchContext),
+for prefix, concreteclass in [('buf', BufMatchContext),
+  ('str', StrMatchContext),
   ('uni', UnicodeMatchContext)]:
 newfunc = func_with_new_name(func, prefix + specname)
 assert not hasattr(concreteclass, specname)
@@ -170,6 +171,27 @@
 def fresh_copy(self, start):
 raise NotImplementedError
 
+class BufMatchContext(AbstractMatchContext):
+Concrete subclass for matching in a buffer.
+
+_immutable_fields_ = [_buffer]
+
+def __init__(self, pattern, buf, match_start, end, flags):
+AbstractMatchContext.__init__(self, pattern, match_start, end, flags)
+self._buffer = buf
+
+def str(self, index):
+check_nonneg(index)
+return ord(self._buffer.getitem(index))
+
+def lowstr(self, index):
+c = self.str(index)
+return rsre_char.getlower(c, self.flags)
+
+def fresh_copy(self, start):
+return BufMatchContext(self.pattern, self._buffer, start,
+   self.end, self.flags)
+
 class StrMatchContext(AbstractMatchContext):
 Concrete subclass for matching in a plain string.
 
diff --git a/rpython/rlib/rsre/rsre_jit.py b/rpython/rlib/rsre/rsre_jit.py
--- a/rpython/rlib/rsre/rsre_jit.py
+++ b/rpython/rlib/rsre/rsre_jit.py
@@ -33,9 +33,11 @@
 setattr(AbstractMatchContext, 'jitdriver_' + name, jitdriver)
 
 def install_jitdriver_spec(name, **kwds):
+from rpython.rlib.rsre.rsre_core import BufMatchContext
 from rpython.rlib.rsre.rsre_core import StrMatchContext
 from rpython.rlib.rsre.rsre_core import UnicodeMatchContext
-for prefix, concreteclass in [('Str', StrMatchContext),
+for prefix, concreteclass in [('Buf', BufMatchContext),
+  ('Str', StrMatchContext),
   ('Uni', UnicodeMatchContext)]:
 jitdriver = RSreJitDriver(prefix + name, **kwds)
 setattr(concreteclass, 'jitdriver_' + name, jitdriver)
___
pypy-commit mailing list
pypy-commit@python.org

[pypy-commit] pypy default: fix whatsnew

2014-04-23 Thread bdkearns
Author: Brian Kearns bdkea...@gmail.com
Branch: 
Changeset: r70896:134a1a7ab792
Date: 2014-04-23 18:04 -0400
http://bitbucket.org/pypy/pypy/changeset/134a1a7ab792/

Log:fix whatsnew

diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst
--- a/pypy/doc/whatsnew-head.rst
+++ b/pypy/doc/whatsnew-head.rst
@@ -5,7 +5,7 @@
 .. this is a revision shortly after release-2.3.x
 .. startrev: ba569fe1efdb
 
-
-
 .. branch: small-unroll-improvements
 Improve optimiziation of small allocation-heavy loops in the JIT
+
+.. branch: reflex-support
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: try another ip to test timeout

2014-04-23 Thread bdkearns
Author: Brian Kearns bdkea...@gmail.com
Branch: 
Changeset: r70897:1b90f8057ef4
Date: 2014-04-23 18:36 -0400
http://bitbucket.org/pypy/pypy/changeset/1b90f8057ef4/

Log:try another ip to test timeout

diff --git a/rpython/rlib/test/test_rsocket.py 
b/rpython/rlib/test/test_rsocket.py
--- a/rpython/rlib/test/test_rsocket.py
+++ b/rpython/rlib/test/test_rsocket.py
@@ -341,7 +341,7 @@
 s = RSocket()
 s.settimeout(0.1)
 with py.test.raises(SocketTimeout):
-s.connect(INETAddress('10.255.255.10', 12345))
+s.connect(INETAddress('172.30.172.30', 12345))
 s.close()
 
 def test_connect_with_timeout_succeed():
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy refactor-buffer-api: comments

2014-04-23 Thread bdkearns
Author: Brian Kearns bdkea...@gmail.com
Branch: refactor-buffer-api
Changeset: r70898:8f8a5ff1a59a
Date: 2014-04-23 19:02 -0400
http://bitbucket.org/pypy/pypy/changeset/8f8a5ff1a59a/

Log:comments

diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py
--- a/pypy/interpreter/baseobjspace.py
+++ b/pypy/interpreter/baseobjspace.py
@@ -1364,6 +1364,7 @@
  self.wrap('cannot convert negative integer '
'to unsigned int'))
 
+# XXX define these flags correctly, possibly put elsewhere?
 BUF_SIMPLE = 0
 BUF_FULL_RO = 1
 BUF_CONTIG = 2
@@ -1401,6 +1402,7 @@
 raise oefmt(self.w_TypeError,
 expected a character buffer object)
 
+# XXX rename these/replace with code more like CPython getargs for buffers
 def bufferstr_w(self, w_obj):
 # Directly returns an interp-level str.  Note that if w_obj is a
 # unicode string, this is different from str_w(buffer(w_obj)):
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy refactor-buffer-api: fix

2014-04-23 Thread bdkearns
Author: Brian Kearns bdkea...@gmail.com
Branch: refactor-buffer-api
Changeset: r70900:086aa4773f70
Date: 2014-04-23 19:05 -0400
http://bitbucket.org/pypy/pypy/changeset/086aa4773f70/

Log:fix

diff --git a/pypy/module/_sre/interp_sre.py b/pypy/module/_sre/interp_sre.py
--- a/pypy/module/_sre/interp_sre.py
+++ b/pypy/module/_sre/interp_sre.py
@@ -114,7 +114,7 @@
 return rsre_core.UnicodeMatchContext(self.code, unicodestr,
  pos, endpos, self.flags)
 else:
-buf = space.buffer_w(w_string)
+buf = space.readbuf_w(w_string)
 size = buf.getlength()
 assert size = 0
 if pos  size:
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: might as well shortcut through finditem_str

2014-04-23 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: 
Changeset: r70901:5c0a54b343c9
Date: 2014-04-23 16:10 -0700
http://bitbucket.org/pypy/pypy/changeset/5c0a54b343c9/

Log:might as well shortcut through finditem_str

diff --git a/pypy/interpreter/pyopcode.py b/pypy/interpreter/pyopcode.py
--- a/pypy/interpreter/pyopcode.py
+++ b/pypy/interpreter/pyopcode.py
@@ -881,8 +881,8 @@
 
 def LOAD_NAME(self, nameindex, next_instr):
 if self.w_locals is not self.w_globals:
-w_varname = self.getname_w(nameindex)
-w_value = self.space.finditem(self.w_locals, w_varname)
+varname = self.getname_u(nameindex)
+w_value = self.space.finditem_str(self.w_locals, varname)
 if w_value is not None:
 self.pushvalue(w_value)
 return
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k-fix-strategies: remove extra double quote

2014-04-23 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3k-fix-strategies
Changeset: r70904:790fb4852883
Date: 2014-04-23 16:41 -0700
http://bitbucket.org/pypy/pypy/changeset/790fb4852883/

Log:remove extra double quote

diff --git a/pypy/module/_posixsubprocess/interp_subprocess.py 
b/pypy/module/_posixsubprocess/interp_subprocess.py
--- a/pypy/module/_posixsubprocess/interp_subprocess.py
+++ b/pypy/module/_posixsubprocess/interp_subprocess.py
@@ -219,7 +219,8 @@
 
 
 def cloexec_pipe(space):
-cloexec_pipe() - (read_end, write_end)
+cloexec_pipe() - (read_end, write_end)
+
 Create a pipe whose ends have the cloexec flag set.
 
 with lltype.scoped_alloc(rffi.CArrayPtr(rffi.INT).TO, 2) as fds:
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy refactor-buffer-api: move buffer to rpython

2014-04-23 Thread bdkearns
Author: Brian Kearns bdkea...@gmail.com
Branch: refactor-buffer-api
Changeset: r70905:a0c9719c5500
Date: 2014-04-23 19:41 -0400
http://bitbucket.org/pypy/pypy/changeset/a0c9719c5500/

Log:move buffer to rpython

diff --git a/pypy/module/__pypy__/bytebuffer.py 
b/pypy/module/__pypy__/bytebuffer.py
--- a/pypy/module/__pypy__/bytebuffer.py
+++ b/pypy/module/__pypy__/bytebuffer.py
@@ -2,7 +2,7 @@
 # A convenient read-write buffer.  Located here for want of a better place.
 #
 
-from pypy.interpreter.buffer import Buffer
+from rpython.rlib.buffer import Buffer
 from pypy.interpreter.gateway import unwrap_spec
 
 
diff --git a/pypy/module/_cffi_backend/cbuffer.py 
b/pypy/module/_cffi_backend/cbuffer.py
--- a/pypy/module/_cffi_backend/cbuffer.py
+++ b/pypy/module/_cffi_backend/cbuffer.py
@@ -1,10 +1,10 @@
-from pypy.interpreter.buffer import Buffer
 from pypy.interpreter.error import oefmt
 from pypy.interpreter.gateway import unwrap_spec, interp2app
 from pypy.interpreter.typedef import TypeDef, make_weakref_descr
 from pypy.module._cffi_backend import cdataobj, ctypeptr, ctypearray
 from pypy.objspace.std.bufferobject import W_Buffer
 
+from rpython.rlib.buffer import Buffer
 from rpython.rtyper.annlowlevel import llstr
 from rpython.rtyper.lltypesystem import rffi
 from rpython.rtyper.lltypesystem.rstr import copy_string_to_raw
diff --git a/pypy/module/_io/interp_bufferedio.py 
b/pypy/module/_io/interp_bufferedio.py
--- a/pypy/module/_io/interp_bufferedio.py
+++ b/pypy/module/_io/interp_bufferedio.py
@@ -4,7 +4,7 @@
 from pypy.interpreter.typedef import (
 TypeDef, GetSetProperty, generic_new_descr, interp_attrproperty_w)
 from pypy.interpreter.gateway import interp2app, unwrap_spec, WrappedDefault
-from pypy.interpreter.buffer import Buffer
+from rpython.rlib.buffer import Buffer
 from rpython.rlib.rstring import StringBuilder
 from rpython.rlib.rarithmetic import r_longlong, intmask
 from rpython.rlib import rposix
diff --git a/pypy/module/_rawffi/buffer.py b/pypy/module/_rawffi/buffer.py
--- a/pypy/module/_rawffi/buffer.py
+++ b/pypy/module/_rawffi/buffer.py
@@ -1,4 +1,4 @@
-from pypy.interpreter.buffer import Buffer
+from rpython.rlib.buffer import Buffer
 
 # XXX not the most efficient implementation
 
diff --git a/pypy/module/array/interp_array.py 
b/pypy/module/array/interp_array.py
--- a/pypy/module/array/interp_array.py
+++ b/pypy/module/array/interp_array.py
@@ -1,6 +1,7 @@
 from __future__ import with_statement
 
 from rpython.rlib import jit
+from rpython.rlib.buffer import Buffer
 from rpython.rlib.objectmodel import keepalive_until_here
 from rpython.rlib.rarithmetic import ovfcheck, widen
 from rpython.rlib.unroll import unrolling_iterable
@@ -9,7 +10,6 @@
 from rpython.rtyper.lltypesystem.rstr import copy_string_to_raw
 
 from pypy.interpreter.baseobjspace import W_Root
-from pypy.interpreter.buffer import Buffer
 from pypy.interpreter.error import OperationError, oefmt
 from pypy.interpreter.gateway import (
 interp2app, interpindirect2app, unwrap_spec)
diff --git a/pypy/module/cpyext/bufferobject.py 
b/pypy/module/cpyext/bufferobject.py
--- a/pypy/module/cpyext/bufferobject.py
+++ b/pypy/module/cpyext/bufferobject.py
@@ -1,5 +1,5 @@
+from rpython.rlib.buffer import StringBuffer, SubBuffer
 from rpython.rtyper.lltypesystem import rffi, lltype
-from pypy.interpreter.buffer import StringBuffer, SubBuffer
 from pypy.interpreter.error import OperationError
 from pypy.module.cpyext.api import (
 cpython_api, Py_ssize_t, cpython_struct, bootstrap_function,
diff --git a/pypy/module/cpyext/slotdefs.py b/pypy/module/cpyext/slotdefs.py
--- a/pypy/module/cpyext/slotdefs.py
+++ b/pypy/module/cpyext/slotdefs.py
@@ -15,8 +15,8 @@
 from pypy.module.cpyext.pyerrors import PyErr_Occurred
 from pypy.module.cpyext.state import State
 from pypy.interpreter.error import OperationError, oefmt
-from pypy.interpreter.buffer import Buffer
 from pypy.interpreter.argument import Arguments
+from rpython.rlib.buffer import Buffer
 from rpython.rlib.unroll import unrolling_iterable
 from rpython.rlib.objectmodel import specialize
 from rpython.tool.sourcetools import func_renamer
diff --git a/pypy/module/micronumpy/concrete.py 
b/pypy/module/micronumpy/concrete.py
--- a/pypy/module/micronumpy/concrete.py
+++ b/pypy/module/micronumpy/concrete.py
@@ -1,6 +1,6 @@
-from pypy.interpreter.buffer import Buffer
 from pypy.interpreter.error import OperationError, oefmt
 from rpython.rlib import jit
+from rpython.rlib.buffer import Buffer
 from rpython.rlib.debug import make_sure_not_resized
 from rpython.rlib.rawstorage import alloc_raw_storage, free_raw_storage, \
 raw_storage_getitem, raw_storage_setitem, RAW_STORAGE
diff --git a/pypy/module/mmap/interp_mmap.py b/pypy/module/mmap/interp_mmap.py
--- a/pypy/module/mmap/interp_mmap.py
+++ b/pypy/module/mmap/interp_mmap.py
@@ -2,8 +2,8 @@
 from pypy.interpreter.baseobjspace import W_Root
 from pypy.interpreter.typedef import TypeDef
 from pypy.interpreter.gateway 

[pypy-commit] pypy default: merge reflex-support: more tests based on dummy backend

2014-04-23 Thread wlav
Author: Wim Lavrijsen wlavrij...@lbl.gov
Branch: 
Changeset: r70907:656185bf25ce
Date: 2014-04-23 16:53 -0700
http://bitbucket.org/pypy/pypy/changeset/656185bf25ce/

Log:merge reflex-support: more tests based on dummy backend

diff --git a/pypy/module/cppyy/src/dummy_backend.cxx 
b/pypy/module/cppyy/src/dummy_backend.cxx
--- a/pypy/module/cppyy/src/dummy_backend.cxx
+++ b/pypy/module/cppyy/src/dummy_backend.cxx
@@ -38,6 +38,24 @@
 typedef std::mapcppyy_scope_t, Cppyy_PseudoClassInfo Scopes_t;
 static Scopes_t s_scopes;
 
+class PseudoExample01 {
+public:
+PseudoExample01() : m_somedata(-99) {}
+PseudoExample01(int a) : m_somedata(a) {}
+PseudoExample01(const PseudoExample01 e) : m_somedata(e.m_somedata) {}
+PseudoExample01 operator=(const PseudoExample01 e) {
+if (this != e) m_somedata = e.m_somedata;
+return *this;
+}
+   virtual ~PseudoExample01() {}
+
+public:
+int m_somedata;
+};
+
+static int example01_last_static_method = 0;
+static int example01_last_constructor = 0;
+
 struct Cppyy_InitPseudoReflectionInfo {
 Cppyy_InitPseudoReflectionInfo() {
 // class example01 --
@@ -46,27 +64,62 @@
 
 std::vectorCppyy_PseudoMethodInfo methods;
 
-// static double staticAddToDouble(double a);
+// ( 0) static double staticAddToDouble(double a)
 std::vectorstd::string argtypes;
 argtypes.push_back(double);
 methods.push_back(Cppyy_PseudoMethodInfo(staticAddToDouble, 
argtypes, double));
 
-// static int staticAddOneToInt(int a);
-// static int staticAddOneToInt(int a, int b);
+// ( 1) static int staticAddOneToInt(int a)
+// ( 2) static int staticAddOneToInt(int a, int b)
 argtypes.clear();
 argtypes.push_back(int);
 methods.push_back(Cppyy_PseudoMethodInfo(staticAddOneToInt, 
argtypes, int));
 argtypes.push_back(int);
 methods.push_back(Cppyy_PseudoMethodInfo(staticAddOneToInt, 
argtypes, int));
 
-// static int staticAtoi(const char* str);
+// ( 3) static int staticAtoi(const char* str)
 argtypes.clear();
 argtypes.push_back(const char*);
 methods.push_back(Cppyy_PseudoMethodInfo(staticAtoi, argtypes, 
int));
 
-// static char* staticStrcpy(const char* strin);
+// ( 4) static char* staticStrcpy(const char* strin)
 methods.push_back(Cppyy_PseudoMethodInfo(staticStrcpy, argtypes, 
char*));
 
+// ( 5) static void staticSetPayload(payload* p, double d)
+// ( 6) static payload* staticCyclePayload(payload* p, double d)
+// ( 7) static payload staticCopyCyclePayload(payload* p, double d)
+argtypes.clear();
+argtypes.push_back(payload*);
+argtypes.push_back(double);
+methods.push_back(Cppyy_PseudoMethodInfo(staticSetPayload, argtypes, 
void));
+methods.push_back(Cppyy_PseudoMethodInfo(staticCyclePayload, 
argtypes, payload*));
+methods.push_back(Cppyy_PseudoMethodInfo(staticCopyCyclePayload, 
argtypes, payload));
+
+// ( 8) static int getCount()
+// ( 9) static void setCount(int)
+argtypes.clear();
+methods.push_back(Cppyy_PseudoMethodInfo(getCount, argtypes, int));
+argtypes.push_back(int);
+methods.push_back(Cppyy_PseudoMethodInfo(setCount, argtypes, 
void));
+
+// cut-off is used in cppyy_is_static
+example01_last_static_method = methods.size();
+
+// (10) example01()
+// (11) example01(int a)
+argtypes.clear();
+methods.push_back(Cppyy_PseudoMethodInfo(example01, argtypes, 
constructor));
+argtypes.push_back(int);
+methods.push_back(Cppyy_PseudoMethodInfo(example01, argtypes, 
constructor));
+
+// cut-off is used in cppyy_is_constructor
+example01_last_constructor = methods.size();
+
+// (12) double addDataToDouble(double a)
+argtypes.clear();
+argtypes.push_back(double);
+methods.push_back(Cppyy_PseudoMethodInfo(addDataToDouble, argtypes, 
double));
+
 Cppyy_PseudoClassInfo info(methods);
 s_scopes[(cppyy_scope_t)s_scope_id] = info;
 // -- class example01
@@ -98,47 +151,69 @@
 }
 
 
+/* memory management -- */
+void cppyy_destruct(cppyy_type_t handle, cppyy_object_t self) {
+if (handle == s_handles[example01])
+   delete (PseudoExample01*)self;
+}
+
+
 /* method/function dispatching  */
-templatetypename T
-static inline T cppyy_call_T(cppyy_method_t method, cppyy_object_t self, int 
nargs, void* args) {
-T result = T();
+int cppyy_call_i(cppyy_method_t method, cppyy_object_t self, int nargs, void* 
args) {
+int result = 0;
 switch ((long)method) {
-case 0: // double staticAddToDouble(double)
-assert(!self  nargs == 1);
-result = ((CPPYY_G__value*)args)[0].obj.d + 0.01;
-

[pypy-commit] pypy reflex-support: open up more tests based on dummy backend

2014-04-23 Thread wlav
Author: Wim Lavrijsen wlavrij...@lbl.gov
Branch: reflex-support
Changeset: r70906:e1e330d8479f
Date: 2014-04-23 16:51 -0700
http://bitbucket.org/pypy/pypy/changeset/e1e330d8479f/

Log:open up more tests based on dummy backend

diff --git a/pypy/module/cppyy/src/dummy_backend.cxx 
b/pypy/module/cppyy/src/dummy_backend.cxx
--- a/pypy/module/cppyy/src/dummy_backend.cxx
+++ b/pypy/module/cppyy/src/dummy_backend.cxx
@@ -38,6 +38,24 @@
 typedef std::mapcppyy_scope_t, Cppyy_PseudoClassInfo Scopes_t;
 static Scopes_t s_scopes;
 
+class PseudoExample01 {
+public:
+PseudoExample01() : m_somedata(-99) {}
+PseudoExample01(int a) : m_somedata(a) {}
+PseudoExample01(const PseudoExample01 e) : m_somedata(e.m_somedata) {}
+PseudoExample01 operator=(const PseudoExample01 e) {
+if (this != e) m_somedata = e.m_somedata;
+return *this;
+}
+   virtual ~PseudoExample01() {}
+
+public:
+int m_somedata;
+};
+
+static int example01_last_static_method = 0;
+static int example01_last_constructor = 0;
+
 struct Cppyy_InitPseudoReflectionInfo {
 Cppyy_InitPseudoReflectionInfo() {
 // class example01 --
@@ -46,27 +64,62 @@
 
 std::vectorCppyy_PseudoMethodInfo methods;
 
-// static double staticAddToDouble(double a);
+// ( 0) static double staticAddToDouble(double a)
 std::vectorstd::string argtypes;
 argtypes.push_back(double);
 methods.push_back(Cppyy_PseudoMethodInfo(staticAddToDouble, 
argtypes, double));
 
-// static int staticAddOneToInt(int a);
-// static int staticAddOneToInt(int a, int b);
+// ( 1) static int staticAddOneToInt(int a)
+// ( 2) static int staticAddOneToInt(int a, int b)
 argtypes.clear();
 argtypes.push_back(int);
 methods.push_back(Cppyy_PseudoMethodInfo(staticAddOneToInt, 
argtypes, int));
 argtypes.push_back(int);
 methods.push_back(Cppyy_PseudoMethodInfo(staticAddOneToInt, 
argtypes, int));
 
-// static int staticAtoi(const char* str);
+// ( 3) static int staticAtoi(const char* str)
 argtypes.clear();
 argtypes.push_back(const char*);
 methods.push_back(Cppyy_PseudoMethodInfo(staticAtoi, argtypes, 
int));
 
-// static char* staticStrcpy(const char* strin);
+// ( 4) static char* staticStrcpy(const char* strin)
 methods.push_back(Cppyy_PseudoMethodInfo(staticStrcpy, argtypes, 
char*));
 
+// ( 5) static void staticSetPayload(payload* p, double d)
+// ( 6) static payload* staticCyclePayload(payload* p, double d)
+// ( 7) static payload staticCopyCyclePayload(payload* p, double d)
+argtypes.clear();
+argtypes.push_back(payload*);
+argtypes.push_back(double);
+methods.push_back(Cppyy_PseudoMethodInfo(staticSetPayload, argtypes, 
void));
+methods.push_back(Cppyy_PseudoMethodInfo(staticCyclePayload, 
argtypes, payload*));
+methods.push_back(Cppyy_PseudoMethodInfo(staticCopyCyclePayload, 
argtypes, payload));
+
+// ( 8) static int getCount()
+// ( 9) static void setCount(int)
+argtypes.clear();
+methods.push_back(Cppyy_PseudoMethodInfo(getCount, argtypes, int));
+argtypes.push_back(int);
+methods.push_back(Cppyy_PseudoMethodInfo(setCount, argtypes, 
void));
+
+// cut-off is used in cppyy_is_static
+example01_last_static_method = methods.size();
+
+// (10) example01()
+// (11) example01(int a)
+argtypes.clear();
+methods.push_back(Cppyy_PseudoMethodInfo(example01, argtypes, 
constructor));
+argtypes.push_back(int);
+methods.push_back(Cppyy_PseudoMethodInfo(example01, argtypes, 
constructor));
+
+// cut-off is used in cppyy_is_constructor
+example01_last_constructor = methods.size();
+
+// (12) double addDataToDouble(double a)
+argtypes.clear();
+argtypes.push_back(double);
+methods.push_back(Cppyy_PseudoMethodInfo(addDataToDouble, argtypes, 
double));
+
 Cppyy_PseudoClassInfo info(methods);
 s_scopes[(cppyy_scope_t)s_scope_id] = info;
 // -- class example01
@@ -98,47 +151,69 @@
 }
 
 
+/* memory management -- */
+void cppyy_destruct(cppyy_type_t handle, cppyy_object_t self) {
+if (handle == s_handles[example01])
+   delete (PseudoExample01*)self;
+}
+
+
 /* method/function dispatching  */
-templatetypename T
-static inline T cppyy_call_T(cppyy_method_t method, cppyy_object_t self, int 
nargs, void* args) {
-T result = T();
+int cppyy_call_i(cppyy_method_t method, cppyy_object_t self, int nargs, void* 
args) {
+int result = 0;
 switch ((long)method) {
-case 0: // double staticAddToDouble(double)
-assert(!self  nargs == 1);
-result = ((CPPYY_G__value*)args)[0].obj.d + 0.01;
-

[pypy-commit] pypy default: doc updates (clarification and a description of nullptr)

2014-04-23 Thread wlav
Author: Wim Lavrijsen wlavrij...@lbl.gov
Branch: 
Changeset: r70908:d426723559fb
Date: 2014-04-23 17:15 -0700
http://bitbucket.org/pypy/pypy/changeset/d426723559fb/

Log:doc updates (clarification and a description of nullptr)

diff --git a/pypy/doc/cppyy.rst b/pypy/doc/cppyy.rst
--- a/pypy/doc/cppyy.rst
+++ b/pypy/doc/cppyy.rst
@@ -560,6 +560,12 @@
   Fixing these bootstrap problems is on the TODO list.
   The global namespace is ``cppyy.gbl``.
 
+* **NULL**: Is represented as ``cppyy.gbl.nullptr``.
+  In C++11, the keyword ``nullptr`` is used to represent ``NULL``.
+  For clarity of intent, it is recommended to use this instead of ``None``
+  (or the integer ``0``, which can serve in some cases), as ``None`` is better
+  understood as ``void`` in C++.
+
 * **operator conversions**: If defined in the C++ class and a python
   equivalent exists (i.e. all builtin integer and floating point types, as well
   as ``bool``), it will map onto that python conversion.
diff --git a/pypy/doc/extending.rst b/pypy/doc/extending.rst
--- a/pypy/doc/extending.rst
+++ b/pypy/doc/extending.rst
@@ -66,58 +66,26 @@
 Reflex
 ==
 
-This method is still experimental.  It adds the `cppyy`_ module.
-The method works by using the `Reflex package`_ to provide reflection
-information of the C++ code, which is then used to automatically generate
-bindings at runtime.
-From a python standpoint, there is no difference between generating bindings
-at runtime, or having them statically generated and available in scripts
-or compiled into extension modules: python classes and functions are always
-runtime structures, created when a script or module loads.
+The builtin `cppyy`_ module uses reflection information, provided by
+`Reflex`_ (which needs to be `installed separately`_), of C/C++ code to
+automatically generate bindings at runtime.
+In Python, classes and functions are always runtime structures, so when they
+are generated matters not for performance.
 However, if the backend itself is capable of dynamic behavior, it is a much
-better functional match to python, allowing tighter integration and more
-natural language mappings.
-Full details are `available here`_.
+better functional match, allowing tighter integration and more natural
+language mappings.
+
+The `cppyy`_ module is written in RPython, thus PyPy's JIT is able to remove
+most cross-language call overhead.
+
+`Full details`_ are `available here`_.
 
 .. _`cppyy`: cppyy.html
-.. _`reflex-support`: cppyy.html
-.. _`Reflex package`: http://root.cern.ch/drupal/content/reflex
+.. _`installed separately`: http://cern.ch/wlav/reflex-2013-08-14.tar.bz2
+.. _`Reflex`: http://root.cern.ch/drupal/content/reflex
+.. _`Full details`: cppyy.html
 .. _`available here`: cppyy.html
 
-Pros
-
-
-The cppyy module is written in RPython, which makes it possible to keep the
-code execution visible to the JIT all the way to the actual point of call into
-C++, thus allowing for a very fast interface.
-Reflex is currently in use in large software environments in High Energy
-Physics (HEP), across many different projects and packages, and its use can be
-virtually completely automated in a production environment.
-One of its uses in HEP is in providing language bindings for CPython.
-Thus, it is possible to use Reflex to have bound code work on both CPython and
-on PyPy.
-In the medium-term, Reflex will be replaced by `cling`_, which is based on
-`llvm`_.
-This will affect the backend only; the python-side interface is expected to
-remain the same, except that cling adds a lot of dynamic behavior to C++,
-enabling further language integration.
-
-.. _`cling`: http://root.cern.ch/drupal/content/cling
-.. _`llvm`: http://llvm.org/
-
-Cons
-
-
-C++ is a large language, and cppyy is not yet feature-complete.
-Still, the experience gained in developing the equivalent bindings for CPython
-means that adding missing features is a simple matter of engineering, not a
-question of research.
-The module is written so that currently missing features should do no harm if
-you don't use them, if you do need a particular feature, it may be necessary
-to work around it in python or with a C++ helper function.
-Although Reflex works on various platforms, the bindings with PyPy have only
-been tested on Linux.
-
 
 RPython Mixed Modules
 =
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k-fix-strategies: revert back to usage of finditem/setitem_str

2014-04-23 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3k-fix-strategies
Changeset: r70909:36af1cd6bd2c
Date: 2014-04-23 17:13 -0700
http://bitbucket.org/pypy/pypy/changeset/36af1cd6bd2c/

Log:revert back to usage of finditem/setitem_str

diff --git a/pypy/interpreter/pyopcode.py b/pypy/interpreter/pyopcode.py
--- a/pypy/interpreter/pyopcode.py
+++ b/pypy/interpreter/pyopcode.py
@@ -433,6 +433,9 @@
 def getconstant_w(self, index):
 return self.getcode().co_consts_w[index]
 
+def getname_u(self, index):
+return self.space.identifier_w(self.getname_w(index))
+
 def getname_w(self, index):
 return self.getcode().co_names_w[index]
 
@@ -753,9 +756,9 @@
 self.pushvalue(w_build_class)
 
 def STORE_NAME(self, varindex, next_instr):
-w_varname = self.getname_w(varindex)
+varname = self.getname_u(varindex)
 w_newvalue = self.popvalue()
-self.space.setitem(self.w_locals, w_varname, w_newvalue)
+self.space.setitem_str(self.w_locals, varname, w_newvalue)
 
 def DELETE_NAME(self, varindex, next_instr):
 w_varname = self.getname_w(varindex)
@@ -765,8 +768,8 @@
 # catch KeyErrors and turn them into NameErrors
 if not e.match(self.space, self.space.w_KeyError):
 raise
-raise oefmt(self.space.w_NameError, name '%s' is not defined,
-self.space.str_w(w_varname))
+raise oefmt(self.space.w_NameError,
+name %R is not defined, w_varname)
 
 def UNPACK_SEQUENCE(self, itemcount, next_instr):
 w_iterable = self.popvalue()
@@ -817,7 +820,7 @@
 self.space.delattr(w_obj, w_attributename)
 
 def STORE_GLOBAL(self, nameindex, next_instr):
-varname = self.space.str_w(self.getname_w(nameindex))
+varname = self.getname_u(nameindex)
 w_newvalue = self.popvalue()
 self.space.setitem_str(self.w_globals, varname, w_newvalue)
 
@@ -827,24 +830,24 @@
 
 def LOAD_NAME(self, nameindex, next_instr):
 w_varname = self.getname_w(nameindex)
+varname = self.space.identifier_w(w_varname)
 if self.w_locals is not self.w_globals:
-w_value = self.space.finditem(self.w_locals, w_varname)
+w_value = self.space.finditem_str(self.w_locals, varname)
 if w_value is not None:
 self.pushvalue(w_value)
 return
 # fall-back
-w_value = self._load_global(w_varname)
+w_value = self._load_global(varname)
 if w_value is None:
 raise oefmt(self.space.w_NameError,
 name %R is not defined, w_varname)
 self.pushvalue(w_value)
 
-def _load_global(self, w_varname):
-w_value = self.space.finditem(self.w_globals, w_varname)
+def _load_global(self, varname):
+w_value = self.space.finditem_str(self.w_globals, varname)
 if w_value is None:
 # not in the globals, now look in the built-ins
-w_value = self.get_builtin().getdictvalue(
-self.space, self.space.identifier_w(w_varname))
+w_value = self.get_builtin().getdictvalue(self.space, varname)
 return w_value
 _load_global._always_inline_ = True
 
@@ -855,7 +858,7 @@
 
 def LOAD_GLOBAL(self, nameindex, next_instr):
 w_varname = self.getname_w(nameindex)
-w_value = self._load_global(w_varname)
+w_value = self._load_global(self.space.identifier_w(w_varname))
 if w_value is None:
 self._load_global_failed(w_varname)
 self.pushvalue(w_value)
@@ -993,7 +996,7 @@
 if not e.match(self.space, self.space.w_AttributeError):
 raise
 raise oefmt(self.space.w_ImportError,
-cannot import name '%s', self.space.str_w(w_name))
+cannot import name %R, w_name)
 self.pushvalue(w_obj)
 
 def YIELD_VALUE(self, oparg, next_instr):
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy refactor-buffer-api: fix validation of buffer writability

2014-04-23 Thread bdkearns
Author: Brian Kearns bdkea...@gmail.com
Branch: refactor-buffer-api
Changeset: r70911:ac02d8345ef9
Date: 2014-04-23 21:06 -0400
http://bitbucket.org/pypy/pypy/changeset/ac02d8345ef9/

Log:fix validation of buffer writability

diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py
--- a/pypy/interpreter/baseobjspace.py
+++ b/pypy/interpreter/baseobjspace.py
@@ -5,7 +5,7 @@
 from rpython.rlib import jit, types
 from rpython.rlib.debug import make_sure_not_resized
 from rpython.rlib.objectmodel import (we_are_translated, newlist_hint,
- compute_unique_id)
+ compute_unique_id, specialize)
 from rpython.rlib.signature import signature
 from rpython.rlib.rarithmetic import r_uint, SHRT_MIN, SHRT_MAX, \
 INT_MIN, INT_MAX, UINT_MAX
@@ -1369,6 +1369,11 @@
 BUF_FULL_RO = 1
 BUF_CONTIG = 2
 BUF_CONTIG_RO = 3
+BUF_WRITABLE = 4
+
+def check_buf_flags(self, flags, readonly):
+if flags  self.BUF_WRITABLE == self.BUF_WRITABLE and readonly:
+raise oefmt(self.w_BufferError, Object is not writable.)
 
 def buffer_w(self, w_obj, flags):
 # New buffer interface, returns a buffer based on flags 
(PyObject_GetBuffer)
@@ -1402,6 +1407,26 @@
 raise oefmt(self.w_TypeError,
 expected a character buffer object)
 
+def _getarg_error(self, expected, w_obj):
+raise oefmt(self.w_TypeError, must be %s, not %T, expected, w_obj)
+
+@specialize.arg(1)
+def getarg_w(self, code, w_obj):
+if code == 'w*':
+try:
+try:
+return w_obj.buffer_w(self, self.BUF_WRITABLE)
+except OperationError:
+self._getarg_error(read-write buffer, w_obj)
+except TypeError:
+pass
+try:
+return w_obj.writebuf_w(self)
+except TypeError:
+self._getarg_error(read-write buffer, w_obj)
+else:
+assert False
+
 # XXX rename these/replace with code more like CPython getargs for buffers
 def bufferstr_w(self, w_obj):
 # Directly returns an interp-level str.  Note that if w_obj is a
diff --git a/pypy/module/_io/interp_bufferedio.py 
b/pypy/module/_io/interp_bufferedio.py
--- a/pypy/module/_io/interp_bufferedio.py
+++ b/pypy/module/_io/interp_bufferedio.py
@@ -80,7 +80,7 @@
 self._unsupportedoperation(space, detach)
 
 def readinto_w(self, space, w_buffer):
-rwbuffer = space.buffer_w(w_buffer, space.BUF_CONTIG)
+rwbuffer = space.getarg_w('w*', w_buffer)
 length = rwbuffer.getlength()
 w_data = space.call_method(self, read, space.wrap(length))
 
diff --git a/pypy/module/_io/interp_bytesio.py 
b/pypy/module/_io/interp_bytesio.py
--- a/pypy/module/_io/interp_bytesio.py
+++ b/pypy/module/_io/interp_bytesio.py
@@ -41,7 +41,7 @@
 
 def readinto_w(self, space, w_buffer):
 self._check_closed(space)
-rwbuffer = space.buffer_w(w_buffer, space.BUF_CONTIG)
+rwbuffer = space.getarg_w('w*', w_buffer)
 size = rwbuffer.getlength()
 
 output = self.read(size)
diff --git a/pypy/module/_io/interp_fileio.py b/pypy/module/_io/interp_fileio.py
--- a/pypy/module/_io/interp_fileio.py
+++ b/pypy/module/_io/interp_fileio.py
@@ -366,7 +366,7 @@
 def readinto_w(self, space, w_buffer):
 self._check_closed(space)
 self._check_readable(space)
-rwbuffer = space.buffer_w(w_buffer, space.BUF_CONTIG)
+rwbuffer = space.getarg_w('w*', w_buffer)
 length = rwbuffer.getlength()
 try:
 buf = os.read(self.fd, length)
diff --git a/pypy/module/_io/test/test_bufferedio.py 
b/pypy/module/_io/test/test_bufferedio.py
--- a/pypy/module/_io/test/test_bufferedio.py
+++ b/pypy/module/_io/test/test_bufferedio.py
@@ -139,6 +139,8 @@
 raw = _io.FileIO(self.tmpfile)
 f = _io.BufferedReader(raw)
 assert f.readinto(a) == 5
+exc = raises(TypeError, f.readinto, memoryview(bhello))
+assert str(exc.value) == must be read-write buffer, not memoryview
 f.close()
 assert a == 'a\nb\ncx'
 
diff --git a/pypy/module/_io/test/test_bytesio.py 
b/pypy/module/_io/test/test_bytesio.py
--- a/pypy/module/_io/test/test_bytesio.py
+++ b/pypy/module/_io/test/test_bytesio.py
@@ -97,6 +97,8 @@
 a2 = bytearray('testing')
 assert b.readinto(a1) == 1
 assert b.readinto(a2) == 4
+exc = raises(TypeError, b.readinto, memoryview(bhello))
+assert str(exc.value) == must be read-write buffer, not memoryview
 b.close()
 assert a1 == h
 assert a2 == elloing
diff --git a/pypy/module/_io/test/test_fileio.py 
b/pypy/module/_io/test/test_fileio.py
--- a/pypy/module/_io/test/test_fileio.py
+++ b/pypy/module/_io/test/test_fileio.py
@@ -135,6 +135,8 @@
 a = bytearray('x' * 10)
 f = _io.FileIO(self.tmpfile, 'r+')
 assert 

[pypy-commit] pypy refactor-buffer-api: comment funcs

2014-04-23 Thread bdkearns
Author: Brian Kearns bdkea...@gmail.com
Branch: refactor-buffer-api
Changeset: r70910:e28616a98151
Date: 2014-04-23 20:10 -0400
http://bitbucket.org/pypy/pypy/changeset/e28616a98151/

Log:comment funcs

diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py
--- a/pypy/interpreter/baseobjspace.py
+++ b/pypy/interpreter/baseobjspace.py
@@ -1371,7 +1371,7 @@
 BUF_CONTIG_RO = 3
 
 def buffer_w(self, w_obj, flags):
-# New buffer interface, returns a buffer based on flags
+# New buffer interface, returns a buffer based on flags 
(PyObject_GetBuffer)
 try:
 return w_obj.buffer_w(self, flags)
 except TypeError:
@@ -1379,7 +1379,7 @@
 '%T' does not have the buffer interface, w_obj)
 
 def readbuf_w(self, w_obj):
-# Old buffer interface, returns a readonly buffer
+# Old buffer interface, returns a readonly buffer 
(PyObject_AsReadBuffer)
 try:
 return w_obj.readbuf_w(self)
 except TypeError:
@@ -1387,7 +1387,7 @@
 expected a readable buffer object)
 
 def writebuf_w(self, w_obj):
-# Old buffer interface, returns a writeable buffer
+# Old buffer interface, returns a writeable buffer 
(PyObject_AsWriteBuffer)
 try:
 return w_obj.writebuf_w(self)
 except TypeError:
@@ -1395,7 +1395,7 @@
 expected a writeable buffer object)
 
 def charbuf_w(self, w_obj):
-# Old buffer interface, returns a character buffer
+# Old buffer interface, returns a character buffer 
(PyObject_AsCharBuffer)
 try:
 return w_obj.charbuf_w(self)
 except TypeError:
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy refactor-buffer-api: test/fix bufferstr_w behavior

2014-04-23 Thread bdkearns
Author: Brian Kearns bdkea...@gmail.com
Branch: refactor-buffer-api
Changeset: r70912:e2178919af90
Date: 2014-04-23 21:50 -0400
http://bitbucket.org/pypy/pypy/changeset/e2178919af90/

Log:test/fix bufferstr_w behavior

diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py
--- a/pypy/interpreter/baseobjspace.py
+++ b/pypy/interpreter/baseobjspace.py
@@ -1408,7 +1408,11 @@
 expected a character buffer object)
 
 def _getarg_error(self, expected, w_obj):
-raise oefmt(self.w_TypeError, must be %s, not %T, expected, w_obj)
+if self.is_none(w_obj):
+name = None
+else:
+name = self.type(w_obj).getname(self)
+raise oefmt(self.w_TypeError, must be %s, not %s, expected, name)
 
 @specialize.arg(1)
 def getarg_w(self, code, w_obj):
@@ -1442,7 +1446,14 @@
 except OperationError, e:
 if not e.match(self, self.w_TypeError):
 raise
-return self.readbuf_w(w_obj).as_str()
+try:
+buf = w_obj.buffer_w(self, 0)
+except TypeError:
+try:
+buf = w_obj.readbuf_w(self)
+except TypeError:
+self._getarg_error(string or buffer, w_obj)
+return buf.as_str()
 
 def bufferchar_w(self, w_obj):
 try:
diff --git a/pypy/module/_socket/test/test_sock_app.py 
b/pypy/module/_socket/test/test_sock_app.py
--- a/pypy/module/_socket/test/test_sock_app.py
+++ b/pypy/module/_socket/test/test_sock_app.py
@@ -545,8 +545,12 @@
 s.connect((www.python.org, 80))
 except _socket.gaierror, ex:
 skip(GAIError - probably no connection: %s % str(ex.args))
+exc = raises(TypeError, s.send, None)
+assert str(exc.value) == must be string or buffer, not None
 assert s.send(buffer('')) == 0
 assert s.sendall(buffer('')) is None
+assert s.send(memoryview('')) == 0
+assert s.sendall(memoryview('')) is None
 assert s.send(u'') == 0
 assert s.sendall(u'') is None
 raises(UnicodeEncodeError, s.send, u'\xe9')
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy refactor-buffer-api: kill bufferchar_w

2014-04-23 Thread bdkearns
Author: Brian Kearns bdkea...@gmail.com
Branch: refactor-buffer-api
Changeset: r70913:33a8fc69f913
Date: 2014-04-23 21:54 -0400
http://bitbucket.org/pypy/pypy/changeset/33a8fc69f913/

Log:kill bufferchar_w

diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py
--- a/pypy/interpreter/baseobjspace.py
+++ b/pypy/interpreter/baseobjspace.py
@@ -1431,7 +1431,7 @@
 else:
 assert False
 
-# XXX rename these/replace with code more like CPython getargs for buffers
+# XXX rename/replace with code more like CPython getargs for buffers
 def bufferstr_w(self, w_obj):
 # Directly returns an interp-level str.  Note that if w_obj is a
 # unicode string, this is different from str_w(buffer(w_obj)):
@@ -1455,14 +1455,6 @@
 self._getarg_error(string or buffer, w_obj)
 return buf.as_str()
 
-def bufferchar_w(self, w_obj):
-try:
-return self.str_w(w_obj)
-except OperationError, e:
-if not e.match(self, self.w_TypeError):
-raise
-return self.charbuf_w(w_obj)
-
 def str_or_None_w(self, w_obj):
 if self.is_w(w_obj, self.w_None):
 return None
diff --git a/pypy/objspace/std/bytesobject.py b/pypy/objspace/std/bytesobject.py
--- a/pypy/objspace/std/bytesobject.py
+++ b/pypy/objspace/std/bytesobject.py
@@ -477,8 +477,14 @@
 def _val(self, space):
 return self._value
 
-def _op_val(self, space, w_other):
-return space.bufferchar_w(w_other)
+@staticmethod
+def _op_val(space, w_other):
+try:
+return space.str_w(w_other)
+except OperationError, e:
+if not e.match(space, space.w_TypeError):
+raise
+return space.charbuf_w(w_other)
 
 def _chr(self, char):
 assert len(char) == 1
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy refactor-buffer-api: fix translation

2014-04-23 Thread bdkearns
Author: Brian Kearns bdkea...@gmail.com
Branch: refactor-buffer-api
Changeset: r70914:820aa0f69a94
Date: 2014-04-23 22:01 -0400
http://bitbucket.org/pypy/pypy/changeset/820aa0f69a94/

Log:fix translation

diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py
--- a/pypy/interpreter/baseobjspace.py
+++ b/pypy/interpreter/baseobjspace.py
@@ -1449,11 +1449,15 @@
 try:
 buf = w_obj.buffer_w(self, 0)
 except TypeError:
-try:
-buf = w_obj.readbuf_w(self)
-except TypeError:
-self._getarg_error(string or buffer, w_obj)
-return buf.as_str()
+pass
+else:
+return buf.as_str()
+try:
+buf = w_obj.readbuf_w(self)
+except TypeError:
+self._getarg_error(string or buffer, w_obj)
+else:
+return buf.as_str()
 
 def str_or_None_w(self, w_obj):
 if self.is_w(w_obj, self.w_None):
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy refactor-buffer-api: reorder

2014-04-23 Thread bdkearns
Author: Brian Kearns bdkea...@gmail.com
Branch: refactor-buffer-api
Changeset: r70915:53a0d2a1bfde
Date: 2014-04-23 22:19 -0400
http://bitbucket.org/pypy/pypy/changeset/53a0d2a1bfde/

Log:reorder

diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py
--- a/pypy/interpreter/baseobjspace.py
+++ b/pypy/interpreter/baseobjspace.py
@@ -1372,7 +1372,7 @@
 BUF_WRITABLE = 4
 
 def check_buf_flags(self, flags, readonly):
-if flags  self.BUF_WRITABLE == self.BUF_WRITABLE and readonly:
+if readonly and flags  self.BUF_WRITABLE == self.BUF_WRITABLE:
 raise oefmt(self.w_BufferError, Object is not writable.)
 
 def buffer_w(self, w_obj, flags):
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy refactor-buffer-api: fix usage of bufferstr_w in _io

2014-04-23 Thread bdkearns
Author: Brian Kearns bdkea...@gmail.com
Branch: refactor-buffer-api
Changeset: r70917:48ee80cfca6b
Date: 2014-04-23 23:20 -0400
http://bitbucket.org/pypy/pypy/changeset/48ee80cfca6b/

Log:fix usage of bufferstr_w in _io

diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py
--- a/pypy/interpreter/baseobjspace.py
+++ b/pypy/interpreter/baseobjspace.py
@@ -1416,7 +1416,20 @@
 
 @specialize.arg(1)
 def getarg_w(self, code, w_obj):
-if code == 'w*':
+if code == 's*':
+if self.isinstance_w(w_obj, self.w_str):
+return w_obj.readbuf_w(self)
+if self.isinstance_w(w_obj, self.w_unicode):
+return self.str(w_obj).readbuf_w(self)
+try:
+return w_obj.buffer_w(self, 0)
+except TypeError:
+pass
+try:
+return w_obj.readbuf_w(self)
+except TypeError:
+self._getarg_error(string or buffer, w_obj)
+elif code == 'w*':
 try:
 try:
 return w_obj.buffer_w(self, self.BUF_WRITABLE)
diff --git a/pypy/module/_io/interp_bufferedio.py 
b/pypy/module/_io/interp_bufferedio.py
--- a/pypy/module/_io/interp_bufferedio.py
+++ b/pypy/module/_io/interp_bufferedio.py
@@ -701,7 +701,7 @@
 def write_w(self, space, w_data):
 self._check_init(space)
 self._check_closed(space, write to closed file)
-data = space.bufferstr_w(w_data)
+data = space.getarg_w('s*', w_data).as_str()
 size = len(data)
 
 with self.lock:
diff --git a/pypy/module/_io/interp_bytesio.py 
b/pypy/module/_io/interp_bytesio.py
--- a/pypy/module/_io/interp_bytesio.py
+++ b/pypy/module/_io/interp_bytesio.py
@@ -50,10 +50,7 @@
 
 def write_w(self, space, w_data):
 self._check_closed(space)
-if space.isinstance_w(w_data, space.w_unicode):
-raise OperationError(space.w_TypeError, space.wrap(
-bytes string of buffer expected))
-buf = space.bufferstr_w(w_data)
+buf = space.buffer_w(w_data, space.BUF_CONTIG_RO).as_str()
 length = len(buf)
 if length = 0:
 return space.wrap(0)
diff --git a/pypy/module/_io/interp_fileio.py b/pypy/module/_io/interp_fileio.py
--- a/pypy/module/_io/interp_fileio.py
+++ b/pypy/module/_io/interp_fileio.py
@@ -333,7 +333,7 @@
 def write_w(self, space, w_data):
 self._check_closed(space)
 self._check_writable(space)
-data = space.bufferstr_w(w_data)
+data = space.getarg_w('s*', w_data).as_str()
 
 try:
 n = os.write(self.fd, data)
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy refactor-buffer-api: fix test_ztranslations

2014-04-23 Thread bdkearns
Author: Brian Kearns bdkea...@gmail.com
Branch: refactor-buffer-api
Changeset: r70918:6138264b2697
Date: 2014-04-23 23:25 -0400
http://bitbucket.org/pypy/pypy/changeset/6138264b2697/

Log:fix test_ztranslations

diff --git a/pypy/objspace/fake/objspace.py b/pypy/objspace/fake/objspace.py
--- a/pypy/objspace/fake/objspace.py
+++ b/pypy/objspace/fake/objspace.py
@@ -40,6 +40,9 @@
 def setclass(self, space, w_subtype):
 is_root(w_subtype)
 
+def buffer_w(self, space, flags):
+return Buffer()
+
 def str_w(self, space):
 return NonConstant(foobar)
 
@@ -296,14 +299,6 @@
 ec._py_repr = None
 return ec
 
-def readbuf_w(self, w_obj):
-is_root(w_obj)
-return Buffer()
-
-def writebuf_w(self, w_obj):
-is_root(w_obj)
-return Buffer()
-
 def unicode_from_object(self, w_obj):
 return w_some_obj()
 
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy refactor-buffer-api: fix usage of bufferstr_w in unicodeobject

2014-04-23 Thread bdkearns
Author: Brian Kearns bdkea...@gmail.com
Branch: refactor-buffer-api
Changeset: r70916:da264ab81348
Date: 2014-04-23 22:54 -0400
http://bitbucket.org/pypy/pypy/changeset/da264ab81348/

Log:fix usage of bufferstr_w in unicodeobject

diff --git a/pypy/objspace/std/unicodeobject.py 
b/pypy/objspace/std/unicodeobject.py
--- a/pypy/objspace/std/unicodeobject.py
+++ b/pypy/objspace/std/unicodeobject.py
@@ -448,12 +448,12 @@
 if errors is None or errors == 'strict':
 if encoding == 'ascii':
 # XXX error handling
-s = space.bufferstr_w(w_obj)
+s = space.charbuf_w(w_obj)
 eh = unicodehelper.decode_error_handler(space)
 return space.wrap(str_decode_ascii(
 s, len(s), None, final=True, errorhandler=eh)[0])
 if encoding == 'utf-8':
-s = space.bufferstr_w(w_obj)
+s = space.charbuf_w(w_obj)
 eh = unicodehelper.decode_error_handler(space)
 return space.wrap(str_decode_utf_8(
 s, len(s), None, final=True, errorhandler=eh,
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy refactor-buffer-api: fix usage of bufferstr_w in _file

2014-04-23 Thread bdkearns
Author: Brian Kearns bdkea...@gmail.com
Branch: refactor-buffer-api
Changeset: r70919:b0b180cf068a
Date: 2014-04-23 23:33 -0400
http://bitbucket.org/pypy/pypy/changeset/b0b180cf068a/

Log:fix usage of bufferstr_w in _file

diff --git a/pypy/module/_file/interp_file.py b/pypy/module/_file/interp_file.py
--- a/pypy/module/_file/interp_file.py
+++ b/pypy/module/_file/interp_file.py
@@ -267,9 +267,14 @@
 
 def direct_write(self, w_data):
 space = self.space
-if not self.binary and space.isinstance_w(w_data, space.w_unicode):
-w_data = space.call_method(w_data, encode, 
space.wrap(self.encoding), space.wrap(self.errors))
-data = space.bufferstr_w(w_data)
+if self.binary:
+data = space.getarg_w('s*', w_data).as_str()
+else:
+if space.isinstance_w(w_data, space.w_unicode):
+w_data = space.call_method(w_data, encode,
+   space.wrap(self.encoding),
+   space.wrap(self.errors))
+data = space.charbuf_w(w_data)
 self.do_direct_write(data)
 
 def do_direct_write(self, data):
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit