[pypy-commit] pypy default: kill debug print

2014-10-28 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: 
Changeset: r74266:2a5bd4280f02
Date: 2014-10-28 10:32 -0700
http://bitbucket.org/pypy/pypy/changeset/2a5bd4280f02/

Log:kill debug print

diff --git a/pypy/module/select/test/test_select.py 
b/pypy/module/select/test/test_select.py
--- a/pypy/module/select/test/test_select.py
+++ b/pypy/module/select/test/test_select.py
@@ -309,7 +309,6 @@
 import select
 class Foo(object):
 def fileno(self):
-print len(l)
 if len(l)  100:
 l.append(Foo())
 return 0
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: merge default

2014-10-28 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3k
Changeset: r74267:a245775c1e36
Date: 2014-10-28 10:33 -0700
http://bitbucket.org/pypy/pypy/changeset/a245775c1e36/

Log:merge default

diff --git a/pypy/module/select/test/test_select.py 
b/pypy/module/select/test/test_select.py
--- a/pypy/module/select/test/test_select.py
+++ b/pypy/module/select/test/test_select.py
@@ -309,7 +309,6 @@
 import select
 class Foo(object):
 def fileno(self):
-print len(l)
 if len(l)  100:
 l.append(Foo())
 return 0
diff --git a/rpython/jit/backend/llsupport/assembler.py 
b/rpython/jit/backend/llsupport/assembler.py
--- a/rpython/jit/backend/llsupport/assembler.py
+++ b/rpython/jit/backend/llsupport/assembler.py
@@ -225,7 +225,8 @@
 raise AssertionError(kind)
 
 gcref = cast_instance_to_gcref(value)
-rgc._make_sure_does_not_move(gcref)
+if gcref:
+rgc._make_sure_does_not_move(gcref)
 value = rffi.cast(lltype.Signed, gcref)
 je_location = self._call_assembler_check_descr(value, tmploc)
 #
diff --git a/rpython/rlib/rgc.py b/rpython/rlib/rgc.py
--- a/rpython/rlib/rgc.py
+++ b/rpython/rlib/rgc.py
@@ -63,10 +63,13 @@
 Unpin 'obj', allowing it to move again.
 Must only be called after a call to pin(obj) returned True.
 
-for i in range(len(_pinned_objects)):
+i = 0
+while i  len(_pinned_objects):
 try:
 if _pinned_objects[i] == obj:
 del _pinned_objects[i]
+else:
+i += 1
 except TypeError:
 pass
 
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3.3: merge py3k

2014-10-28 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3.3
Changeset: r74269:27d01c9572b0
Date: 2014-10-28 13:40 -0700
http://bitbucket.org/pypy/pypy/changeset/27d01c9572b0/

Log:merge py3k

diff --git a/pypy/module/select/test/test_select.py 
b/pypy/module/select/test/test_select.py
--- a/pypy/module/select/test/test_select.py
+++ b/pypy/module/select/test/test_select.py
@@ -310,7 +310,6 @@
 import select
 class Foo(object):
 def fileno(self):
-print len(l)
 if len(l)  100:
 l.append(Foo())
 return 0
diff --git a/pypy/objspace/std/test/test_complexobject.py 
b/pypy/objspace/std/test/test_complexobject.py
--- a/pypy/objspace/std/test/test_complexobject.py
+++ b/pypy/objspace/std/test/test_complexobject.py
@@ -198,12 +198,12 @@
 assert large != (5+0j)
 
 def test_richcompare_numbers(self):
-for n in 8, 8L, 0.01:
+for n in 8, 0.01:
 assert complex.__eq__(n+0j, n)
 assert not complex.__ne__(n+0j, n)
 assert not complex.__eq__(complex(n, n), n)
 assert complex.__ne__(complex(n, n), n)
-raises(TypeError, complex.__lt__, n+0j, n)
+assert complex.__lt__(n+0j, n) is NotImplemented
 
 def test_richcompare_boundaries(self):
 z = 9007199254740992+0j
diff --git a/rpython/jit/backend/llsupport/assembler.py 
b/rpython/jit/backend/llsupport/assembler.py
--- a/rpython/jit/backend/llsupport/assembler.py
+++ b/rpython/jit/backend/llsupport/assembler.py
@@ -225,7 +225,8 @@
 raise AssertionError(kind)
 
 gcref = cast_instance_to_gcref(value)
-rgc._make_sure_does_not_move(gcref)
+if gcref:
+rgc._make_sure_does_not_move(gcref)
 value = rffi.cast(lltype.Signed, gcref)
 je_location = self._call_assembler_check_descr(value, tmploc)
 #
diff --git a/rpython/rlib/rgc.py b/rpython/rlib/rgc.py
--- a/rpython/rlib/rgc.py
+++ b/rpython/rlib/rgc.py
@@ -63,10 +63,13 @@
 Unpin 'obj', allowing it to move again.
 Must only be called after a call to pin(obj) returned True.
 
-for i in range(len(_pinned_objects)):
+i = 0
+while i  len(_pinned_objects):
 try:
 if _pinned_objects[i] == obj:
 del _pinned_objects[i]
+else:
+i += 1
 except TypeError:
 pass
 
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: adapt to py3

2014-10-28 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3k
Changeset: r74268:6bd3457fb73c
Date: 2014-10-28 13:39 -0700
http://bitbucket.org/pypy/pypy/changeset/6bd3457fb73c/

Log:adapt to py3

diff --git a/pypy/objspace/std/test/test_complexobject.py 
b/pypy/objspace/std/test/test_complexobject.py
--- a/pypy/objspace/std/test/test_complexobject.py
+++ b/pypy/objspace/std/test/test_complexobject.py
@@ -198,12 +198,12 @@
 assert large != (5+0j)
 
 def test_richcompare_numbers(self):
-for n in 8, 8L, 0.01:
+for n in 8, 0.01:
 assert complex.__eq__(n+0j, n)
 assert not complex.__ne__(n+0j, n)
 assert not complex.__eq__(complex(n, n), n)
 assert complex.__ne__(complex(n, n), n)
-raises(TypeError, complex.__lt__, n+0j, n)
+assert complex.__lt__(n+0j, n) is NotImplemented
 
 def test_richcompare_boundaries(self):
 z = 9007199254740992+0j
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: apply dcd221b49852 from upstream: fix backspace

2014-10-28 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3k
Changeset: r74270:07bfeead7109
Date: 2014-10-28 13:54 -0700
http://bitbucket.org/pypy/pypy/changeset/07bfeead7109/

Log:apply dcd221b49852 from upstream: fix backspace

diff --git a/lib_pypy/pyrepl/reader.py b/lib_pypy/pyrepl/reader.py
--- a/lib_pypy/pyrepl/reader.py
+++ b/lib_pypy/pyrepl/reader.py
@@ -54,7 +54,7 @@
 return u[c]
 else:
 if unicodedata.category(c).startswith('C'):
-return br'\u%04x' % ord(c)
+return '\u%04x' % ord(c)
 else:
 return c
 
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pyrepl py3k-readline: back out dcd221b49852, this breaks other things

2014-10-28 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3k-readline
Changeset: r260:c4629148366e
Date: 2014-10-28 14:09 -0700
http://bitbucket.org/pypy/pyrepl/changeset/c4629148366e/

Log:back out dcd221b49852, this breaks other things

diff --git a/pyrepl/reader.py b/pyrepl/reader.py
--- a/pyrepl/reader.py
+++ b/pyrepl/reader.py
@@ -51,7 +51,7 @@
 return u[c]
 else:
 if unicodedata.category(c).startswith('C'):
-return '\u%04x' % ord(c)
+return br'\u%04x' % ord(c)
 else:
 return c
 
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: backout 07bfeead7109: this breaks other things

2014-10-28 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3k
Changeset: r74271:5a19346c71a9
Date: 2014-10-28 14:09 -0700
http://bitbucket.org/pypy/pypy/changeset/5a19346c71a9/

Log:backout 07bfeead7109: this breaks other things

diff --git a/lib_pypy/pyrepl/reader.py b/lib_pypy/pyrepl/reader.py
--- a/lib_pypy/pyrepl/reader.py
+++ b/lib_pypy/pyrepl/reader.py
@@ -54,7 +54,7 @@
 return u[c]
 else:
 if unicodedata.category(c).startswith('C'):
-return '\u%04x' % ord(c)
+return br'\u%04x' % ord(c)
 else:
 return c
 
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: backout 8f1cad01a693 for -Ojit

2014-10-27 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3k
Changeset: r74259:c96101761312
Date: 2014-10-27 13:26 -0700
http://bitbucket.org/pypy/pypy/changeset/c96101761312/

Log:backout 8f1cad01a693 for -Ojit

diff --git a/pypy/module/_codecs/locale.c b/pypy/module/_codecs/locale.c
--- a/pypy/module/_codecs/locale.c
+++ b/pypy/module/_codecs/locale.c
@@ -1,7 +1,6 @@
 /* From CPython 3.2.3's fileutils.c, and _Py_normalize_encoding from
unicodeobject.c
 */
-#include src/precommondefs.h
 /*
 #include Python.h
 */
@@ -226,7 +225,7 @@
 
Conversion errors should never happen, unless there is a bug in the C
library. */
-RPY_EXPORTED_FOR_TESTS wchar_t*
+wchar_t*
 pypy_char2wchar(const char* arg, size_t *size)
 {
 #if 0  defined(__APPLE__)
@@ -368,7 +367,7 @@
 
If error_pos is not NULL: *error_pos is the index of the invalid character
on conversion error, or (size_t)-1 otherwise. */
-RPY_EXPORTED_FOR_TESTS char*
+char*
 pypy_wchar2char(const wchar_t *text, size_t *error_pos)
 {
 #if 0  defined(__APPLE__)
@@ -475,13 +474,13 @@
 #endif   /* __APPLE__ */
 }
 
-RPY_EXPORTED_FOR_TESTS void
+void
 pypy_char2wchar_free(wchar_t *text)
 {
 PyMem_Free(text);
 }
 
-RPY_EXPORTED_FOR_TESTS void
+void
 pypy_wchar2char_free(char *bytes)
 {
 PyMem_Free(bytes);
diff --git a/pypy/module/_codecs/locale.h b/pypy/module/_codecs/locale.h
new file mode 100644
--- /dev/null
+++ b/pypy/module/_codecs/locale.h
@@ -0,0 +1,8 @@
+#include stdlib.h
+#include wchar.h
+#include src/precommondefs.h
+
+RPY_EXPORTED_FOR_TESTS wchar_t* pypy_char2wchar(const char* arg, size_t *size);
+RPY_EXPORTED_FOR_TESTS void pypy_char2wchar_free(wchar_t *text);
+RPY_EXPORTED_FOR_TESTS char* pypy_wchar2char(const wchar_t *text, size_t 
*error_pos);
+RPY_EXPORTED_FOR_TESTS void pypy_wchar2char_free(char *bytes);
diff --git a/pypy/module/_codecs/locale.py b/pypy/module/_codecs/locale.py
--- a/pypy/module/_codecs/locale.py
+++ b/pypy/module/_codecs/locale.py
@@ -15,7 +15,8 @@
 
 cwd = py.path.local(__file__).dirpath()
 eci = ExternalCompilationInfo(
-include_dirs=[cdir],
+includes=[cwd.join('locale.h')],
+include_dirs=[str(cwd), cdir],
 separate_module_files=[cwd.join('locale.c')])
 
 def llexternal(*args, **kwargs):
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: rename to avoid clashing w/ the system's locale.h

2014-10-27 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3k
Changeset: r74260:620dfe2c1035
Date: 2014-10-27 15:14 -0700
http://bitbucket.org/pypy/pypy/changeset/620dfe2c1035/

Log:rename to avoid clashing w/ the system's locale.h

diff --git a/pypy/module/_codecs/locale.py b/pypy/module/_codecs/locale.py
--- a/pypy/module/_codecs/locale.py
+++ b/pypy/module/_codecs/locale.py
@@ -15,9 +15,9 @@
 
 cwd = py.path.local(__file__).dirpath()
 eci = ExternalCompilationInfo(
-includes=[cwd.join('locale.h')],
+includes=[cwd.join('locale_codec.h')],
 include_dirs=[str(cwd), cdir],
-separate_module_files=[cwd.join('locale.c')])
+separate_module_files=[cwd.join('locale_codec.c')])
 
 def llexternal(*args, **kwargs):
 kwargs.setdefault('compilation_info', eci)
diff --git a/pypy/module/_codecs/locale.c b/pypy/module/_codecs/locale_codec.c
rename from pypy/module/_codecs/locale.c
rename to pypy/module/_codecs/locale_codec.c
--- a/pypy/module/_codecs/locale.c
+++ b/pypy/module/_codecs/locale_codec.c
@@ -28,6 +28,7 @@
 #include locale.h
 #include langinfo.h
 #endif
+#include locale_codec.h
 
 #if 0  defined(__APPLE__)
 extern wchar_t* _Py_DecodeUTF8_surrogateescape(const char *s, Py_ssize_t size);
diff --git a/pypy/module/_codecs/locale.h b/pypy/module/_codecs/locale_codec.h
rename from pypy/module/_codecs/locale.h
rename to pypy/module/_codecs/locale_codec.h
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3.3: merge py3k

2014-10-27 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3.3
Changeset: r74263:2c4e59799687
Date: 2014-10-27 16:50 -0700
http://bitbucket.org/pypy/pypy/changeset/2c4e59799687/

Log:merge py3k

diff --git a/pypy/module/_codecs/locale.c b/pypy/module/_codecs/locale.c
deleted file mode 100644
--- a/pypy/module/_codecs/locale.c
+++ /dev/null
@@ -1,524 +0,0 @@
-/* From CPython 3.2.3's fileutils.c, and _Py_normalize_encoding from
-   unicodeobject.c
-*/
-#include src/precommondefs.h
-/*
-#include Python.h
-*/
-#include ctype.h
-#include locale.h
-#include stdlib.h
-#include stdio.h
-#include string.h
-#include wchar.h
-#ifdef _MSC_VER
-#define MS_WINDOWS
-#endif
-#define PyMem_Malloc malloc
-#define PyMem_Free free
-/* C99 but recent Windows has it */
-#define HAVE_MBRTOWC 1
-/* Hopefully? */
-#define HAVE_LANGINFO_H
-
-#ifdef MS_WINDOWS
-#  include windows.h
-#endif
-
-#ifdef HAVE_LANGINFO_H
-#include locale.h
-#include langinfo.h
-#endif
-
-#if 0  defined(__APPLE__)
-extern wchar_t* _Py_DecodeUTF8_surrogateescape(const char *s, Py_ssize_t size);
-#endif
-
-#if !defined(__APPLE__)  !defined(MS_WINDOWS)
-extern int _pypy_normalize_encoding(const char *, char *, size_t);
-
-/* Workaround FreeBSD and OpenIndiana locale encoding issue with the C locale.
-   On these operating systems, nl_langinfo(CODESET) announces an alias of the
-   ASCII encoding, whereas mbstowcs() and wcstombs() functions use the
-   ISO-8859-1 encoding. The problem is that os.fsencode() and os.fsdecode() use
-   locale.getpreferredencoding() codec. For example, if command line arguments
-   are decoded by mbstowcs() and encoded back by os.fsencode(), we get a
-   UnicodeEncodeError instead of retrieving the original byte string.
-
-   The workaround is enabled if setlocale(LC_CTYPE, NULL) returns C,
-   nl_langinfo(CODESET) announces ascii (or an alias to ASCII), and at least
-   one byte in range 0x80-0xff can be decoded from the locale encoding. The
-   workaround is also enabled on error, for example if getting the locale
-   failed.
-
-   Values of locale_is_ascii:
-
-   1: the workaround is used: _Py_wchar2char() uses
-  encode_ascii_surrogateescape() and _Py_char2wchar() uses
-  decode_ascii_surrogateescape()
-   0: the workaround is not used: _Py_wchar2char() uses wcstombs() and
-  _Py_char2wchar() uses mbstowcs()
-  -1: unknown, need to call check_force_ascii() to get the value
-*/
-static int force_ascii = -1;
-
-static int
-_pypy_check_force_ascii(void)
-{
-char *loc;
-#if defined(HAVE_LANGINFO_H)  defined(CODESET)
-char *codeset, **alias;
-char encoding[100];
-int is_ascii;
-unsigned int i;
-char* ascii_aliases[] = {
-ascii,
-646,
-ansi-x3.4-1968,
-ansi-x3-4-1968,
-ansi-x3.4-1986,
-cp367,
-csascii,
-ibm367,
-iso646-us,
-iso-646.irv-1991,
-iso-ir-6,
-us,
-us-ascii,
-NULL
-};
-#endif
-
-loc = setlocale(LC_CTYPE, NULL);
-if (loc == NULL)
-goto error;
-if (strcmp(loc, C) != 0) {
-/* the LC_CTYPE locale is different than C */
-return 0;
-}
-
-#if defined(HAVE_LANGINFO_H)  defined(CODESET)
-codeset = nl_langinfo(CODESET);
-if (!codeset || codeset[0] == '\0') {
-/* CODESET is not set or empty */
-goto error;
-}
-if (!_pypy_normalize_encoding(codeset, encoding, sizeof(encoding)))
-goto error;
-
-is_ascii = 0;
-for (alias=ascii_aliases; *alias != NULL; alias++) {
-if (strcmp(encoding, *alias) == 0) {
-is_ascii = 1;
-break;
-}
-}
-if (!is_ascii) {
-/* nl_langinfo(CODESET) is not ascii or an alias of ASCII */
-return 0;
-}
-
-for (i=0x80; i0xff; i++) {
-unsigned char ch;
-wchar_t wch;
-size_t res;
-
-ch = (unsigned char)i;
-res = mbstowcs(wch, (char*)ch, 1);
-if (res != (size_t)-1) {
-/* decoding a non-ASCII character from the locale encoding succeed:
-   the locale encoding is not ASCII, force ASCII */
-return 1;
-}
-}
-/* None of the bytes in the range 0x80-0xff can be decoded from the locale
-   encoding: the locale encoding is really ASCII */
-return 0;
-#else
-/* nl_langinfo(CODESET) is not available: always force ASCII */
-return 1;
-#endif
-
-error:
-/* if an error occured, force the ASCII encoding */
-return 1;
-}
-
-static char*
-_pypy_encode_ascii_surrogateescape(const wchar_t *text, size_t *error_pos)
-{
-char *result = NULL, *out;
-size_t len, i;
-wchar_t ch;
-
-if (error_pos != NULL)
-*error_pos = (size_t)-1;
-
-len = wcslen(text);
-
-result = PyMem_Malloc(len + 1);  /* +1 for NUL byte */
-if (result == NULL)
-return NULL;
-
-out = result;
-for (i=0; ilen; i++) {
-ch = text[i];
-
-if (ch = 0x7f) {
-

[pypy-commit] pypy default: backout 673f241, -Ojit fails without the .h

2014-10-26 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: 
Changeset: r74240:431cebffcb39
Date: 2014-10-25 22:31 -0700
http://bitbucket.org/pypy/pypy/changeset/431cebffcb39/

Log:backout 673f241, -Ojit fails without the .h

diff --git a/pypy/module/operator/tscmp.c b/pypy/module/operator/tscmp.c
--- a/pypy/module/operator/tscmp.c
+++ b/pypy/module/operator/tscmp.c
@@ -1,9 +1,10 @@
 /* Derived from CPython 3.3.5's operator.c::_tscmp
  */
 
+#include src/precommondefs.h
 #include stdlib.h
 #include wchar.h
-#include src/precommondefs.h
+#include tscmp.h
 
 RPY_EXPORTED_FOR_TESTS int
 pypy_tscmp(const char *a, const char *b, long len_a, long len_b)
diff --git a/pypy/module/operator/tscmp.h b/pypy/module/operator/tscmp.h
new file mode 100644
--- /dev/null
+++ b/pypy/module/operator/tscmp.h
@@ -0,0 +1,2 @@
+int pypy_tscmp(const char *, const char *, long, long);
+int pypy_tscmp_wide(const wchar_t *, const wchar_t *, long, long);
diff --git a/pypy/module/operator/tscmp.py b/pypy/module/operator/tscmp.py
--- a/pypy/module/operator/tscmp.py
+++ b/pypy/module/operator/tscmp.py
@@ -12,7 +12,8 @@
 
 cwd = py.path.local(__file__).dirpath()
 eci = ExternalCompilationInfo(
-include_dirs=[cdir],
+includes=[cwd.join('tscmp.h')],
+include_dirs=[str(cwd), cdir],
 separate_module_files=[cwd.join('tscmp.c')])
 
 
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: merge default

2014-10-26 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3k
Changeset: r74242:f70579d34dff
Date: 2014-10-26 04:45 -0700
http://bitbucket.org/pypy/pypy/changeset/f70579d34dff/

Log:merge default

diff --git a/pypy/module/operator/tscmp.c b/pypy/module/operator/tscmp.c
--- a/pypy/module/operator/tscmp.c
+++ b/pypy/module/operator/tscmp.c
@@ -4,8 +4,9 @@
 #include stdlib.h
 #include wchar.h
 #include src/precommondefs.h
+#include tscmp.h
 
-RPY_EXPORTED_FOR_TESTS int
+int
 pypy_tscmp(const char *a, const char *b, long len_a, long len_b)
 {
 /* The volatile type declarations make sure that the compiler has no
diff --git a/pypy/module/operator/tscmp.h b/pypy/module/operator/tscmp.h
new file mode 100644
--- /dev/null
+++ b/pypy/module/operator/tscmp.h
@@ -0,0 +1,1 @@
+RPY_EXPORTED_FOR_TESTS int pypy_tscmp(const char *, const char *, long, long);
diff --git a/pypy/module/operator/tscmp.py b/pypy/module/operator/tscmp.py
--- a/pypy/module/operator/tscmp.py
+++ b/pypy/module/operator/tscmp.py
@@ -13,7 +13,8 @@
 
 cwd = py.path.local(__file__).dirpath()
 eci = ExternalCompilationInfo(
-include_dirs=[cdir],
+includes=[cwd.join('tscmp.h')],
+include_dirs=[str(cwd), cdir],
 separate_module_files=[cwd.join('tscmp.c')])
 
 
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: refer RPY_EXPORTED_FOR_TESTS on the prototypes

2014-10-26 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: 
Changeset: r74241:3d8fe96dc4d9
Date: 2014-10-26 04:42 -0700
http://bitbucket.org/pypy/pypy/changeset/3d8fe96dc4d9/

Log:refer RPY_EXPORTED_FOR_TESTS on the prototypes

diff --git a/pypy/module/operator/tscmp.c b/pypy/module/operator/tscmp.c
--- a/pypy/module/operator/tscmp.c
+++ b/pypy/module/operator/tscmp.c
@@ -1,12 +1,12 @@
 /* Derived from CPython 3.3.5's operator.c::_tscmp
  */
 
-#include src/precommondefs.h
 #include stdlib.h
 #include wchar.h
+#include src/precommondefs.h
 #include tscmp.h
 
-RPY_EXPORTED_FOR_TESTS int
+int
 pypy_tscmp(const char *a, const char *b, long len_a, long len_b)
 {
 /* The volatile type declarations make sure that the compiler has no
@@ -43,7 +43,7 @@
 return (result == 0);
 }
 
-RPY_EXPORTED_FOR_TESTS int
+int
 pypy_tscmp_wide(const wchar_t *a, const wchar_t *b, long len_a, long len_b)
 {
 /* The volatile type declarations make sure that the compiler has no
diff --git a/pypy/module/operator/tscmp.h b/pypy/module/operator/tscmp.h
--- a/pypy/module/operator/tscmp.h
+++ b/pypy/module/operator/tscmp.h
@@ -1,2 +1,2 @@
-int pypy_tscmp(const char *, const char *, long, long);
-int pypy_tscmp_wide(const wchar_t *, const wchar_t *, long, long);
+RPY_EXPORTED_FOR_TESTS int pypy_tscmp(const char *, const char *, long, long);
+RPY_EXPORTED_FOR_TESTS int pypy_tscmp_wide(const wchar_t *, const wchar_t *, 
long, long);
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: fix -Ojit translation

2014-10-26 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3k
Changeset: r74254:94fb5a72c276
Date: 2014-10-26 22:16 -0700
http://bitbucket.org/pypy/pypy/changeset/94fb5a72c276/

Log:fix -Ojit translation

diff --git a/pypy/module/_posixsubprocess/_posixsubprocess.c 
b/pypy/module/_posixsubprocess/_posixsubprocess.c
--- a/pypy/module/_posixsubprocess/_posixsubprocess.c
+++ b/pypy/module/_posixsubprocess/_posixsubprocess.c
@@ -1,6 +1,5 @@
 /* This file is mostly a copy of CPython's Module/_posixsubprocess.c */
 /* modified for PyPy: Removed dependency on Python API. */
-#include src/precommondefs.h
 
 /* Authors: Gregory P. Smith  Jeffrey Yasskin */
 #if defined(HAVE_PIPE2)  !defined(_GNU_SOURCE)
@@ -20,6 +19,7 @@
 #include sys/syscall.h
 #endif
 #include dirent.h
+#include _posixsubprocess.h
 
 #if defined(sun)
 /* readdir64 is used to work around Solaris 9 bug 6395699. */
@@ -311,7 +311,7 @@
  * This restriction is documented at
  * http://www.opengroup.org/onlinepubs/009695399/functions/fork.html.
  */
-RPY_EXPORTED_FOR_TESTS void
+void
 pypy_subprocess_child_exec(
char *const exec_array[],
char *const argv[],
@@ -476,7 +476,7 @@
 }
 
 
-RPY_EXPORTED_FOR_TESTS int
+int
 pypy_subprocess_cloexec_pipe(int *fds)
 {
 int res;
@@ -518,7 +518,7 @@
 }
 
 
-RPY_EXPORTED_FOR_TESTS void
+void
 pypy_subprocess_init(void)
 {
 #ifdef _SC_OPEN_MAX
diff --git a/pypy/module/_posixsubprocess/_posixsubprocess.h 
b/pypy/module/_posixsubprocess/_posixsubprocess.h
new file mode 100644
--- /dev/null
+++ b/pypy/module/_posixsubprocess/_posixsubprocess.h
@@ -0,0 +1,24 @@
+#include src/precommondefs.h
+
+RPY_EXPORTED_FOR_TESTS void
+pypy_subprocess_child_exec(
+   char *const exec_array[],
+   char *const argv[],
+   char *const envp[],
+   const char *cwd,
+   int p2cread, int p2cwrite,
+   int c2pread, int c2pwrite,
+   int errread, int errwrite,
+   int errpipe_read, int errpipe_write,
+   int close_fds, int restore_signals,
+   int call_setsid,
+   long *py_fds_to_keep,
+  ssize_t num_fds_to_keep,
+   int (*preexec_fn)(void*),
+   void *preexec_fn_arg);
+
+RPY_EXPORTED_FOR_TESTS int
+pypy_subprocess_cloexec_pipe(int *fds);
+
+RPY_EXPORTED_FOR_TESTS void
+pypy_subprocess_init(void);
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
@@ -22,6 +22,7 @@
 config = platform.configure(CConfig)
 
 eci = ExternalCompilationInfo(
+includes=[thisdir.join('_posixsubprocess.h')],
 include_dirs=[str(thisdir), cdir],
 separate_module_files=[thisdir.join('_posixsubprocess.c')])
 
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3.3: merge upstream

2014-10-26 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3.3
Changeset: r74256:376dcdcf68d7
Date: 2014-10-26 22:19 -0700
http://bitbucket.org/pypy/pypy/changeset/376dcdcf68d7/

Log:merge upstream

diff --git a/pypy/module/_lzma/__init__.py b/pypy/module/_lzma/__init__.py
--- a/pypy/module/_lzma/__init__.py
+++ b/pypy/module/_lzma/__init__.py
@@ -11,11 +11,17 @@
 'LZMAError': 'interp_lzma.W_LZMAError',
 '_encode_filter_properties': 'interp_lzma.encode_filter_properties',
 '_decode_filter_properties': 'interp_lzma.decode_filter_properties',
-'FORMAT_AUTO': 'space.wrap(interp_lzma.FORMAT_AUTO)',
-'FORMAT_XZ': 'space.wrap(interp_lzma.FORMAT_XZ)',
-'FORMAT_ALONE': 'space.wrap(interp_lzma.FORMAT_ALONE)',
-'FORMAT_RAW': 'space.wrap(interp_lzma.FORMAT_RAW)',
 }
 
+for name in 'AUTO XZ ALONE RAW'.split():
+interpleveldefs['FORMAT_%s' % name] = (
+'space.wrap(interp_lzma.FORMAT_%s)' % name)
+for name in 'DEFAULT EXTREME'.split():
+interpleveldefs['PRESET_%s' % name] = (
+'space.wrap(interp_lzma.LZMA_PRESET_%s)' % name)
+for name in 'LZMA1 LZMA2 DELTA X86 IA64 ARM ARMTHUMB SPARC 
POWERPC'.split():
+interpleveldefs['FILTER_%s' % name] = (
+'space.wrap(interp_lzma.LZMA_FILTER_%s)' % name)
+
 appleveldefs = {
 }
diff --git a/pypy/module/_lzma/interp_lzma.py b/pypy/module/_lzma/interp_lzma.py
--- a/pypy/module/_lzma/interp_lzma.py
+++ b/pypy/module/_lzma/interp_lzma.py
@@ -54,6 +54,10 @@
 LZMA_PRESET_DEFAULT
 LZMA_CHECK_ID_MAX
 LZMA_TELL_ANY_CHECK LZMA_TELL_NO_CHECK
+LZMA_FILTER_LZMA1 LZMA_FILTER_LZMA2 LZMA_FILTER_DELTA
+LZMA_FILTER_IA64 LZMA_FILTER_X86 LZMA_FILTER_ARM LZMA_FILTER_ARMTHUMB
+LZMA_FILTER_SPARC LZMA_FILTER_POWERPC
+LZMA_PRESET_DEFAULT LZMA_PRESET_EXTREME
 '''.split()
 for name in constant_names:
 setattr(CConfig, name, platform.ConstantInteger(name))
@@ -187,7 +191,7 @@
 raise_error(space, Invalid compression preset: %d, 
preset)
 lzret = lzma_alone_encoder(self.lzs, options)
 else:
-raise NotImplementedError
+raise oefmt(space.w_NotImplementedError, Filter specs)
 _catch_lzma_error(space, lzret)
 
 @staticmethod
@@ -209,7 +213,7 @@
 if format == FORMAT_ALONE:
 self._init_alone(space, preset, w_filters)
 else:
-raise NotImplementedError
+raise oefmt(space.w_NotImplementedError, Format %d, format)
 
 return w_self
 
@@ -294,7 +298,7 @@
 lzret = lzma_auto_decoder(self.lzs, memlimit, decoder_flags)
 _catch_lzma_error(space, lzret)
 else:
-raise NotImplementedError
+raise oefmt(space.w_NotImplementedError, Format %d, format)
 
 return w_self
 
diff --git a/pypy/module/marshal/interp_marshal.py 
b/pypy/module/marshal/interp_marshal.py
--- a/pypy/module/marshal/interp_marshal.py
+++ b/pypy/module/marshal/interp_marshal.py
@@ -1,4 +1,4 @@
-from pypy.interpreter.error import OperationError
+from pypy.interpreter.error import OperationError, oefmt
 from pypy.interpreter.gateway import WrappedDefault, unwrap_spec
 from rpython.rlib.rarithmetic import intmask
 from rpython.rlib import rstackovf
@@ -102,8 +102,13 @@
 space = self.space
 w_ret = space.call_function(self.func, space.wrap(n))
 ret = space.str_w(w_ret)
-if len(ret) != n:
+if len(ret)  n:
 self.raise_eof()
+if len(ret)  n:
+raise oefmt(space.w_ValueError,
+read() returned too much data: 
+%d bytes requested, %d returned,
+n, len(ret))
 return ret
 
 
diff --git a/pypy/module/marshal/test/test_marshal.py 
b/pypy/module/marshal/test/test_marshal.py
--- a/pypy/module/marshal/test/test_marshal.py
+++ b/pypy/module/marshal/test/test_marshal.py
@@ -205,6 +205,18 @@
 raises(EOFError, marshal.loads, b'test')
 raises((MemoryError, ValueError), marshal.loads, b'(test)')
 
+def test_bad_reader(self):
+import marshal, io
+class BadReader(io.BytesIO):
+def read(self, n=-1):
+b = super().read(n)
+if n is not None and n  4:
+b += b' ' * 10**6
+return b
+for value in (1.0, 1j, b'0123456789', '0123456789'):
+raises(ValueError, marshal.load,
+   BadReader(marshal.dumps(value)))
+
 
 class AppTestSmallLong(AppTestMarshal):
 spaceconfig = AppTestMarshal.spaceconfig.copy()
diff --git a/pypy/module/zlib/interp_zlib.py b/pypy/module/zlib/interp_zlib.py
--- a/pypy/module/zlib/interp_zlib.py
+++ b/pypy/module/zlib/interp_zlib.py
@@ -117,11 +117,14 @@
  method=rzlib.Z_DEFLATED, # \
  wbits=rzlib.MAX_WBITS,   #  \   undocumented
  

[pypy-commit] pypy py3.3: merge py3k

2014-10-26 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3.3
Changeset: r74255:9cf2c4e710ad
Date: 2014-10-26 22:18 -0700
http://bitbucket.org/pypy/pypy/changeset/9cf2c4e710ad/

Log:merge py3k

diff too long, truncating to 2000 out of 29774 lines

diff --git a/.hgignore b/.hgignore
--- a/.hgignore
+++ b/.hgignore
@@ -89,6 +89,7 @@
 ^pypy/doc/image/lattice3\.png$
 ^pypy/doc/image/stackless_informal\.png$
 ^pypy/doc/image/parsing_example.+\.png$
+^rpython/doc/_build/.*$
 ^pypy/module/test_lib_pypy/ctypes_tests/_ctypes_test\.o$
 ^compiled
 ^.git/
diff --git a/README.rst b/README.rst
--- a/README.rst
+++ b/README.rst
@@ -23,6 +23,7 @@
 
 the pypy-dev team pypy-...@python.org
 
+
 Building
 
 
diff --git a/ctypes_configure/doc/configure.txt 
b/ctypes_configure/doc/configure.txt
--- a/ctypes_configure/doc/configure.txt
+++ b/ctypes_configure/doc/configure.txt
@@ -19,6 +19,4 @@
 usage
 =
 
-`sample.py`_ explains in details how to use it.
-
-.. _`sample.py`: 
http://codespeak.net/svn/pypy/dist/ctypes_configure/doc/sample.py
+:source:`sample.py ctypes_configure/doc/sample.py` explains in details how 
to use it.
diff --git a/pypy/config/test/test_pypyoption.py 
b/pypy/config/test/test_pypyoption.py
--- a/pypy/config/test/test_pypyoption.py
+++ b/pypy/config/test/test_pypyoption.py
@@ -64,7 +64,7 @@
 def check_file_exists(fn):
 assert configdocdir.join(fn).check()
 
-from pypy.doc.config.confrest import all_optiondescrs
+from pypy.doc.config.generate import all_optiondescrs
 configdocdir = thisdir.dirpath().dirpath().join(doc, config)
 for descr in all_optiondescrs:
 prefix = descr._name
diff --git a/pypy/doc/TODO b/pypy/doc/TODO
new file mode 100644
--- /dev/null
+++ b/pypy/doc/TODO
@@ -0,0 +1,40 @@
+Documentation TODO
+==
+
+General
+---
+
+* architecture documents don't really show the separation between PyPy and
+  RPython
+  * architecture.rst is duplicate (both pypy and rpython)
+* Consider moving information from pypy/doc/{build,windows}.rst to rpython/doc
+
+
+Cleanup
+~~~
+
+* remove documentation on removed features
+  * various object spaces
+* update / remove dead links
+
+
+Meta
+
+
+* work on configuration/options documentation generation
+
+
+PyPy
+
+
+* Update coding guide
+* Move links from project-documentation.rst to index.rst and consider killing
+  it.
+
+
+RPython
+---
+
+* make translation.rst a high-level overview and move details in their own
+  documents
+* redo various outdated pictures in translation.rst
diff --git a/pypy/doc/__pypy__-module.rst b/pypy/doc/__pypy__-module.rst
--- a/pypy/doc/__pypy__-module.rst
+++ b/pypy/doc/__pypy__-module.rst
@@ -1,20 +1,17 @@
-
 .. comment: this document is very incomplete, should we generate
 it automatically?
 
-===
 The ``__pypy__`` module
 ===
 
 The ``__pypy__`` module is the main entry point to special features provided
-by PyPy's standard interpreter. Its content depends on `configuration 
options`_ 
-which may add new functionality and functions whose existence or non-existence 
-indicates the presence of such features. 
+by PyPy's standard interpreter. Its content depends on :doc:`configuration 
options config/index`
+which may add new functionality and functions whose existence or non-existence
+indicates the presence of such features.
 
-.. _`configuration options`: config/index.html
 
 Generally available functionality
-=
+-
 
  - ``internal_repr(obj)``: return the interpreter-level representation of an
object.
@@ -22,28 +19,22 @@
It works like a simplified array of characters (actually, depending on the
configuration the ``array`` module internally uses this).
 
+
 Transparent Proxy Functionality
-===
+---
 
-If `transparent proxies`_ are enabled (with :config:`objspace.std.withtproxy`)
+If :ref:`transparent proxies tproxy` are enabled (with 
:config:`objspace.std.withtproxy`)
 the following functions are put into ``__pypy__``:
 
  - ``tproxy(typ, controller)``: Return something that looks like it is of type
typ. Its behaviour is completely controlled by the controller. See the docs
-   about `transparent proxies`_ for detail.
-
+   about :ref:`transparent proxies tproxy` for detail.
  - ``get_tproxy_controller(obj)``: If obj is really a transparent proxy, return
its controller. Otherwise return None.
 
-.. _`transparent proxies`: objspace-proxies.html#tproxy
-
 
 Functionality available on py.py (not after translation)
-
+
 
  - ``isfake(obj)``: returns True if ``obj`` is faked.
-
  - ``interp_pdb()``: start a pdb at interpreter-level.
-
-
-
diff --git a/pypy/doc/_ref.txt b/pypy/doc/_ref.txt
deleted file mode 100644
--- a/pypy/doc/_ref.txt
+++ /dev/null

[pypy-commit] pypy py3.3: adapt to RPY_EXPORT_FOR_TESTS

2014-10-26 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3.3
Changeset: r74257:5d069ae3f5b9
Date: 2014-10-26 22:34 -0700
http://bitbucket.org/pypy/pypy/changeset/5d069ae3f5b9/

Log:adapt to RPY_EXPORT_FOR_TESTS

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
@@ -1,6 +1,6 @@
 import os
+
 import py
-
 from rpython.rtyper.lltypesystem import lltype, rffi
 from rpython.rtyper.tool import rffi_platform as platform
 from rpython.translator import cdir
diff --git a/pypy/module/faulthandler/faulthandler.h 
b/pypy/module/faulthandler/faulthandler.h
--- a/pypy/module/faulthandler/faulthandler.h
+++ b/pypy/module/faulthandler/faulthandler.h
@@ -2,17 +2,18 @@
 #define PYPY_FAULTHANDLER_H
 
 #include signal.h
+#include src/precommondefs.h
 
-int pypy_faulthandler_read_null(void);
-void pypy_faulthandler_sigsegv(void);
-int pypy_faulthandler_sigfpe(void);
-void pypy_faulthandler_sigabrt();
+RPY_EXPORTED_FOR_TESTS int pypy_faulthandler_read_null(void);
+RPY_EXPORTED_FOR_TESTS void pypy_faulthandler_sigsegv(void);
+RPY_EXPORTED_FOR_TESTS int pypy_faulthandler_sigfpe(void);
+RPY_EXPORTED_FOR_TESTS void pypy_faulthandler_sigabrt();
 #ifdef SIGBUS
-void pypy_faulthandler_sigbus(void);
+RPY_EXPORTED_FOR_TESTS void pypy_faulthandler_sigbus(void);
 #endif
 
 #ifdef SIGILL
-void pypy_faulthandler_sigill(void);
+RPY_EXPORTED_FOR_TESTS void pypy_faulthandler_sigill(void);
 #endif
 
 #endif  /* PYPY_FAULTHANDLER_H */
diff --git a/pypy/module/faulthandler/interp_faulthandler.py 
b/pypy/module/faulthandler/interp_faulthandler.py
--- a/pypy/module/faulthandler/interp_faulthandler.py
+++ b/pypy/module/faulthandler/interp_faulthandler.py
@@ -3,6 +3,7 @@
 
 from pypy.interpreter.gateway import interp2app, unwrap_spec, WrappedDefault
 from rpython.rtyper.lltypesystem import lltype, rffi
+from rpython.translator import cdir
 from rpython.translator.tool.cbuild import ExternalCompilationInfo
 from pypy.interpreter.error import OperationError, oefmt
 
@@ -11,15 +12,8 @@
 cwd = py.path.local(__file__).dirpath()
 eci = ExternalCompilationInfo(
 includes=[cwd.join('faulthandler.h')],
-include_dirs=[str(cwd)],
-separate_module_files=[cwd.join('faulthandler.c')],
-export_symbols=['pypy_faulthandler_read_null',
-'pypy_faulthandler_sigsegv',
-'pypy_faulthandler_sigfpe',
-'pypy_faulthandler_sigabrt',
-'pypy_faulthandler_sigbus',
-'pypy_faulthandler_sigill',
-])
+include_dirs=[str(cwd), cdir],
+separate_module_files=[cwd.join('faulthandler.c')])
 
 def llexternal(*args, **kwargs):
 kwargs.setdefault('releasegil', False)
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: rearrange a bit to fix compilation

2014-10-25 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3k
Changeset: r74233:8f1cad01a693
Date: 2014-10-25 09:30 -0700
http://bitbucket.org/pypy/pypy/changeset/8f1cad01a693/

Log:rearrange a bit to fix compilation

diff --git a/pypy/module/_codecs/locale.c b/pypy/module/_codecs/locale.c
--- a/pypy/module/_codecs/locale.c
+++ b/pypy/module/_codecs/locale.c
@@ -1,6 +1,7 @@
 /* From CPython 3.2.3's fileutils.c, and _Py_normalize_encoding from
unicodeobject.c
 */
+#include src/precommondefs.h
 /*
 #include Python.h
 */
@@ -225,7 +226,7 @@
 
Conversion errors should never happen, unless there is a bug in the C
library. */
-wchar_t*
+RPY_EXPORTED_FOR_TESTS wchar_t*
 pypy_char2wchar(const char* arg, size_t *size)
 {
 #if 0  defined(__APPLE__)
@@ -367,7 +368,7 @@
 
If error_pos is not NULL: *error_pos is the index of the invalid character
on conversion error, or (size_t)-1 otherwise. */
-char*
+RPY_EXPORTED_FOR_TESTS char*
 pypy_wchar2char(const wchar_t *text, size_t *error_pos)
 {
 #if 0  defined(__APPLE__)
@@ -474,13 +475,13 @@
 #endif   /* __APPLE__ */
 }
 
-void
+RPY_EXPORTED_FOR_TESTS void
 pypy_char2wchar_free(wchar_t *text)
 {
 PyMem_Free(text);
 }
 
-void
+RPY_EXPORTED_FOR_TESTS void
 pypy_wchar2char_free(char *bytes)
 {
 PyMem_Free(bytes);
diff --git a/pypy/module/_codecs/locale.h b/pypy/module/_codecs/locale.h
deleted file mode 100644
--- a/pypy/module/_codecs/locale.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#include stdlib.h
-#include wchar.h
-#include src/precommondefs.h
-
-RPY_EXPORTED_FOR_TESTS wchar_t* pypy_char2wchar(const char* arg, size_t *size);
-RPY_EXPORTED_FOR_TESTS void pypy_char2wchar_free(wchar_t *text);
-RPY_EXPORTED_FOR_TESTS char* pypy_wchar2char(const wchar_t *text, size_t 
*error_pos);
-RPY_EXPORTED_FOR_TESTS void pypy_wchar2char_free(char *bytes);
diff --git a/pypy/module/_codecs/locale.py b/pypy/module/_codecs/locale.py
--- a/pypy/module/_codecs/locale.py
+++ b/pypy/module/_codecs/locale.py
@@ -15,8 +15,7 @@
 
 cwd = py.path.local(__file__).dirpath()
 eci = ExternalCompilationInfo(
-includes=[cwd.join('locale.h')],
-include_dirs=[str(cwd), cdir],
+include_dirs=[cdir],
 separate_module_files=[cwd.join('locale.c')])
 
 def llexternal(*args, **kwargs):
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: kill invalid comment

2014-10-25 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3k
Changeset: r74235:eaad3d70e184
Date: 2014-10-25 09:46 -0700
http://bitbucket.org/pypy/pypy/changeset/eaad3d70e184/

Log:kill invalid comment

diff --git a/pypy/objspace/std/floatobject.py b/pypy/objspace/std/floatobject.py
--- a/pypy/objspace/std/floatobject.py
+++ b/pypy/objspace/std/floatobject.py
@@ -391,8 +391,6 @@
 if space.isinstance_w(w_obj, space.w_int):
 return W_FloatObject(space.float_w(w_obj))
 
-#@staticmethod
-# XXX: unwrap_spec index?
 def descr___round__(self, space, w_ndigits=None):
 return _round_float(space, self, w_ndigits)
 
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: kill this header file

2014-10-25 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: 
Changeset: r74238:673f24170065
Date: 2014-10-25 11:18 -0700
http://bitbucket.org/pypy/pypy/changeset/673f24170065/

Log:kill this header file

diff --git a/pypy/module/operator/tscmp.c b/pypy/module/operator/tscmp.c
--- a/pypy/module/operator/tscmp.c
+++ b/pypy/module/operator/tscmp.c
@@ -1,10 +1,9 @@
 /* Derived from CPython 3.3.5's operator.c::_tscmp
  */
 
-#include src/precommondefs.h
 #include stdlib.h
 #include wchar.h
-#include tscmp.h
+#include src/precommondefs.h
 
 RPY_EXPORTED_FOR_TESTS int
 pypy_tscmp(const char *a, const char *b, long len_a, long len_b)
diff --git a/pypy/module/operator/tscmp.h b/pypy/module/operator/tscmp.h
deleted file mode 100644
--- a/pypy/module/operator/tscmp.h
+++ /dev/null
@@ -1,2 +0,0 @@
-int pypy_tscmp(const char *, const char *, long, long);
-int pypy_tscmp_wide(const wchar_t *, const wchar_t *, long, long);
diff --git a/pypy/module/operator/tscmp.py b/pypy/module/operator/tscmp.py
--- a/pypy/module/operator/tscmp.py
+++ b/pypy/module/operator/tscmp.py
@@ -12,8 +12,7 @@
 
 cwd = py.path.local(__file__).dirpath()
 eci = ExternalCompilationInfo(
-includes=[cwd.join('tscmp.h')],
-include_dirs=[str(cwd), cdir],
+include_dirs=[cdir],
 separate_module_files=[cwd.join('tscmp.c')])
 
 
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: merge default

2014-10-25 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3k
Changeset: r74239:8d5158ea78d5
Date: 2014-10-25 12:31 -0700
http://bitbucket.org/pypy/pypy/changeset/8d5158ea78d5/

Log:merge default

diff --git a/pypy/config/test/test_pypyoption.py 
b/pypy/config/test/test_pypyoption.py
--- a/pypy/config/test/test_pypyoption.py
+++ b/pypy/config/test/test_pypyoption.py
@@ -64,7 +64,7 @@
 def check_file_exists(fn):
 assert configdocdir.join(fn).check()
 
-from pypy.doc.config.confrest import all_optiondescrs
+from pypy.doc.config.generate import all_optiondescrs
 configdocdir = thisdir.dirpath().dirpath().join(doc, config)
 for descr in all_optiondescrs:
 prefix = descr._name
diff --git a/pypy/doc/build.rst b/pypy/doc/build.rst
--- a/pypy/doc/build.rst
+++ b/pypy/doc/build.rst
@@ -119,6 +119,9 @@
 
 pypy rpython/bin/rpython --opt=2 pypy/goal/targetpypystandalone.py
 
+(You can use ``python`` instead of ``pypy`` here, which will take longer
+but works too.)
+
 If everything works correctly this will create an executable ``pypy-c`` in the
 current directory. The executable behaves mostly like a normal Python
 interpreter (see :doc:`cpython_differences`).
diff --git a/pypy/module/bz2/test/support.py b/pypy/module/bz2/test/support.py
--- a/pypy/module/bz2/test/support.py
+++ b/pypy/module/bz2/test/support.py
@@ -3,6 +3,11 @@
 from rpython.rtyper.lltypesystem import ll2ctypes
 import gc
 tries = 20
+# remove the GC strings from ll2ctypes
+for key, value in ll2ctypes.ALLOCATED.items():
+if value._TYPE._gckind == 'gc':
+del ll2ctypes.ALLOCATED[key]
+#
 while tries and ll2ctypes.ALLOCATED:
 gc.collect() # to make sure we disallocate buffers
 tries -= 1
diff --git a/pypy/module/operator/tscmp.c b/pypy/module/operator/tscmp.c
--- a/pypy/module/operator/tscmp.c
+++ b/pypy/module/operator/tscmp.c
@@ -1,9 +1,9 @@
 /* Derived from CPython 3.3.5's operator.c::_tscmp
  */
 
+#include stdlib.h
+#include wchar.h
 #include src/precommondefs.h
-#include stdlib.h
-#include tscmp.h
 
 RPY_EXPORTED_FOR_TESTS int
 pypy_tscmp(const char *a, const char *b, long len_a, long len_b)
diff --git a/pypy/module/operator/tscmp.h b/pypy/module/operator/tscmp.h
deleted file mode 100644
--- a/pypy/module/operator/tscmp.h
+++ /dev/null
@@ -1,1 +0,0 @@
-int pypy_tscmp(const char *, const char *, long, long);
diff --git a/pypy/module/operator/tscmp.py b/pypy/module/operator/tscmp.py
--- a/pypy/module/operator/tscmp.py
+++ b/pypy/module/operator/tscmp.py
@@ -13,8 +13,7 @@
 
 cwd = py.path.local(__file__).dirpath()
 eci = ExternalCompilationInfo(
-includes=[cwd.join('tscmp.h')],
-include_dirs=[str(cwd), cdir],
+include_dirs=[cdir],
 separate_module_files=[cwd.join('tscmp.c')])
 
 
diff --git a/pypy/module/pypyjit/test/test_jit_hook.py 
b/pypy/module/pypyjit/test/test_jit_hook.py
--- a/pypy/module/pypyjit/test/test_jit_hook.py
+++ b/pypy/module/pypyjit/test/test_jit_hook.py
@@ -11,7 +11,7 @@
 from rpython.rtyper.lltypesystem import lltype, llmemory
 from rpython.rtyper.rclass import OBJECT
 from pypy.module.pypyjit.interp_jit import pypyjitdriver
-from pypy.module.pypyjit.policy import pypy_hooks
+from pypy.module.pypyjit.hooks import pypy_hooks
 from rpython.jit.tool.oparser import parse
 from rpython.jit.metainterp.typesystem import llhelper
 from rpython.rlib.jit import JitDebugInfo, AsmInfo, Counters
diff --git a/pypy/module/test_lib_pypy/ctypes_tests/_ctypes_test.c 
b/pypy/module/test_lib_pypy/ctypes_tests/_ctypes_test.c
--- a/pypy/module/test_lib_pypy/ctypes_tests/_ctypes_test.c
+++ b/pypy/module/test_lib_pypy/ctypes_tests/_ctypes_test.c
@@ -1,13 +1,11 @@
+#include src/precommondefs.h
+
 #if defined(_MSC_VER) || defined(__CYGWIN__)
 #include windows.h
 #define MS_WIN32
 #endif
 
-#if defined(MS_WIN32)
-#define EXPORT(x) __declspec(dllexport) x
-#else
-#define EXPORT(x) x
-#endif
+#define EXPORT(x)  RPY_EXPORTED x
 
 #include stdlib.h
 #include math.h
diff --git a/pypy/module/test_lib_pypy/ctypes_tests/conftest.py 
b/pypy/module/test_lib_pypy/ctypes_tests/conftest.py
--- a/pypy/module/test_lib_pypy/ctypes_tests/conftest.py
+++ b/pypy/module/test_lib_pypy/ctypes_tests/conftest.py
@@ -8,6 +8,7 @@
 def compile_so_file():
 from rpython.translator.platform import platform
 from rpython.translator.tool.cbuild import ExternalCompilationInfo
+from rpython.translator import cdir
 udir = pytest.ensuretemp('_ctypes_test')
 cfile = py.path.local(__file__).dirpath().join(_ctypes_test.c)
 
@@ -15,7 +16,8 @@
 libraries = ['oleaut32']
 else:
 libraries = []
-eci = ExternalCompilationInfo(libraries=libraries)
+eci = ExternalCompilationInfo(libraries=libraries,
+  include_dirs=[cdir])
 
 return platform.compile([cfile], eci, str(udir.join('_ctypes_test')),
 standalone=False)
diff --git 

[pypy-commit] pypy py3k: merge upstream

2014-10-24 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3k
Changeset: r74152:a87e6542c186
Date: 2014-10-24 00:29 -0700
http://bitbucket.org/pypy/pypy/changeset/a87e6542c186/

Log:merge upstream

diff --git a/pypy/module/posix/interp_nt.py b/pypy/module/posix/interp_nt.py
--- a/pypy/module/posix/interp_nt.py
+++ b/pypy/module/posix/interp_nt.py
@@ -21,6 +21,9 @@
 
 eci = ExternalCompilationInfo(
 includes=['windows.h'],
+post_include_bits=[
+DWORD 
+pypy_GetFinalPathNameByHandle(FARPROC, HANDLE, LPTSTR, DWORD, 
DWORD);],
 separate_module_sources=[separate_module_source],
 export_symbols=['pypy_GetFinalPathNameByHandle']
 )
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: reapply py3k changes

2014-10-24 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3k
Changeset: r74148:638bb3d67bdd
Date: 2014-10-23 22:34 -0700
http://bitbucket.org/pypy/pypy/changeset/638bb3d67bdd/

Log:reapply py3k changes

diff --git a/pypy/objspace/std/complexobject.py 
b/pypy/objspace/std/complexobject.py
--- a/pypy/objspace/std/complexobject.py
+++ b/pypy/objspace/std/complexobject.py
@@ -141,26 +141,15 @@
 return (w_complex.realval, w_complex.imagval)
 #
 # test for a '__complex__' method, and call it if found.
-# special case old-style instances, like CPython does.
 w_z = None
-if space.is_oldstyle_instance(w_complex):
-try:
-w_method = space.getattr(w_complex, space.wrap('__complex__'))
-except OperationError, e:
-if not e.match(space, space.w_AttributeError):
-raise
-else:
-w_z = space.call_function(w_method)
-else:
-w_method = space.lookup(w_complex, '__complex__')
-if w_method is not None:
-w_z = space.get_and_call_function(w_method, w_complex)
+w_method = space.lookup(w_complex, '__complex__')
+if w_method is not None:
+w_z = space.get_and_call_function(w_method, w_complex)
 #
 if w_z is not None:
 # __complex__() must return a complex or (float,int,long) object
 # (XXX should not use isinstance here)
 if not strict_typing and (space.isinstance_w(w_z, space.w_int) or
-  space.isinstance_w(w_z, space.w_long) or
   space.isinstance_w(w_z, space.w_float)):
 return (space.float_w(w_z), 0.0)
 elif isinstance(w_z, W_ComplexObject):
@@ -274,9 +263,8 @@
 if isinstance(w_obj, W_ComplexObject):
 return w_obj
 if space.isinstance_w(w_obj, space.w_int):
-return W_ComplexObject(float(space.int_w(w_obj)), 0.0)
-if space.isinstance_w(w_obj, space.w_long):
-return W_ComplexObject(space.float_w(w_obj), 0.0)
+w_float = space.float_w(w_obj, allow_conversion=False)
+return W_ComplexObject(w_float, 0.0)
 if space.isinstance_w(w_obj, space.w_float):
 return W_ComplexObject(space.float_w(w_obj), 0.0)
 
@@ -292,14 +280,14 @@
 and space.is_w(space.type(w_real), space.w_complex)):
 return w_real
 
-if space.isinstance_w(w_real, space.w_str) or \
-space.isinstance_w(w_real, space.w_unicode):
+if space.isinstance_w(w_real, space.w_unicode):
 # a string argument
 if not noarg2:
 raise oefmt(space.w_TypeError, complex() can't take second
 arg if first is a string)
+unistr = unicode_to_decimal_w(space, w_real)
 try:
-realstr, imagstr = _split_complex(space.str_w(w_real))
+realstr, imagstr = _split_complex(unistr)
 except ValueError:
 raise oefmt(space.w_ValueError,
 complex() arg is a malformed string)
@@ -360,19 +348,11 @@
 combined = intmask(hashreal + HASH_IMAG * hashimg)
 return space.newint(-2 if combined == -1 else combined)
 
-
-def descr_coerce(self, space, w_other):
-w_other = self._to_complex(space, w_other)
-if w_other is None:
-return space.w_NotImplemented
-return space.newtuple([self, w_other])
-
-
 def descr_format(self, space, w_format_spec):
 return newformat.run_formatter(space, w_format_spec, format_complex,
self)
 
-def descr_nonzero(self, space):
+def descr_bool(self, space):
 return space.newbool((self.realval != 0.0) or (self.imagval != 0.0))
 
 def descr_float(self, space):
@@ -396,7 +376,6 @@
 return space.newbool((self.realval == w_other.realval) and
  (self.imagval == w_other.imagval))
 if (space.isinstance_w(w_other, space.w_int) or
-space.isinstance_w(w_other, space.w_long) or
 space.isinstance_w(w_other, space.w_float)):
 if self.imagval:
 return space.w_False
@@ -407,8 +386,7 @@
 if isinstance(w_other, W_ComplexObject):
 return space.newbool((self.realval != w_other.realval) or
  (self.imagval != w_other.imagval))
-if (space.isinstance_w(w_other, space.w_int) or
-space.isinstance_w(w_other, space.w_long)):
+if (space.isinstance_w(w_other, space.w_int)):
 if self.imagval:
 return space.w_True
 return space.ne(space.newfloat(self.realval), w_other)
@@ -478,66 +456,6 @@
 except ZeroDivisionError, e:
 raise OperationError(space.w_ZeroDivisionError, space.wrap(str(e)))
 
-
-def descr_floordiv(self, space, w_rhs):
-  

[pypy-commit] pypy py3k: merge default

2014-10-24 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3k
Changeset: r74145:ba8251a5c237
Date: 2014-10-23 16:26 -0700
http://bitbucket.org/pypy/pypy/changeset/ba8251a5c237/

Log:merge default

diff too long, truncating to 2000 out of 5202 lines

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
@@ -22,3 +22,6 @@
 
 .. branch: ClassRepr
 Refactor ClassRepr and make normalizecalls independent of the rtyper.
+
+.. branch: remove-remaining-smm
+Remove all remaining multimethods.
diff --git a/pypy/goal/targetpypystandalone.py 
b/pypy/goal/targetpypystandalone.py
--- a/pypy/goal/targetpypystandalone.py
+++ b/pypy/goal/targetpypystandalone.py
@@ -310,7 +310,8 @@
 return self.get_entry_point(config)
 
 def jitpolicy(self, driver):
-from pypy.module.pypyjit.policy import PyPyJitPolicy, pypy_hooks
+from pypy.module.pypyjit.policy import PyPyJitPolicy
+from pypy.module.pypyjit.hooks import pypy_hooks
 return PyPyJitPolicy(pypy_hooks)
 
 def get_entry_point(self, config):
diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py
--- a/pypy/interpreter/baseobjspace.py
+++ b/pypy/interpreter/baseobjspace.py
@@ -1899,5 +1899,4 @@
 'newdict',
 'newslice',
 'call_args',
-'marshal_w',
 ]
diff --git a/pypy/interpreter/gateway.py b/pypy/interpreter/gateway.py
--- a/pypy/interpreter/gateway.py
+++ b/pypy/interpreter/gateway.py
@@ -644,6 +644,17 @@
 elif unwrap_spec == [ObjSpace, W_Root, Arguments]:
 self.__class__ = BuiltinCodePassThroughArguments1
 self.func__args__ = func
+elif unwrap_spec == [self_type, ObjSpace, Arguments]:
+self.__class__ = BuiltinCodePassThroughArguments1
+miniglobals = {'func': func, 'self_type': self_type}
+d = {}
+source = if 1:
+def _call(space, w_obj, args):
+self = space.descr_self_interp_w(self_type, w_obj)
+return func(self, space, args)
+\n
+exec compile2(source) in miniglobals, d
+self.func__args__ = d['_call']
 else:
 self.__class__ = globals()['BuiltinCode%d' % arity]
 setattr(self, 'fastfunc_%d' % arity, fastfunc)
diff --git a/pypy/interpreter/test/test_gateway.py 
b/pypy/interpreter/test/test_gateway.py
--- a/pypy/interpreter/test/test_gateway.py
+++ b/pypy/interpreter/test/test_gateway.py
@@ -906,11 +906,33 @@
 assert len(called) == 1
 assert isinstance(called[0], argument.Arguments)
 
+def test_pass_trough_arguments_method(self):
+space = self.space
+
+called = []
+
+class W_Something(W_Root):
+def f(self, space, __args__):
+called.append(__args__)
+a_w, _ = __args__.unpack()
+return space.newtuple([space.wrap('f')]+a_w)
+
+w_f = space.wrap(gateway.interp2app_temp(W_Something.f))
+
+w_self = space.wrap(W_Something())
+args = argument.Arguments(space, [space.wrap(7)])
+
+w_res = space.call_obj_args(w_f, w_self, args)
+assert space.is_true(space.eq(w_res, space.wrap(('f', 7
+
+# white-box check for opt
+assert called[0] is args
+
 
 class AppTestKeywordsToBuiltinSanity(object):
 def test_type(self):
 class X(object):
-def __init__(self, **kw):
+def __init__(myself, **kw):
 pass
 clash = type.__call__.__code__.co_varnames[0]
 
@@ -926,7 +948,6 @@
 X(**{clash: 33})
 object.__new__(X, **{clash: 33})
 
-
 def test_dict_new(self):
 clash = dict.__new__.__code__.co_varnames[0]
 
diff --git a/pypy/module/marshal/interp_marshal.py 
b/pypy/module/marshal/interp_marshal.py
--- a/pypy/module/marshal/interp_marshal.py
+++ b/pypy/module/marshal/interp_marshal.py
@@ -2,6 +2,7 @@
 from pypy.interpreter.gateway import WrappedDefault, unwrap_spec
 from rpython.rlib.rarithmetic import intmask
 from rpython.rlib import rstackovf
+from pypy.objspace.std.marshal_impl import get_unmarshallers
 
 
 Py_MARSHAL_VERSION = 2
@@ -139,6 +140,26 @@
 raise OperationError(space.w_ValueError, space.wrap(msg))
 
 class Marshaller(_Base):
+
+atomic types including typecode:
+
+atom(tc)puts single typecode
+atom_int(tc, int)   puts code and int
+atom_int64(tc, int64)   puts code and int64
+atom_str(tc, str)   puts code, len and string
+atom_strlist(tc, strlist)   puts code, len and list of strings
+
+building blocks for compound types:
+
+start(typecode) sets the type character
+put(s)  puts a string with fixed length
+put_short(int)  puts 

[pypy-commit] pypy py3k: fix

2014-10-24 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3k
Changeset: r74146:7b463df83cc8
Date: 2014-10-23 17:01 -0700
http://bitbucket.org/pypy/pypy/changeset/7b463df83cc8/

Log:fix

diff --git a/pypy/module/marshal/interp_marshal.py 
b/pypy/module/marshal/interp_marshal.py
--- a/pypy/module/marshal/interp_marshal.py
+++ b/pypy/module/marshal/interp_marshal.py
@@ -2,7 +2,7 @@
 from pypy.interpreter.gateway import WrappedDefault, unwrap_spec
 from rpython.rlib.rarithmetic import intmask
 from rpython.rlib import rstackovf
-from pypy.objspace.std.marshal_impl import get_unmarshallers
+from pypy.objspace.std.marshal_impl import marshal, get_unmarshallers
 
 
 Py_MARSHAL_VERSION = 2
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: kill

2014-10-24 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3k
Changeset: r74149:f779ab150be3
Date: 2014-10-24 00:28 -0700
http://bitbucket.org/pypy/pypy/changeset/f779ab150be3/

Log:kill

diff --git a/pypy/objspace/std/marshal_impl.py 
b/pypy/objspace/std/marshal_impl.py
--- a/pypy/objspace/std/marshal_impl.py
+++ b/pypy/objspace/std/marshal_impl.py
@@ -245,9 +245,6 @@
 
 @marshaller(W_BytesObject)
 def marshal_bytes(space, w_str, m):
-if not isinstance(w_str, W_BytesObject):
-raise_exception(space, unmarshallable object)
-
 s = w_str.unwrap(space)
 m.atom_str(TYPE_STRING, s)
 
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: kill __div__

2014-10-24 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3k
Changeset: r74150:ffeda9a7688e
Date: 2014-10-24 00:28 -0700
http://bitbucket.org/pypy/pypy/changeset/ffeda9a7688e/

Log:kill __div__

diff --git a/pypy/objspace/std/complexobject.py 
b/pypy/objspace/std/complexobject.py
--- a/pypy/objspace/std/complexobject.py
+++ b/pypy/objspace/std/complexobject.py
@@ -532,8 +532,6 @@
 __rsub__ = interp2app(W_ComplexObject.descr_rsub),
 __mul__ = interp2app(W_ComplexObject.descr_mul),
 __rmul__ = interp2app(W_ComplexObject.descr_rmul),
-__div__ = interp2app(W_ComplexObject.descr_truediv),
-__rdiv__ = interp2app(W_ComplexObject.descr_rtruediv),
 __truediv__ = interp2app(W_ComplexObject.descr_truediv),
 __rtruediv__ = interp2app(W_ComplexObject.descr_rtruediv),
 __pow__ = interp2app(W_ComplexObject.descr_pow),
diff --git a/pypy/objspace/std/floatobject.py b/pypy/objspace/std/floatobject.py
--- a/pypy/objspace/std/floatobject.py
+++ b/pypy/objspace/std/floatobject.py
@@ -676,8 +676,6 @@
 __rsub__ = interp2app(W_FloatObject.descr_rsub),
 __mul__ = interp2app(W_FloatObject.descr_mul),
 __rmul__ = interp2app(W_FloatObject.descr_rmul),
-__div__ = interp2app(W_FloatObject.descr_div),
-__rdiv__ = interp2app(W_FloatObject.descr_rdiv),
 __truediv__ = interp2app(W_FloatObject.descr_div),
 __rtruediv__ = interp2app(W_FloatObject.descr_rdiv),
 __floordiv__ = interp2app(W_FloatObject.descr_floordiv),
diff --git a/pypy/objspace/std/test/test_complexobject.py 
b/pypy/objspace/std/test/test_complexobject.py
--- a/pypy/objspace/std/test/test_complexobject.py
+++ b/pypy/objspace/std/test/test_complexobject.py
@@ -92,15 +92,11 @@
 if x != 0:
 q = z / x
 assert self.close(q, y)
-q = z.__div__(x)
-assert self.close(q, y)
 q = z.__truediv__(x)
 assert self.close(q, y)
 if y != 0:
 q = z / y
 assert self.close(q, x)
-q = z.__div__(y)
-assert self.close(q, x)
 q = z.__truediv__(y)
 assert self.close(q, x)
 
@@ -170,7 +166,7 @@
 self.check_div(complex(random(), random()),
complex(random(), random()))
 
-raises(ZeroDivisionError, complex.__div__, 1+1j, 0+0j)
+raises(ZeroDivisionError, complex.__truediv__, 1+1j, 0+0j)
 # FIXME: The following currently crashes on Alpha
 raises(OverflowError, pow, 1e200+1j, 1e200+1j)
 
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: fix

2014-10-24 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3k
Changeset: r74147:e94bbc8ce02b
Date: 2014-10-23 17:13 -0700
http://bitbucket.org/pypy/pypy/changeset/e94bbc8ce02b/

Log:fix

diff --git a/pypy/objspace/std/complexobject.py 
b/pypy/objspace/std/complexobject.py
--- a/pypy/objspace/std/complexobject.py
+++ b/pypy/objspace/std/complexobject.py
@@ -6,6 +6,7 @@
 from pypy.objspace.std import newformat
 from pypy.objspace.std.floatobject import _hash_float
 from pypy.objspace.std.stdtypedef import GetSetProperty, StdTypeDef
+from pypy.objspace.std.unicodeobject import unicode_to_decimal_w
 from rpython.rlib import jit, rcomplex
 from rpython.rlib.rarithmetic import intmask, r_ulonglong
 from rpython.rlib.rbigint import rbigint
diff --git a/pypy/objspace/std/typeobject.py b/pypy/objspace/std/typeobject.py
--- a/pypy/objspace/std/typeobject.py
+++ b/pypy/objspace/std/typeobject.py
@@ -583,9 +583,9 @@
 else:
 mod = space.unicode_w(w_mod)
 if mod is not None and mod != u'builtins':
-return space.wrap(uclass '%s.%s' % (mod, w_obj.getname(space)))
+return space.wrap(uclass '%s.%s' % (mod, self.getname(space)))
 else:
-return space.wrap(uclass '%s' % (w_obj.name.decode('utf-8')))
+return space.wrap(uclass '%s' % (self.name.decode('utf-8')))
 
 def descr_getattribute(self, space, w_name):
 name = space.str_w(w_name)
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: readd these, matching cpython 3.2

2014-10-24 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3k
Changeset: r74151:15f9e7ef79ce
Date: 2014-10-24 00:28 -0700
http://bitbucket.org/pypy/pypy/changeset/15f9e7ef79ce/

Log:readd these, matching cpython 3.2

diff --git a/pypy/objspace/std/complexobject.py 
b/pypy/objspace/std/complexobject.py
--- a/pypy/objspace/std/complexobject.py
+++ b/pypy/objspace/std/complexobject.py
@@ -13,6 +13,7 @@
 from rpython.rlib.rfloat import (
 formatd, DTSF_STR_PRECISION, isinf, isnan, copysign, string_to_float)
 from rpython.rlib.rstring import ParseStringError
+from rpython.tool.sourcetools import func_with_new_name
 
 HASH_IMAG = 103
 
@@ -393,9 +394,6 @@
 return space.w_NotImplemented
 
 def _fail_cmp(self, space, w_other):
-if isinstance(w_other, W_ComplexObject):
-raise oefmt(space.w_TypeError,
-cannot compare complex numbers using , =, , =)
 return space.w_NotImplemented
 
 def descr_add(self, space, w_rhs):
@@ -456,6 +454,19 @@
 except ZeroDivisionError, e:
 raise OperationError(space.w_ZeroDivisionError, space.wrap(str(e)))
 
+def descr_floordiv(self, space, w_rhs):
+raise oefmt(space.w_TypeError, can't take floor of complex number.)
+descr_rfloordiv = func_with_new_name(descr_floordiv, 'descr_rfloordiv')
+
+def descr_mod(self, space, w_rhs):
+raise oefmt(space.w_TypeError, can't mod complex numbers.)
+descr_rmod = func_with_new_name(descr_mod, 'descr_rmod')
+
+def descr_divmod(self, space, w_rhs):
+raise oefmt(space.w_TypeError,
+can't take floor or mod of complex number.)
+descr_rdivmod = func_with_new_name(descr_divmod, 'descr_rdivmod')
+
 @unwrap_spec(w_third_arg=WrappedDefault(None))
 def descr_pow(self, space, w_exponent, w_third_arg):
 w_exponent = self._to_complex(space, w_exponent)
@@ -534,6 +545,12 @@
 __rmul__ = interp2app(W_ComplexObject.descr_rmul),
 __truediv__ = interp2app(W_ComplexObject.descr_truediv),
 __rtruediv__ = interp2app(W_ComplexObject.descr_rtruediv),
+__floordiv__ = interp2app(W_ComplexObject.descr_floordiv),
+__rfloordiv__ = interp2app(W_ComplexObject.descr_rfloordiv),
+__mod__ = interp2app(W_ComplexObject.descr_mod),
+__rmod__ = interp2app(W_ComplexObject.descr_rmod),
+__divmod__ = interp2app(W_ComplexObject.descr_divmod),
+__rdivmod__ = interp2app(W_ComplexObject.descr_rdivmod),
 __pow__ = interp2app(W_ComplexObject.descr_pow),
 __rpow__ = interp2app(W_ComplexObject.descr_rpow),
 
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: issue1899: fix broken bytes usage from default

2014-10-24 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3k
Changeset: r74153:8c340acffe27
Date: 2014-10-24 00:44 -0700
http://bitbucket.org/pypy/pypy/changeset/8c340acffe27/

Log:issue1899: fix broken bytes usage from default

diff --git a/lib_pypy/_tkinter/app.py b/lib_pypy/_tkinter/app.py
--- a/lib_pypy/_tkinter/app.py
+++ b/lib_pypy/_tkinter/app.py
@@ -439,7 +439,7 @@
 if isinstance(s, int):
 return s
 s = s.encode('utf-8')
-if '\x00' in s:
+if b'\x00' in s:
 raise TypeError
 v = tkffi.new(int*)
 res = tklib.Tcl_GetBoolean(self.interp, s, v)
@@ -451,7 +451,7 @@
 if isinstance(s, int):
 return s
 s = s.encode('utf-8')
-if '\x00' in s:
+if b'\x00' in s:
 raise TypeError
 v = tkffi.new(int*)
 res = tklib.Tcl_GetInt(self.interp, s, v)
@@ -463,7 +463,7 @@
 if isinstance(s, float):
 return s
 s = s.encode('utf-8')
-if '\x00' in s:
+if b'\x00' in s:
 raise TypeError
 v = tkffi.new(double*)
 res = tklib.Tcl_GetDouble(self.interp, s, v)
@@ -472,7 +472,7 @@
 return v[0]
 
 def exprboolean(self, s):
-if '\x00' in s:
+if b'\x00' in s:
 raise TypeError
 v = tkffi.new(int*)
 res = tklib.Tcl_ExprBoolean(self.interp, s, v)
@@ -481,7 +481,7 @@
 return v[0]
 
 def exprlong(self, s):
-if '\x00' in s:
+if b'\x00' in s:
 raise TypeError
 v = tkffi.new(long*)
 res = tklib.Tcl_ExprLong(self.interp, s, v)
@@ -490,7 +490,7 @@
 return v[0]
 
 def exprdouble(self, s):
-if '\x00' in s:
+if b'\x00' in s:
 raise TypeError
 v = tkffi.new(double*)
 res = tklib.Tcl_ExprDouble(self.interp, s, v)
@@ -499,7 +499,7 @@
 return v[0]
 
 def exprstring(self, s):
-if '\x00' in s:
+if b'\x00' in s:
 raise TypeError
 res = tklib.Tcl_ExprString(self.interp, s)
 if res == tklib.TCL_ERROR:
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: allow_conversion isn't necessary on base number types

2014-10-24 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3k
Changeset: r74190:1fa509538f86
Date: 2014-10-24 13:40 -0700
http://bitbucket.org/pypy/pypy/changeset/1fa509538f86/

Log:allow_conversion isn't necessary on base number types

diff --git a/pypy/objspace/std/complexobject.py 
b/pypy/objspace/std/complexobject.py
--- a/pypy/objspace/std/complexobject.py
+++ b/pypy/objspace/std/complexobject.py
@@ -264,7 +264,7 @@
 if isinstance(w_obj, W_ComplexObject):
 return w_obj
 if space.isinstance_w(w_obj, space.w_int):
-w_float = space.float_w(w_obj, allow_conversion=False)
+w_float = space.float_w(w_obj)
 return W_ComplexObject(w_float, 0.0)
 if space.isinstance_w(w_obj, space.w_float):
 return W_ComplexObject(space.float_w(w_obj), 0.0)
diff --git a/pypy/objspace/std/floatobject.py b/pypy/objspace/std/floatobject.py
--- a/pypy/objspace/std/floatobject.py
+++ b/pypy/objspace/std/floatobject.py
@@ -389,7 +389,7 @@
 if isinstance(w_obj, W_FloatObject):
 return w_obj
 if space.isinstance_w(w_obj, space.w_int):
-return W_FloatObject(space.float_w(w_obj, allow_conversion=False))
+return W_FloatObject(space.float_w(w_obj))
 
 #@staticmethod
 # XXX: unwrap_spec index?
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: fix

2014-10-24 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3k
Changeset: r74189:8b7059138b7b
Date: 2014-10-24 11:15 -0700
http://bitbucket.org/pypy/pypy/changeset/8b7059138b7b/

Log:fix

diff --git a/pypy/objspace/std/test/test_complexobject.py 
b/pypy/objspace/std/test/test_complexobject.py
--- a/pypy/objspace/std/test/test_complexobject.py
+++ b/pypy/objspace/std/test/test_complexobject.py
@@ -3,7 +3,6 @@
 
 import py
 
-from pypy.objspace.std import complextype as cobjtype, StdObjSpace
 from pypy.objspace.std.complexobject import W_ComplexObject, _split_complex
 from pypy.objspace.std.multimethod import FailedToImplement
 
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: o fix __ne__ not handling floats like __eq__

2014-10-24 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: 
Changeset: r74188:5ecbc7d29c83
Date: 2014-10-24 12:41 -0700
http://bitbucket.org/pypy/pypy/changeset/5ecbc7d29c83/

Log:o fix __ne__ not handling floats like __eq__ o match CPython's
TypeError behavior w/ rich comparisons  number types

diff --git a/pypy/objspace/std/complexobject.py 
b/pypy/objspace/std/complexobject.py
--- a/pypy/objspace/std/complexobject.py
+++ b/pypy/objspace/std/complexobject.py
@@ -412,16 +412,20 @@
 return space.newbool((self.realval != w_other.realval) or
  (self.imagval != w_other.imagval))
 if (space.isinstance_w(w_other, space.w_int) or
-space.isinstance_w(w_other, space.w_long)):
+space.isinstance_w(w_other, space.w_long) or
+space.isinstance_w(w_other, space.w_float)):
 if self.imagval:
 return space.w_True
 return space.ne(space.newfloat(self.realval), w_other)
 return space.w_NotImplemented
 
 def _fail_cmp(self, space, w_other):
-if isinstance(w_other, W_ComplexObject):
+if (isinstance(w_other, W_ComplexObject) or
+space.isinstance_w(w_other, space.w_int) or
+space.isinstance_w(w_other, space.w_long) or
+space.isinstance_w(w_other, space.w_float)):
 raise oefmt(space.w_TypeError,
-cannot compare complex numbers using , =, , =)
+no ordering relation is defined for complex numbers)
 return space.w_NotImplemented
 
 def descr_add(self, space, w_rhs):
diff --git a/pypy/objspace/std/test/test_complexobject.py 
b/pypy/objspace/std/test/test_complexobject.py
--- a/pypy/objspace/std/test/test_complexobject.py
+++ b/pypy/objspace/std/test/test_complexobject.py
@@ -180,6 +180,14 @@
 assert (5+0j) != large
 assert large != (5+0j)
 
+def test_richcompare_numbers(self):
+for n in 8, 8L, 0.01:
+assert complex.__eq__(n+0j, n)
+assert not complex.__ne__(n+0j, n)
+assert not complex.__eq__(complex(n, n), n)
+assert complex.__ne__(complex(n, n), n)
+raises(TypeError, complex.__lt__, n+0j, n)
+
 def test_richcompare_boundaries(self):
 z = 9007199254740992+0j
 i = 9007199254740993
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3.3: readapt 032296946827

2014-10-24 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3.3
Changeset: r74192:5c26d14cf18c
Date: 2014-10-24 13:51 -0700
http://bitbucket.org/pypy/pypy/changeset/5c26d14cf18c/

Log:readapt 032296946827

diff --git a/pypy/objspace/std/noneobject.py b/pypy/objspace/std/noneobject.py
--- a/pypy/objspace/std/noneobject.py
+++ b/pypy/objspace/std/noneobject.py
@@ -7,6 +7,11 @@
 def unwrap(w_self, space):
 return None
 
+@staticmethod
+def descr_new(space, w_type):
+T.__new__(S, ...) - a new object with type S, a subtype of T
+return space.w_None
+
 def descr_bool(self, space):
 return space.w_False
 
@@ -17,6 +22,7 @@
 W_NoneObject.w_None = W_NoneObject()
 
 W_NoneObject.typedef = StdTypeDef(NoneType,
+__new__ = interp2app(W_NoneObject.descr_new),
 __bool__ = interp2app(W_NoneObject.descr_bool),
 __repr__ = interp2app(W_NoneObject.descr_repr),
 )
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3.3: merge py3k

2014-10-24 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3.3
Changeset: r74191:3820173e81e3
Date: 2014-10-24 13:48 -0700
http://bitbucket.org/pypy/pypy/changeset/3820173e81e3/

Log:merge py3k

diff too long, truncating to 2000 out of 5270 lines

diff --git a/lib_pypy/_tkinter/app.py b/lib_pypy/_tkinter/app.py
--- a/lib_pypy/_tkinter/app.py
+++ b/lib_pypy/_tkinter/app.py
@@ -439,7 +439,7 @@
 if isinstance(s, int):
 return s
 s = s.encode('utf-8')
-if '\x00' in s:
+if b'\x00' in s:
 raise TypeError
 v = tkffi.new(int*)
 res = tklib.Tcl_GetBoolean(self.interp, s, v)
@@ -451,7 +451,7 @@
 if isinstance(s, int):
 return s
 s = s.encode('utf-8')
-if '\x00' in s:
+if b'\x00' in s:
 raise TypeError
 v = tkffi.new(int*)
 res = tklib.Tcl_GetInt(self.interp, s, v)
@@ -463,7 +463,7 @@
 if isinstance(s, float):
 return s
 s = s.encode('utf-8')
-if '\x00' in s:
+if b'\x00' in s:
 raise TypeError
 v = tkffi.new(double*)
 res = tklib.Tcl_GetDouble(self.interp, s, v)
@@ -472,7 +472,7 @@
 return v[0]
 
 def exprboolean(self, s):
-if '\x00' in s:
+if b'\x00' in s:
 raise TypeError
 v = tkffi.new(int*)
 res = tklib.Tcl_ExprBoolean(self.interp, s, v)
@@ -481,7 +481,7 @@
 return v[0]
 
 def exprlong(self, s):
-if '\x00' in s:
+if b'\x00' in s:
 raise TypeError
 v = tkffi.new(long*)
 res = tklib.Tcl_ExprLong(self.interp, s, v)
@@ -490,7 +490,7 @@
 return v[0]
 
 def exprdouble(self, s):
-if '\x00' in s:
+if b'\x00' in s:
 raise TypeError
 v = tkffi.new(double*)
 res = tklib.Tcl_ExprDouble(self.interp, s, v)
@@ -499,7 +499,7 @@
 return v[0]
 
 def exprstring(self, s):
-if '\x00' in s:
+if b'\x00' in s:
 raise TypeError
 res = tklib.Tcl_ExprString(self.interp, s)
 if res == tklib.TCL_ERROR:
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
@@ -22,3 +22,6 @@
 
 .. branch: ClassRepr
 Refactor ClassRepr and make normalizecalls independent of the rtyper.
+
+.. branch: remove-remaining-smm
+Remove all remaining multimethods.
diff --git a/pypy/goal/targetpypystandalone.py 
b/pypy/goal/targetpypystandalone.py
--- a/pypy/goal/targetpypystandalone.py
+++ b/pypy/goal/targetpypystandalone.py
@@ -310,7 +310,8 @@
 return self.get_entry_point(config)
 
 def jitpolicy(self, driver):
-from pypy.module.pypyjit.policy import PyPyJitPolicy, pypy_hooks
+from pypy.module.pypyjit.policy import PyPyJitPolicy
+from pypy.module.pypyjit.hooks import pypy_hooks
 return PyPyJitPolicy(pypy_hooks)
 
 def get_entry_point(self, config):
diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py
--- a/pypy/interpreter/baseobjspace.py
+++ b/pypy/interpreter/baseobjspace.py
@@ -1902,5 +1902,4 @@
 'newdict',
 'newslice',
 'call_args',
-'marshal_w',
 ]
diff --git a/pypy/interpreter/gateway.py b/pypy/interpreter/gateway.py
--- a/pypy/interpreter/gateway.py
+++ b/pypy/interpreter/gateway.py
@@ -644,6 +644,17 @@
 elif unwrap_spec == [ObjSpace, W_Root, Arguments]:
 self.__class__ = BuiltinCodePassThroughArguments1
 self.func__args__ = func
+elif unwrap_spec == [self_type, ObjSpace, Arguments]:
+self.__class__ = BuiltinCodePassThroughArguments1
+miniglobals = {'func': func, 'self_type': self_type}
+d = {}
+source = if 1:
+def _call(space, w_obj, args):
+self = space.descr_self_interp_w(self_type, w_obj)
+return func(self, space, args)
+\n
+exec compile2(source) in miniglobals, d
+self.func__args__ = d['_call']
 else:
 self.__class__ = globals()['BuiltinCode%d' % arity]
 setattr(self, 'fastfunc_%d' % arity, fastfunc)
diff --git a/pypy/interpreter/test/test_gateway.py 
b/pypy/interpreter/test/test_gateway.py
--- a/pypy/interpreter/test/test_gateway.py
+++ b/pypy/interpreter/test/test_gateway.py
@@ -906,11 +906,33 @@
 assert len(called) == 1
 assert isinstance(called[0], argument.Arguments)
 
+def test_pass_trough_arguments_method(self):
+space = self.space
+
+called = []
+
+class W_Something(W_Root):
+def f(self, space, __args__):
+called.append(__args__)
+a_w, _ = __args__.unpack()
+return space.newtuple([space.wrap('f')]+a_w)
+
+

[pypy-commit] pypy py3.3: readapt py3.3's object changes

2014-10-24 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3.3
Changeset: r74193:c364311cc8e9
Date: 2014-10-24 13:56 -0700
http://bitbucket.org/pypy/pypy/changeset/c364311cc8e9/

Log:readapt py3.3's object changes

diff --git a/pypy/objspace/std/objectobject.py 
b/pypy/objspace/std/objectobject.py
--- a/pypy/objspace/std/objectobject.py
+++ b/pypy/objspace/std/objectobject.py
@@ -204,7 +204,7 @@
 raise OperationError(space.w_TypeError, space.wrap(msg))
 if space.len_w(w_format_spec)  0:
 msg = object.__format__ with a non-empty format string is deprecated
-space.warn(space.wrap(msg), space.w_PendingDeprecationWarning)
+space.warn(space.wrap(msg), space.w_DeprecationWarning)
 return space.format(w_as_str, w_format_spec)
 
 def descr__eq__(space, w_self, w_other):
@@ -220,6 +220,9 @@
 def descr_richcompare(space, w_self, w_other):
 return space.w_NotImplemented
 
+def descr__dir__(space, w_obj):
+from pypy.objspace.std.util import _objectdir
+return space.call_function(space.w_list, _objectdir(space, w_obj))
 
 W_ObjectObject.typedef = StdTypeDef(object,
 __doc__ = The most base type,
@@ -239,6 +242,7 @@
 __reduce__ = interp2app(descr__reduce__),
 __reduce_ex__ = interp2app(descr__reduce_ex__),
 __format__ = interp2app(descr___format__),
+__dir__ = interp2app(descr__dir__),
 
 __eq__ = interp2app(descr__eq__),
 __ne__ = interp2app(descr__ne__),
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: adapt to RPY_EXPORT_FOR_TESTS

2014-10-24 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3k
Changeset: r74198:6c2b6168f56a
Date: 2014-10-24 18:13 -0700
http://bitbucket.org/pypy/pypy/changeset/6c2b6168f56a/

Log:adapt to RPY_EXPORT_FOR_TESTS

diff --git a/pypy/module/_codecs/locale.h b/pypy/module/_codecs/locale.h
--- a/pypy/module/_codecs/locale.h
+++ b/pypy/module/_codecs/locale.h
@@ -1,7 +1,8 @@
 #include stdlib.h
 #include wchar.h
+#include src/precommondefs.h
 
-wchar_t* pypy_char2wchar(const char* arg, size_t *size);
-void pypy_char2wchar_free(wchar_t *text);
-char* pypy_wchar2char(const wchar_t *text, size_t *error_pos);
-void pypy_wchar2char_free(char *bytes);
+RPY_EXPORTED_FOR_TESTS wchar_t* pypy_char2wchar(const char* arg, size_t *size);
+RPY_EXPORTED_FOR_TESTS void pypy_char2wchar_free(wchar_t *text);
+RPY_EXPORTED_FOR_TESTS char* pypy_wchar2char(const wchar_t *text, size_t 
*error_pos);
+RPY_EXPORTED_FOR_TESTS void pypy_wchar2char_free(char *bytes);
diff --git a/pypy/module/_codecs/locale.py b/pypy/module/_codecs/locale.py
--- a/pypy/module/_codecs/locale.py
+++ b/pypy/module/_codecs/locale.py
@@ -10,14 +10,14 @@
 from rpython.rlib.runicode import (code_to_unichr,
 default_unicode_error_decode, default_unicode_error_encode)
 from rpython.rtyper.lltypesystem import lltype, rffi
+from rpython.translator import cdir
 from rpython.translator.tool.cbuild import ExternalCompilationInfo
 
 cwd = py.path.local(__file__).dirpath()
 eci = ExternalCompilationInfo(
 includes=[cwd.join('locale.h')],
-separate_module_files=[cwd.join('locale.c')],
-export_symbols=['pypy_char2wchar', 'pypy_char2wchar_free',
-'pypy_wchar2char', 'pypy_wchar2char_free'])
+include_dirs=[str(cwd), cdir],
+separate_module_files=[cwd.join('locale.c')])
 
 def llexternal(*args, **kwargs):
 kwargs.setdefault('compilation_info', eci)
diff --git a/pypy/module/_posixsubprocess/_posixsubprocess.c 
b/pypy/module/_posixsubprocess/_posixsubprocess.c
--- a/pypy/module/_posixsubprocess/_posixsubprocess.c
+++ b/pypy/module/_posixsubprocess/_posixsubprocess.c
@@ -1,5 +1,6 @@
 /* This file is mostly a copy of CPython's Module/_posixsubprocess.c */
 /* modified for PyPy: Removed dependency on Python API. */
+#include src/precommondefs.h
 
 /* Authors: Gregory P. Smith  Jeffrey Yasskin */
 #if defined(HAVE_PIPE2)  !defined(_GNU_SOURCE)
@@ -310,7 +311,7 @@
  * This restriction is documented at
  * http://www.opengroup.org/onlinepubs/009695399/functions/fork.html.
  */
-void
+RPY_EXPORTED_FOR_TESTS void
 pypy_subprocess_child_exec(
char *const exec_array[],
char *const argv[],
@@ -475,7 +476,7 @@
 }
 
 
-int
+RPY_EXPORTED_FOR_TESTS int
 pypy_subprocess_cloexec_pipe(int *fds)
 {
 int res;
@@ -517,7 +518,7 @@
 }
 
 
-void
+RPY_EXPORTED_FOR_TESTS void
 pypy_subprocess_init(void)
 {
 #ifdef _SC_OPEN_MAX
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
@@ -3,6 +3,7 @@
 
 from rpython.rtyper.lltypesystem import lltype, rffi
 from rpython.rtyper.tool import rffi_platform as platform
+from rpython.translator import cdir
 from rpython.translator.tool.cbuild import ExternalCompilationInfo
 
 from pypy.interpreter.error import (
@@ -21,11 +22,8 @@
 config = platform.configure(CConfig)
 
 eci = ExternalCompilationInfo(
-separate_module_files=[thisdir.join('_posixsubprocess.c')],
-export_symbols=['pypy_subprocess_child_exec',
-'pypy_subprocess_cloexec_pipe',
-'pypy_subprocess_init',
-])
+include_dirs=[str(thisdir), cdir],
+separate_module_files=[thisdir.join('_posixsubprocess.c')])
 
 compile_extra = []
 if config['HAVE_SYS_SYSCALL_H']:
diff --git a/pypy/module/posix/interp_nt.py b/pypy/module/posix/interp_nt.py
--- a/pypy/module/posix/interp_nt.py
+++ b/pypy/module/posix/interp_nt.py
@@ -2,6 +2,7 @@
 from rpython.rtyper.lltypesystem import lltype, rffi
 from rpython.rtyper.module.ll_win32file import make_win32_traits
 from rpython.rtyper.module.support import UnicodeTraits
+from rpython.translator import cdir
 from rpython.translator.tool.cbuild import ExternalCompilationInfo
 
 
@@ -21,12 +22,11 @@
 
 eci = ExternalCompilationInfo(
 includes=['windows.h'],
+include_dirs=[cdir],
 post_include_bits=[
-DWORD 
+RPY_EXPORTED_FOR_TESTS DWORD 
 pypy_GetFinalPathNameByHandle(FARPROC, HANDLE, LPTSTR, DWORD, 
DWORD);],
-separate_module_sources=[separate_module_source],
-export_symbols=['pypy_GetFinalPathNameByHandle']
-)
+separate_module_sources=[separate_module_source])
 pypy_GetFinalPathNameByHandle = rffi.llexternal(
 'pypy_GetFinalPathNameByHandle',
 [rffi.VOIDP, rwin32.HANDLE, rffi.CWCHARP, rwin32.DWORD, rwin32.DWORD],
___
pypy-commit mailing list
pypy-commit@python.org

[pypy-commit] pypy py3k: merge default

2014-10-24 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3k
Changeset: r74197:134020dca51a
Date: 2014-10-24 16:10 -0700
http://bitbucket.org/pypy/pypy/changeset/134020dca51a/

Log:merge default

diff too long, truncating to 2000 out of 29307 lines

diff --git a/.hgignore b/.hgignore
--- a/.hgignore
+++ b/.hgignore
@@ -89,6 +89,7 @@
 ^pypy/doc/image/lattice3\.png$
 ^pypy/doc/image/stackless_informal\.png$
 ^pypy/doc/image/parsing_example.+\.png$
+^rpython/doc/_build/.*$
 ^pypy/module/test_lib_pypy/ctypes_tests/_ctypes_test\.o$
 ^compiled
 ^.git/
diff --git a/README.rst b/README.rst
--- a/README.rst
+++ b/README.rst
@@ -23,6 +23,7 @@
 
 the pypy-dev team pypy-...@python.org
 
+
 Building
 
 
diff --git a/ctypes_configure/doc/configure.txt 
b/ctypes_configure/doc/configure.txt
--- a/ctypes_configure/doc/configure.txt
+++ b/ctypes_configure/doc/configure.txt
@@ -19,6 +19,4 @@
 usage
 =
 
-`sample.py`_ explains in details how to use it.
-
-.. _`sample.py`: 
http://codespeak.net/svn/pypy/dist/ctypes_configure/doc/sample.py
+:source:`sample.py ctypes_configure/doc/sample.py` explains in details how 
to use it.
diff --git a/pypy/doc/TODO b/pypy/doc/TODO
new file mode 100644
--- /dev/null
+++ b/pypy/doc/TODO
@@ -0,0 +1,40 @@
+Documentation TODO
+==
+
+General
+---
+
+* architecture documents don't really show the separation between PyPy and
+  RPython
+  * architecture.rst is duplicate (both pypy and rpython)
+* Consider moving information from pypy/doc/{build,windows}.rst to rpython/doc
+
+
+Cleanup
+~~~
+
+* remove documentation on removed features
+  * various object spaces
+* update / remove dead links
+
+
+Meta
+
+
+* work on configuration/options documentation generation
+
+
+PyPy
+
+
+* Update coding guide
+* Move links from project-documentation.rst to index.rst and consider killing
+  it.
+
+
+RPython
+---
+
+* make translation.rst a high-level overview and move details in their own
+  documents
+* redo various outdated pictures in translation.rst
diff --git a/pypy/doc/__pypy__-module.rst b/pypy/doc/__pypy__-module.rst
--- a/pypy/doc/__pypy__-module.rst
+++ b/pypy/doc/__pypy__-module.rst
@@ -1,20 +1,17 @@
-
 .. comment: this document is very incomplete, should we generate
 it automatically?
 
-===
 The ``__pypy__`` module
 ===
 
 The ``__pypy__`` module is the main entry point to special features provided
-by PyPy's standard interpreter. Its content depends on `configuration 
options`_ 
-which may add new functionality and functions whose existence or non-existence 
-indicates the presence of such features. 
+by PyPy's standard interpreter. Its content depends on :doc:`configuration 
options config/index`
+which may add new functionality and functions whose existence or non-existence
+indicates the presence of such features.
 
-.. _`configuration options`: config/index.html
 
 Generally available functionality
-=
+-
 
  - ``internal_repr(obj)``: return the interpreter-level representation of an
object.
@@ -22,28 +19,22 @@
It works like a simplified array of characters (actually, depending on the
configuration the ``array`` module internally uses this).
 
+
 Transparent Proxy Functionality
-===
+---
 
-If `transparent proxies`_ are enabled (with :config:`objspace.std.withtproxy`)
+If :ref:`transparent proxies tproxy` are enabled (with 
:config:`objspace.std.withtproxy`)
 the following functions are put into ``__pypy__``:
 
  - ``tproxy(typ, controller)``: Return something that looks like it is of type
typ. Its behaviour is completely controlled by the controller. See the docs
-   about `transparent proxies`_ for detail.
-
+   about :ref:`transparent proxies tproxy` for detail.
  - ``get_tproxy_controller(obj)``: If obj is really a transparent proxy, return
its controller. Otherwise return None.
 
-.. _`transparent proxies`: objspace-proxies.html#tproxy
-
 
 Functionality available on py.py (not after translation)
-
+
 
  - ``isfake(obj)``: returns True if ``obj`` is faked.
-
  - ``interp_pdb()``: start a pdb at interpreter-level.
-
-
-
diff --git a/pypy/doc/_ref.txt b/pypy/doc/_ref.txt
deleted file mode 100644
--- a/pypy/doc/_ref.txt
+++ /dev/null
@@ -1,114 +0,0 @@
-.. This file is generated automatically by makeref.py script,
-   which in turn is run manually.
-
-.. _`ctypes_configure/doc/sample.py`: 
https://bitbucket.org/pypy/pypy/src/default/ctypes_configure/doc/sample.py
-.. _`dotviewer/`: https://bitbucket.org/pypy/pypy/src/default/dotviewer/
-.. _`lib-python/`: https://bitbucket.org/pypy/pypy/src/default/lib-python/
-.. _`lib-python/2.7/dis.py`: 
https://bitbucket.org/pypy/pypy/src/default/lib-python/2.7/dis.py
-.. _`lib_pypy/`: 

[pypy-commit] pypy py3k: (mattip) attempt to fix win32 translation

2014-10-23 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3k
Changeset: r74144:a203c518cb8e
Date: 2014-10-23 14:31 -0700
http://bitbucket.org/pypy/pypy/changeset/a203c518cb8e/

Log:(mattip) attempt to fix win32 translation

diff --git a/pypy/module/posix/interp_nt.py b/pypy/module/posix/interp_nt.py
--- a/pypy/module/posix/interp_nt.py
+++ b/pypy/module/posix/interp_nt.py
@@ -21,6 +21,9 @@
 
 eci = ExternalCompilationInfo(
 includes=['windows.h'],
+post_include_bits=[
+DWORD 
+pypy_GetFinalPathNameByHandle(FARPROC, HANDLE, LPTSTR, DWORD, 
DWORD);],
 separate_module_sources=[separate_module_source],
 export_symbols=['pypy_GetFinalPathNameByHandle']
 )
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: issue1800: mimic cpython in the special case that stdin is a directory

2014-10-22 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3k
Changeset: r74097:67572b825fbd
Date: 2014-10-22 17:13 -0700
http://bitbucket.org/pypy/pypy/changeset/67572b825fbd/

Log:issue1800: mimic cpython in the special case that stdin is a
directory

diff --git a/pypy/interpreter/app_main.py b/pypy/interpreter/app_main.py
--- a/pypy/interpreter/app_main.py
+++ b/pypy/interpreter/app_main.py
@@ -278,12 +278,21 @@
 else:
 errors = None
 
-sys.stdin = sys.__stdin__ = create_stdio(
-0, False, stdin, encoding, errors, unbuffered)
+sys.stderr = sys.__stderr__ = create_stdio(
+2, True, stderr, encoding, 'backslashreplace', unbuffered)
 sys.stdout = sys.__stdout__ = create_stdio(
 1, True, stdout, encoding, errors, unbuffered)
-sys.stderr = sys.__stderr__ = create_stdio(
-2, True, stderr, encoding, 'backslashreplace', unbuffered)
+
+try:
+sys.stdin = sys.__stdin__ = create_stdio(
+0, False, stdin, encoding, errors, unbuffered)
+except OSError as e:
+if e.errno != errno.EISDIR:
+raise
+import os
+print(Python error: stdin is a directory, cannot continue,
+  file=sys.stderr)
+os._exit(1)
 finally:
 if encerr:
 display_exception(encerr)
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3.3: utilize IsADirectoryError

2014-10-22 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3.3
Changeset: r74099:cc09e8a517b4
Date: 2014-10-22 17:15 -0700
http://bitbucket.org/pypy/pypy/changeset/cc09e8a517b4/

Log:utilize IsADirectoryError

diff --git a/pypy/interpreter/app_main.py b/pypy/interpreter/app_main.py
--- a/pypy/interpreter/app_main.py
+++ b/pypy/interpreter/app_main.py
@@ -286,9 +286,7 @@
 try:
 sys.stdin = sys.__stdin__ = create_stdio(
 0, False, stdin, encoding, errors, unbuffered)
-except OSError as e:
-if e.errno != errno.EISDIR:
-raise
+except IsADirectoryError:
 import os
 print(Python error: stdin is a directory, cannot continue,
   file=sys.stderr)
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3.3: merge py3k

2014-10-22 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3.3
Changeset: r74098:e134e7d8f49f
Date: 2014-10-22 17:13 -0700
http://bitbucket.org/pypy/pypy/changeset/e134e7d8f49f/

Log:merge py3k

diff --git a/pypy/interpreter/app_main.py b/pypy/interpreter/app_main.py
--- a/pypy/interpreter/app_main.py
+++ b/pypy/interpreter/app_main.py
@@ -278,12 +278,21 @@
 else:
 errors = None
 
-sys.stdin = sys.__stdin__ = create_stdio(
-0, False, stdin, encoding, errors, unbuffered)
+sys.stderr = sys.__stderr__ = create_stdio(
+2, True, stderr, encoding, 'backslashreplace', unbuffered)
 sys.stdout = sys.__stdout__ = create_stdio(
 1, True, stdout, encoding, errors, unbuffered)
-sys.stderr = sys.__stderr__ = create_stdio(
-2, True, stderr, encoding, 'backslashreplace', unbuffered)
+
+try:
+sys.stdin = sys.__stdin__ = create_stdio(
+0, False, stdin, encoding, errors, unbuffered)
+except OSError as e:
+if e.errno != errno.EISDIR:
+raise
+import os
+print(Python error: stdin is a directory, cannot continue,
+  file=sys.stderr)
+os._exit(1)
 finally:
 if encerr:
 display_exception(encerr)
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy.org extradoc: pypy3 2.4.0 release

2014-10-21 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: extradoc
Changeset: r549:564aeee54c68
Date: 2014-10-21 09:43 -0700
http://bitbucket.org/pypy/pypy.org/changeset/564aeee54c68/

Log:pypy3 2.4.0 release

diff --git a/download.html b/download.html
--- a/download.html
+++ b/download.html
@@ -53,7 +53,7 @@
 pWe provide binaries for x86 and ARM Linux, Mac OS/X and Windows for:/p
 ul class=simple
 lithe Python2.7 compatible release #8212; strongPyPy 2.4.0/strong 
#8212; (a class=reference external 
href=http://doc.pypy.org/en/latest/release-2.4.0.html;what's new in PyPy 
2.4.0?/a )/li
-lithe Python3.2.5 compatible release #8212; strongPyPy3 2.3.1/strong 
#8212; (a class=reference external 
href=http://doc.pypy.org/en/latest/release-pypy3-2.3.1.html;what's new in 
PyPy3 2.3.1?/a)./li
+lithe Python3.2.5 compatible release #8212; strongPyPy3 2.4.0/strong 
#8212; (a class=reference external 
href=http://doc.pypy.org/en/latest/release-pypy3-2.4.0.html;what's new in 
PyPy3 2.4.0?/a)./li
 /ul
 ul class=download-menu simple
 liDownloadul
@@ -104,19 +104,19 @@
 liSee below for the sources./li
 /ul
 /div
-div class=section id=python-3-2-5-compatible-pypy3-2-3-1
-h1Python 3.2.5 compatible PyPy3 2.3.1/h1
+div class=section id=python-3-2-5-compatible-pypy3-2-4-0
+h1Python 3.2.5 compatible PyPy3 2.4.0/h1
 ul class=simple
-lia class=reference external 
href=https://bitbucket.org/pypy/pypy/downloads/pypy3-2.3.1-linux.tar.bz2;Linux
 x86 binary (32bit, tar.bz2 built on Ubuntu 10.04.4 LTS)/a (see tt 
class=docutils literal[1]/tt below)/li
-lia class=reference external 
href=https://bitbucket.org/pypy/pypy/downloads/pypy3-2.3.1-linux64.tar.bz2;Linux
 x86-64 binary (64bit, tar.bz2 built on Ubuntu 12.04 - 14.04)/a (see tt 
class=docutils literal[1]/tt below)/li
-lia class=reference external 
href=https://bitbucket.org/pypy/pypy/downloads/pypy3-2.3.1-linux-armhf-raspbian.tar.bz2;ARM
 Hardfloat Linux binary (ARMHF/gnueabihf, tar.bz2, Raspbian)/a (see tt 
class=docutils literal[1]/tt below)/li
-lia class=reference external 
href=https://bitbucket.org/pypy/pypy/downloads/pypy3-2.3.1-linux-armhf-raring.tar.bz2;ARM
 Hardfloat Linux binary (ARMHF/gnueabihf, tar.bz2, Ubuntu Raring)/a (see tt 
class=docutils literal[1]/tt below)/li
-lia class=reference external 
href=https://bitbucket.org/pypy/pypy/downloads/pypy3-2.3.1-linux-armel.tar.bz2;ARM
 Softfloat Linux binary (ARMEL/gnueabi, tar.bz2,  Ubuntu Precise)/a (see tt 
class=docutils literal[1]/tt below)/li
-lia class=reference external 
href=https://bitbucket.org/pypy/pypy/downloads/pypy3-2.3.1-osx64.tar.bz2;Mac 
OS/X binary (64bit)/a/li
-lia class=reference external 
href=https://bitbucket.org/pypy/pypy/downloads/pypy3-2.3.1-win32.zip;Windows 
binary (32bit)/a (you might need the a class=reference external 
href=http://www.microsoft.com/en-us/download/details.aspx?id=5582;VS 2008 
runtime library
+lia class=reference external 
href=https://bitbucket.org/pypy/pypy/downloads/pypy3-2.4.0-linux.tar.bz2;Linux
 x86 binary (32bit, tar.bz2 built on Ubuntu 10.04.4 LTS)/a (see tt 
class=docutils literal[1]/tt below)/li
+lia class=reference external 
href=https://bitbucket.org/pypy/pypy/downloads/pypy3-2.4.0-linux64.tar.bz2;Linux
 x86-64 binary (64bit, tar.bz2 built on Ubuntu 12.04 - 14.04)/a (see tt 
class=docutils literal[1]/tt below)/li
+lia class=reference external 
href=https://bitbucket.org/pypy/pypy/downloads/pypy3-2.4.0-linux-armhf-raspbian.tar.bz2;ARM
 Hardfloat Linux binary (ARMHF/gnueabihf, tar.bz2, Raspbian)/a (see tt 
class=docutils literal[1]/tt below)/li
+lia class=reference external 
href=https://bitbucket.org/pypy/pypy/downloads/pypy3-2.4.0-linux-armhf-raring.tar.bz2;ARM
 Hardfloat Linux binary (ARMHF/gnueabihf, tar.bz2, Ubuntu Raring)/a (see tt 
class=docutils literal[1]/tt below)/li
+lia class=reference external 
href=https://bitbucket.org/pypy/pypy/downloads/pypy3-2.4.0-linux-armel.tar.bz2;ARM
 Softfloat Linux binary (ARMEL/gnueabi, tar.bz2,  Ubuntu Precise)/a (see tt 
class=docutils literal[1]/tt below)/li
+lia class=reference external 
href=https://bitbucket.org/pypy/pypy/downloads/pypy3-2.4.0-osx64.tar.bz2;Mac 
OS/X binary (64bit)/a/li
+lia class=reference external 
href=https://bitbucket.org/pypy/pypy/downloads/pypy3-2.4.0-win32.zip;Windows 
binary (32bit)/a (you might need the a class=reference external 
href=http://www.microsoft.com/en-us/download/details.aspx?id=5582;VS 2008 
runtime library
 installer vcredist_x86.exe/a.)/li
-lia class=reference external 
href=https://bitbucket.org/pypy/pypy/downloads/pypy3-2.3.1-src.tar.bz2;Source 
(tar.bz2)/a/li
-lia class=reference external 
href=https://bitbucket.org/pypy/pypy/downloads/pypy3-2.3.1-src.zip;Source 
(zip)/a/li
+lia class=reference external 
href=https://bitbucket.org/pypy/pypy/downloads/pypy3-2.4.0-src.tar.bz2;Source 
(tar.bz2)/a/li
+lia class=reference external 
href=https://bitbucket.org/pypy/pypy/downloads/pypy3-2.4.0-src.zip;Source 
(zip)/a/li
 lia class=reference external 

[pypy-commit] pypy pypy3-release-2.4.x: Added tag pypy3-release-2.4.0 for changeset b2091e973da6

2014-10-20 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: pypy3-release-2.4.x
Changeset: r74026:b08273bbda6f
Date: 2014-10-20 16:41 -0700
http://bitbucket.org/pypy/pypy/changeset/b08273bbda6f/

Log:Added tag pypy3-release-2.4.0 for changeset b2091e973da6

diff --git a/.hgtags b/.hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -14,3 +14,4 @@
 32f35069a16d819b58c1b6efb17c44e3e53397b2 release-2.3.1
 32f35069a16d819b58c1b6efb17c44e3e53397b2 release-2.2=3.1
  release-2.2=3.1
+b2091e973da69152b3f928bfaabd5d2347e6df46 pypy3-release-2.4.0
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy pypy3-release-2.4.x: adjust per the new pypy3 exe name

2014-10-17 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: pypy3-release-2.4.x
Changeset: r74005:5552600c8b97
Date: 2014-10-16 16:50 -0700
http://bitbucket.org/pypy/pypy/changeset/5552600c8b97/

Log:adjust per the new pypy3 exe name (grafted from
5ac508b99502933d3f86d5fb3be2743fef715486)

diff --git a/pypy/tool/release/test/test_package.py 
b/pypy/tool/release/test/test_package.py
--- a/pypy/tool/release/test/test_package.py
+++ b/pypy/tool/release/test/test_package.py
@@ -1,4 +1,4 @@
-
+import os
 import py
 from pypy.conftest import pypydir
 from pypy.tool.release import package, package
@@ -13,12 +13,12 @@
 exe_name_in_archive = 'pypy-c.exe'
 else:
 basename = 'pypy-c'
-rename_pypy_c = 'pypy'
-exe_name_in_archive = 'bin/pypy'
+rename_pypy_c = package.POSIX_EXE
+exe_name_in_archive = os.path.join('bin', package.POSIX_EXE)
 pypy_c = py.path.local(pypydir).join('goal', basename)
 if not pypy_c.check():
 if sys.platform == 'win32':
-import os, shutil
+import shutil
 for d in os.environ['PATH'].split(';'):
 if os.path.exists(os.path.join(d, 'cmd.exe')):
 shutil.copy(os.path.join(d, 'cmd.exe'), str(pypy_c))
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy pypy3-release-2.4.x: fix _SSLContext invalid protocol errors not ensuring a self.ctx, leading to a

2014-10-17 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: pypy3-release-2.4.x
Changeset: r74006:b2091e973da6
Date: 2014-10-17 13:09 -0700
http://bitbucket.org/pypy/pypy/changeset/b2091e973da6/

Log:fix _SSLContext invalid protocol errors not ensuring a self.ctx,
leading to a potential crash in its destructor (grafted from
c1ddf2d919a18fa4ebec03ce84e1a0457f4396ad)

diff --git a/pypy/module/_ssl/interp_ssl.py b/pypy/module/_ssl/interp_ssl.py
--- a/pypy/module/_ssl/interp_ssl.py
+++ b/pypy/module/_ssl/interp_ssl.py
@@ -90,6 +90,8 @@
 
 
 class SSLContext(W_Root):
+ctx = lltype.nullptr(SSL_CTX.TO)
+
 def __init__(self, space, protocol):
 if protocol == PY_SSL_VERSION_TLS1:
 method = libssl_TLSv1_method()
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: fix _SSLContext invalid protocol errors not ensuring a self.ctx, leading to a

2014-10-17 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3k
Changeset: r74003:c1ddf2d919a1
Date: 2014-10-17 13:09 -0700
http://bitbucket.org/pypy/pypy/changeset/c1ddf2d919a1/

Log:fix _SSLContext invalid protocol errors not ensuring a self.ctx,
leading to a potential crash in its destructor

diff --git a/pypy/module/_ssl/interp_ssl.py b/pypy/module/_ssl/interp_ssl.py
--- a/pypy/module/_ssl/interp_ssl.py
+++ b/pypy/module/_ssl/interp_ssl.py
@@ -90,6 +90,8 @@
 
 
 class SSLContext(W_Root):
+ctx = lltype.nullptr(SSL_CTX.TO)
+
 def __init__(self, space, protocol):
 if protocol == PY_SSL_VERSION_TLS1:
 method = libssl_TLSv1_method()
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy pypy3-release-2.4.x: this workaround is no longer needed

2014-10-17 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: pypy3-release-2.4.x
Changeset: r74004:bfc266fad6e7
Date: 2014-10-14 12:51 -0700
http://bitbucket.org/pypy/pypy/changeset/bfc266fad6e7/

Log:this workaround is no longer needed (grafted from
c377769fa159b855076be8cb7f5483acbc5f4e16)

diff --git a/rpython/rtyper/lltypesystem/ll2ctypes.py 
b/rpython/rtyper/lltypesystem/ll2ctypes.py
--- a/rpython/rtyper/lltypesystem/ll2ctypes.py
+++ b/rpython/rtyper/lltypesystem/ll2ctypes.py
@@ -361,9 +361,7 @@
 functype = ctypes.CFUNCTYPE
 if sys.platform == 'win32':
 from rpython.rlib.clibffi import FFI_STDCALL, FFI_DEFAULT_ABI
-# XXX:
-#if getattr(T.TO, 'ABI', FFI_DEFAULT_ABI) == FFI_STDCALL:
-if getattr(T.TO, 'ABI', FFI_DEFAULT_ABI) == 'FFI_STDCALL':
+if getattr(T.TO, 'ABI', FFI_DEFAULT_ABI) == FFI_STDCALL:
 # for win32 system call
 functype = ctypes.WINFUNCTYPE
 argtypes = [get_ctypes_type(ARG) for ARG in T.TO.ARGS
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: merge default

2014-10-17 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3k
Changeset: r74007:dfd4a9093328
Date: 2014-10-17 15:45 -0700
http://bitbucket.org/pypy/pypy/changeset/dfd4a9093328/

Log:merge default

diff too long, truncating to 2000 out of 3968 lines

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
@@ -19,3 +19,6 @@
 .. branch: var-in-Some
 Store annotations on the Variable objects, rather than in a big dict.
 Introduce a new framework for double-dispatched annotation implementations.
+
+.. branch: ClassRepr
+Refactor ClassRepr and make normalizecalls independent of the rtyper.
diff --git a/pypy/goal/targetpypystandalone.py 
b/pypy/goal/targetpypystandalone.py
--- a/pypy/goal/targetpypystandalone.py
+++ b/pypy/goal/targetpypystandalone.py
@@ -258,6 +258,7 @@
 enable_translationmodules(config)
 
 config.translation.suggest(check_str_without_nul=True)
+config.translation.suggest(shared=True)
 
 if config.translation.thread:
 config.objspace.usemodules.thread = True
diff --git a/pypy/module/pypyjit/interp_resop.py 
b/pypy/module/pypyjit/interp_resop.py
--- a/pypy/module/pypyjit/interp_resop.py
+++ b/pypy/module/pypyjit/interp_resop.py
@@ -7,7 +7,7 @@
 from pypy.interpreter.error import OperationError
 from rpython.rtyper.lltypesystem import lltype
 from rpython.rtyper.annlowlevel import cast_base_ptr_to_instance, hlstr
-from rpython.rtyper.lltypesystem.rclass import OBJECT
+from rpython.rtyper.rclass import OBJECT
 from rpython.jit.metainterp.resoperation import rop
 from rpython.rlib.nonconst import NonConstant
 from rpython.rlib import jit_hooks
diff --git a/pypy/module/pypyjit/test/test_jit_hook.py 
b/pypy/module/pypyjit/test/test_jit_hook.py
--- a/pypy/module/pypyjit/test/test_jit_hook.py
+++ b/pypy/module/pypyjit/test/test_jit_hook.py
@@ -9,7 +9,7 @@
 from rpython.rtyper.annlowlevel import (cast_instance_to_base_ptr,
   cast_base_ptr_to_instance)
 from rpython.rtyper.lltypesystem import lltype, llmemory
-from rpython.rtyper.lltypesystem.rclass import OBJECT
+from rpython.rtyper.rclass import OBJECT
 from pypy.module.pypyjit.interp_jit import pypyjitdriver
 from pypy.module.pypyjit.policy import pypy_hooks
 from rpython.jit.tool.oparser import parse
diff --git a/pypy/objspace/std/bytearrayobject.py 
b/pypy/objspace/std/bytearrayobject.py
--- a/pypy/objspace/std/bytearrayobject.py
+++ b/pypy/objspace/std/bytearrayobject.py
@@ -4,6 +4,7 @@
 import_from_mixin, newlist_hint, resizelist_hint, specialize)
 from rpython.rlib.buffer import Buffer
 from rpython.rlib.rstring import StringBuilder, ByteListBuilder
+from rpython.rlib.debug import check_list_of_chars
 
 from pypy.interpreter.baseobjspace import W_Root
 from pypy.interpreter.error import OperationError, oefmt
@@ -23,6 +24,7 @@
 import_from_mixin(StringMethods)
 
 def __init__(self, data):
+check_list_of_chars(data)
 self.data = data
 
 def __repr__(self):
diff --git a/rpython/annotator/annrpython.py b/rpython/annotator/annrpython.py
--- a/rpython/annotator/annrpython.py
+++ b/rpython/annotator/annrpython.py
@@ -249,10 +249,6 @@
 assert s_value.contains(s_old)
 arg.annotation = s_value
 
-def transfer_binding(self, v_target, v_source):
-assert v_source.annotation is not None
-v_target.annotation = v_source.annotation
-
 def warning(self, msg, pos=None):
 if pos is None:
 try:
@@ -579,7 +575,7 @@
 for arg in op.args:
 if isinstance(self.annotation(arg), annmodel.SomeImpossibleValue):
 raise BlockedInference(self, op, -1)
-resultcell = op.consider(self, *op.args)
+resultcell = op.consider(self)
 if resultcell is None:
 resultcell = annmodel.s_ImpossibleValue
 elif resultcell == annmodel.s_ImpossibleValue:
diff --git a/rpython/annotator/bookkeeper.py b/rpython/annotator/bookkeeper.py
--- a/rpython/annotator/bookkeeper.py
+++ b/rpython/annotator/bookkeeper.py
@@ -559,10 +559,6 @@
 assert self.annotator.binding(op.args[pos]) == s_type
 return op
 
-def ondegenerated(self, what, s_value, where=None, called_from_graph=None):
-self.annotator.ondegenerated(what, s_value, where=where,
- called_from_graph=called_from_graph)
-
 def whereami(self):
 return self.annotator.whereami(self.position_key)
 
diff --git a/rpython/annotator/classdef.py b/rpython/annotator/classdef.py
--- a/rpython/annotator/classdef.py
+++ b/rpython/annotator/classdef.py
@@ -154,6 +154,8 @@
 self.subdefs = []
 self.attr_sources = {}   # {name: list-of-sources}
 self.read_locations_of__class__ = {}
+self.repr = None
+self.extra_access_sets = {}
 
 if classdesc.basedesc:
 self.basedef = 

[pypy-commit] pypy py3.3: bump this for now, blah

2014-10-17 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3.3
Changeset: r74009:dc0742bdf5d6
Date: 2014-10-17 15:46 -0700
http://bitbucket.org/pypy/pypy/changeset/dc0742bdf5d6/

Log:bump this for now, blah

diff --git a/pypy/tool/release/package.py b/pypy/tool/release/package.py
--- a/pypy/tool/release/package.py
+++ b/pypy/tool/release/package.py
@@ -27,7 +27,7 @@
 STDLIB_VER = 3
 
 # XXX: don't hardcode the version
-POSIX_EXE = 'pypy3.2'
+POSIX_EXE = 'pypy3.3'
 
 def ignore_patterns(*patterns):
 Function that can be used as copytree() ignore parameter.
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3.3: merge py3k

2014-10-17 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3.3
Changeset: r74008:02cf2f6a3032
Date: 2014-10-17 15:46 -0700
http://bitbucket.org/pypy/pypy/changeset/02cf2f6a3032/

Log:merge py3k

diff too long, truncating to 2000 out of 18832 lines

diff --git a/LICENSE b/LICENSE
--- a/LICENSE
+++ b/LICENSE
@@ -3,8 +3,8 @@
 
 Except when otherwise stated (look for LICENSE files in directories or
 information at the beginning of each file) all software and documentation in
-the 'rpython', 'pypy', 'ctype_configure', 'dotviewer', 'demo', and 'lib_pypy'
-directories is licensed as follows: 
+the 'rpython', 'pypy', 'ctype_configure', 'dotviewer', 'demo', 'lib_pypy',
+'py', and '_pytest' directories is licensed as follows: 
 
 The MIT License
 
@@ -367,3 +367,43 @@
 Detailed license information is contained in the NOTICE file in the
 directory.
 
+
+Licenses and Acknowledgements for Incorporated Software
+===
+
+This section is an incomplete, but growing list of licenses and
+acknowledgements for third-party software incorporated in the PyPy
+distribution.
+
+License for 'Tcl/Tk'
+
+
+This copy of PyPy contains library code that may, when used, result in
+the Tcl/Tk library to be loaded.  PyPy also includes code that may be
+regarded as being a copy of some parts of the Tcl/Tk header files.
+You may see a copy of the License for Tcl/Tk in the file
+`lib_pypy/_tkinter/license.terms` included here.
+
+License for 'bzip2'
+---
+
+This copy of PyPy may be linked (dynamically or statically) with the
+bzip2 library.  You may see a copy of the License for bzip2/libbzip2 at
+
+http://www.bzip.org/1.0.5/bzip2-manual-1.0.5.html
+
+License for 'openssl'
+-
+
+This copy of PyPy may be linked (dynamically or statically) with the
+openssl library.  You may see a copy of the License for OpenSSL at
+
+https://www.openssl.org/source/license.html
+
+License for '_gdbm'
+--
+
+The _gdbm module includes code from gdbm.h, which is distributed under
+the terms of the GPL license version 2 or any later version.  Thus the
+_gdbm module, provided in the file lib_pypy/_gdbm.py, is redistributed
+under the terms of the GPL license as well.
diff --git a/lib-python/2.7/test/test_select.py 
b/lib-python/2.7/test/test_select.py
--- a/lib-python/2.7/test/test_select.py
+++ b/lib-python/2.7/test/test_select.py
@@ -57,7 +57,17 @@
 del a[-1]
 return sys.__stdout__.fileno()
 a[:] = [F()] * 10
-self.assertEqual(select.select([], a, []), ([], a[:5], []))
+result = select.select([], a, [])
+# CPython: 'a' ends up with 5 items, because each fileno()
+# removes an item and at the middle the iteration stops.
+# PyPy: 'a' ends up empty, because the iteration is done on
+# a copy of the original list: fileno() is called 10 times.
+if test_support.check_impl_detail(cpython=True):
+self.assertEqual(len(result[1]), 5)
+self.assertEqual(len(a), 5)
+if test_support.check_impl_detail(pypy=True):
+self.assertEqual(len(result[1]), 10)
+self.assertEqual(len(a), 0)
 
 def test_main():
 test_support.run_unittest(SelectTestCase)
diff --git a/lib-python/3/test/test_select.py b/lib-python/3/test/test_select.py
--- a/lib-python/3/test/test_select.py
+++ b/lib-python/3/test/test_select.py
@@ -73,7 +73,17 @@
 del a[-1]
 return sys.__stdout__.fileno()
 a[:] = [F()] * 10
-self.assertEqual(select.select([], a, []), ([], a[:5], []))
+result = select.select([], a, [])
+# CPython: 'a' ends up with 5 items, because each fileno()
+# removes an item and at the middle the iteration stops.
+# PyPy: 'a' ends up empty, because the iteration is done on
+# a copy of the original list: fileno() is called 10 times.
+if support.check_impl_detail(cpython=True):
+self.assertEqual(len(result[1]), 5)
+self.assertEqual(len(a), 5)
+if support.check_impl_detail(pypy=True):
+self.assertEqual(len(result[1]), 10)
+self.assertEqual(len(a), 0)
 
 def test_main():
 support.run_unittest(SelectTestCase)
diff --git a/lib_pypy/_curses.py b/lib_pypy/_curses.py
--- a/lib_pypy/_curses.py
+++ b/lib_pypy/_curses.py
@@ -286,6 +286,13 @@
 
 
 lib = ffi.verify(
+#ifdef __APPLE__
+/* the following define is necessary for OS X 10.6+; without it, the
+   Apple-supplied ncurses.h sets NCURSES_OPAQUE to 1, and then Python
+   can't get at the WINDOW flags field. */
+#define NCURSES_OPAQUE 0
+#endif
+
 #include ncurses.h
 #include panel.h
 #include term.h
diff --git a/pypy/doc/how-to-release.rst b/pypy/doc/how-to-release.rst
--- a/pypy/doc/how-to-release.rst
+++ b/pypy/doc/how-to-release.rst
@@ -38,14 +38,16 @@
 no JIT: windows, linux, os/x
 sandbox: linux, os/x
 
+* 

[pypy-commit] pypy py3k: adapt 4e6dddc6d1ed 688d9d295fc2 to py3

2014-10-16 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3k
Changeset: r73982:6da0c1a2109a
Date: 2014-10-16 16:50 -0700
http://bitbucket.org/pypy/pypy/changeset/6da0c1a2109a/

Log:adapt 4e6dddc6d1ed  688d9d295fc2 to py3

diff --git a/lib-python/3/test/test_select.py b/lib-python/3/test/test_select.py
--- a/lib-python/3/test/test_select.py
+++ b/lib-python/3/test/test_select.py
@@ -57,7 +57,17 @@
 del a[-1]
 return sys.__stdout__.fileno()
 a[:] = [F()] * 10
-self.assertEqual(select.select([], a, []), ([], a[:5], []))
+result = select.select([], a, [])
+# CPython: 'a' ends up with 5 items, because each fileno()
+# removes an item and at the middle the iteration stops.
+# PyPy: 'a' ends up empty, because the iteration is done on
+# a copy of the original list: fileno() is called 10 times.
+if support.check_impl_detail(cpython=True):
+self.assertEqual(len(result[1]), 5)
+self.assertEqual(len(a), 5)
+if support.check_impl_detail(pypy=True):
+self.assertEqual(len(result[1]), 10)
+self.assertEqual(len(a), 0)
 
 def test_main():
 support.run_unittest(SelectTestCase)
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: adjust per the new pypy3 exe name

2014-10-16 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3k
Changeset: r73981:5ac508b99502
Date: 2014-10-16 16:50 -0700
http://bitbucket.org/pypy/pypy/changeset/5ac508b99502/

Log:adjust per the new pypy3 exe name

diff --git a/pypy/tool/release/test/test_package.py 
b/pypy/tool/release/test/test_package.py
--- a/pypy/tool/release/test/test_package.py
+++ b/pypy/tool/release/test/test_package.py
@@ -1,4 +1,4 @@
-
+import os
 import py
 from pypy.conftest import pypydir
 from pypy.tool.release import package, package
@@ -13,12 +13,12 @@
 exe_name_in_archive = 'pypy-c.exe'
 else:
 basename = 'pypy-c'
-rename_pypy_c = 'pypy'
-exe_name_in_archive = 'bin/pypy'
+rename_pypy_c = package.POSIX_EXE
+exe_name_in_archive = os.path.join('bin', package.POSIX_EXE)
 pypy_c = py.path.local(pypydir).join('goal', basename)
 if not pypy_c.check():
 if sys.platform == 'win32':
-import os, shutil
+import shutil
 for d in os.environ['PATH'].split(';'):
 if os.path.exists(os.path.join(d, 'cmd.exe')):
 shutil.copy(os.path.join(d, 'cmd.exe'), str(pypy_c))
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: issue1891: Struct's format field should be bytes

2014-10-15 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3k
Changeset: r73967:adcf560c634b
Date: 2014-10-15 11:15 -0700
http://bitbucket.org/pypy/pypy/changeset/adcf560c634b/

Log:issue1891: Struct's format field should be bytes

diff --git a/pypy/module/struct/interp_struct.py 
b/pypy/module/struct/interp_struct.py
--- a/pypy/module/struct/interp_struct.py
+++ b/pypy/module/struct/interp_struct.py
@@ -6,7 +6,8 @@
 from pypy.interpreter.baseobjspace import W_Root
 from pypy.interpreter.gateway import interp2app, unwrap_spec
 from pypy.interpreter.error import OperationError, oefmt
-from pypy.interpreter.typedef import TypeDef, interp_attrproperty
+from pypy.interpreter.typedef import (
+TypeDef, interp_attrproperty, interp_attrproperty_bytes)
 from pypy.module.struct.formatiterator import (
 PackFormatIterator, UnpackFormatIterator
 )
@@ -136,7 +137,7 @@
 
 W_Struct.typedef = TypeDef(Struct,
 __new__=interp2app(W_Struct.descr__new__.im_func),
-format=interp_attrproperty(format, cls=W_Struct),
+format=interp_attrproperty_bytes(format, cls=W_Struct),
 size=interp_attrproperty(size, cls=W_Struct),
 
 pack=interp2app(W_Struct.descr_pack),
diff --git a/pypy/module/struct/test/test_struct.py 
b/pypy/module/struct/test/test_struct.py
--- a/pypy/module/struct/test/test_struct.py
+++ b/pypy/module/struct/test/test_struct.py
@@ -405,6 +405,10 @@
 assert s.unpack(s.pack(42)) == (42,)
 assert s.unpack_from(memoryview(s.pack(42))) == (42,)
 
+def test_struct_object_attrib(self):
+s = self.struct.Struct('i')
+assert s.format == b'i'
+
 def test_trailing_counter(self):
 import array
 store = array.array('b', b' '*100)
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy pypy3-release-2.4.x: issue1891: Struct's format field should be bytes

2014-10-15 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: pypy3-release-2.4.x
Changeset: r73968:b987bd35c886
Date: 2014-10-15 11:15 -0700
http://bitbucket.org/pypy/pypy/changeset/b987bd35c886/

Log:issue1891: Struct's format field should be bytes (grafted from
adcf560c634b06ec87915ca9a811daca81c72c7d)

diff --git a/pypy/module/struct/interp_struct.py 
b/pypy/module/struct/interp_struct.py
--- a/pypy/module/struct/interp_struct.py
+++ b/pypy/module/struct/interp_struct.py
@@ -6,7 +6,8 @@
 from pypy.interpreter.baseobjspace import W_Root
 from pypy.interpreter.gateway import interp2app, unwrap_spec
 from pypy.interpreter.error import OperationError, oefmt
-from pypy.interpreter.typedef import TypeDef, interp_attrproperty
+from pypy.interpreter.typedef import (
+TypeDef, interp_attrproperty, interp_attrproperty_bytes)
 from pypy.module.struct.formatiterator import (
 PackFormatIterator, UnpackFormatIterator
 )
@@ -136,7 +137,7 @@
 
 W_Struct.typedef = TypeDef(Struct,
 __new__=interp2app(W_Struct.descr__new__.im_func),
-format=interp_attrproperty(format, cls=W_Struct),
+format=interp_attrproperty_bytes(format, cls=W_Struct),
 size=interp_attrproperty(size, cls=W_Struct),
 
 pack=interp2app(W_Struct.descr_pack),
diff --git a/pypy/module/struct/test/test_struct.py 
b/pypy/module/struct/test/test_struct.py
--- a/pypy/module/struct/test/test_struct.py
+++ b/pypy/module/struct/test/test_struct.py
@@ -405,6 +405,10 @@
 assert s.unpack(s.pack(42)) == (42,)
 assert s.unpack_from(memoryview(s.pack(42))) == (42,)
 
+def test_struct_object_attrib(self):
+s = self.struct.Struct('i')
+assert s.format == b'i'
+
 def test_trailing_counter(self):
 import array
 store = array.array('b', b' '*100)
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] buildbot default: handle the new pypy3 binary name

2014-10-15 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: 
Changeset: r921:a768fa781d1b
Date: 2014-10-15 11:34 -0700
http://bitbucket.org/pypy/buildbot/changeset/a768fa781d1b/

Log:handle the new pypy3 binary name

diff --git a/bot2/pypybuildbot/builds.py b/bot2/pypybuildbot/builds.py
--- a/bot2/pypybuildbot/builds.py
+++ b/bot2/pypybuildbot/builds.py
@@ -556,9 +556,12 @@
 haltOnFailure=True,
 workdir='.'))
 # copy pypy-c to the expected location within the pypy source checkout
+command = ('PYPY_C=pypy-c/bin/pypy;'
+   'if [ -e pypy-c/bin/pypy3 ]; then 
PYPY_C=pypy-c/bin/pypy3; fi;'
+   'cp -v $PYPY_C build/pypy/goal/pypy-c;')
 self.addStep(ShellCmd(
 description=move pypy-c,
-command=['cp', '-v', 'pypy-c/bin/pypy', 'build/pypy/goal/pypy-c'],
+command=command,
 haltOnFailure=True,
 workdir='.'))
 # copy generated and copied header files to build/include
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: fix the comment

2014-10-14 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: 
Changeset: r73956:81bf451b99f2
Date: 2014-10-13 17:42 -0700
http://bitbucket.org/pypy/pypy/changeset/81bf451b99f2/

Log:fix the comment

diff --git a/rpython/rtyper/module/ll_os.py b/rpython/rtyper/module/ll_os.py
--- a/rpython/rtyper/module/ll_os.py
+++ b/rpython/rtyper/module/ll_os.py
@@ -1179,7 +1179,7 @@
  condition=sys.platform=='win32')
 def register_posix__getfullpathname(self, traits):
 # this nt function is not exposed via os, but needed
-# to get a correct implementation of os.abspath
+# to get a correct implementation of os.path.abspath
 from rpython.rtyper.module.ll_win32file import 
make_getfullpathname_impl
 getfullpathname_llimpl = make_getfullpathname_impl(traits)
 
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: merge upstream

2014-10-14 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: 
Changeset: r73957:5b2a4468b724
Date: 2014-10-14 12:11 -0700
http://bitbucket.org/pypy/pypy/changeset/5b2a4468b724/

Log:merge upstream

diff --git a/pypy/objspace/std/bytearrayobject.py 
b/pypy/objspace/std/bytearrayobject.py
--- a/pypy/objspace/std/bytearrayobject.py
+++ b/pypy/objspace/std/bytearrayobject.py
@@ -4,6 +4,7 @@
 import_from_mixin, newlist_hint, resizelist_hint, specialize)
 from rpython.rlib.buffer import Buffer
 from rpython.rlib.rstring import StringBuilder, ByteListBuilder
+from rpython.rlib.debug import check_list_of_chars
 
 from pypy.interpreter.baseobjspace import W_Root
 from pypy.interpreter.error import OperationError, oefmt
@@ -22,6 +23,7 @@
 import_from_mixin(StringMethods)
 
 def __init__(self, data):
+check_list_of_chars(data)
 self.data = data
 
 def __repr__(self):
diff --git a/rpython/config/translationoption.py 
b/rpython/config/translationoption.py
--- a/rpython/config/translationoption.py
+++ b/rpython/config/translationoption.py
@@ -53,7 +53,7 @@
  cmdline=-b --backend),
 
 BoolOption(shared, Build as a shared library,
-   default=False, cmdline=--shared),
+   default=True, cmdline=--shared),
 
 BoolOption(log, Include debug prints in the translation (PYPYLOG=...),
default=True, cmdline=--log),
diff --git a/rpython/jit/backend/llsupport/gc.py 
b/rpython/jit/backend/llsupport/gc.py
--- a/rpython/jit/backend/llsupport/gc.py
+++ b/rpython/jit/backend/llsupport/gc.py
@@ -548,12 +548,6 @@
 type_id = self.layoutbuilder.get_type_id(A)
 descr.tid = llop.combine_ushort(lltype.Signed, type_id, 0)
 
-def _set_tid(self, gcptr, tid):
-hdr_addr = llmemory.cast_ptr_to_adr(gcptr)
-hdr_addr -= self.gcheaderbuilder.size_gc_header
-hdr = llmemory.cast_adr_to_ptr(hdr_addr, self.HDRPTR)
-hdr.tid = tid
-
 def can_use_nursery_malloc(self, size):
 return size  self.max_size_of_young_obj
 
diff --git a/rpython/rlib/debug.py b/rpython/rlib/debug.py
--- a/rpython/rlib/debug.py
+++ b/rpython/rlib/debug.py
@@ -383,3 +383,35 @@
 def specialize_call(self, hop):
 hop.exception_cannot_occur()
 return hop.inputarg(hop.args_r[0], arg=0)
+
+def check_list_of_chars(l):
+if not we_are_translated():
+assert isinstance(l, list)
+for x in l:
+assert isinstance(x, (unicode, str)) and len(x) == 1
+return l
+
+class NotAListOfChars(Exception):
+pass
+
+class Entry(ExtRegistryEntry):
+_about_ = check_list_of_chars
+
+def compute_result_annotation(self, s_arg):
+from rpython.annotator.model import SomeList, s_None
+from rpython.annotator.model import SomeChar, SomeUnicodeCodePoint
+from rpython.annotator.model import SomeImpossibleValue
+if s_None.contains(s_arg):
+return s_arg# only None: just return
+assert isinstance(s_arg, SomeList)
+if not isinstance(
+s_arg.listdef.listitem.s_value,
+(SomeChar, SomeUnicodeCodePoint, SomeImpossibleValue)):
+raise NotAListOfChars
+return s_arg
+
+def specialize_call(self, hop):
+hop.exception_cannot_occur()
+return hop.inputarg(hop.args_r[0], arg=0)
+
+
diff --git a/rpython/rlib/test/test_debug.py b/rpython/rlib/test/test_debug.py
--- a/rpython/rlib/test/test_debug.py
+++ b/rpython/rlib/test/test_debug.py
@@ -4,7 +4,9 @@
  debug_print, debug_start, debug_stop,
  have_debug_prints, debug_offset, debug_flush,
  check_nonneg, IntegerCanBeNegative,
- mark_dict_non_null)
+ mark_dict_non_null,
+ check_list_of_chars,
+ NotAListOfChars)
 from rpython.rlib import debug
 from rpython.rtyper.test.test_llinterp import interpret, gengraph
 
@@ -72,6 +74,26 @@
 assert 
sorted(graph.returnblock.inputargs[0].concretetype.TO.entries.TO.OF._flds.keys())
 == ['key', 'value']
 
 
+def test_check_list_of_chars():
+def f(x):
+result = []
+check_list_of_chars(result)
+result = [chr(x), 'a']
+check_list_of_chars(result)
+result = [unichr(x)]
+check_list_of_chars(result)
+return result
+
+interpret(f, [3])
+
+def g(x):
+result = ['a', 'b', 'c', '']
+check_list_of_chars(result)
+return x
+
+py.test.raises(NotAListOfChars, interpret(g, [3]))
+
+
 class DebugTests(object):
 
 def test_debug_print_start_stop(self):
diff --git a/rpython/translator/platform/posix.py 
b/rpython/translator/platform/posix.py
--- a/rpython/translator/platform/posix.py
+++ b/rpython/translator/platform/posix.py
@@ -182,7 +182,7 @@
'int main(int argc, char* argv[]) '
'{ return 

[pypy-commit] pypy py3k: this workaround is no longer needed

2014-10-14 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3k
Changeset: r73959:c377769fa159
Date: 2014-10-14 12:51 -0700
http://bitbucket.org/pypy/pypy/changeset/c377769fa159/

Log:this workaround is no longer needed

diff --git a/rpython/rtyper/lltypesystem/ll2ctypes.py 
b/rpython/rtyper/lltypesystem/ll2ctypes.py
--- a/rpython/rtyper/lltypesystem/ll2ctypes.py
+++ b/rpython/rtyper/lltypesystem/ll2ctypes.py
@@ -361,9 +361,7 @@
 functype = ctypes.CFUNCTYPE
 if sys.platform == 'win32':
 from rpython.rlib.clibffi import FFI_STDCALL, FFI_DEFAULT_ABI
-# XXX:
-#if getattr(T.TO, 'ABI', FFI_DEFAULT_ABI) == FFI_STDCALL:
-if getattr(T.TO, 'ABI', FFI_DEFAULT_ABI) == 'FFI_STDCALL':
+if getattr(T.TO, 'ABI', FFI_DEFAULT_ABI) == FFI_STDCALL:
 # for win32 system call
 functype = ctypes.WINFUNCTYPE
 argtypes = [get_ctypes_type(ARG) for ARG in T.TO.ARGS
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: move the py3 specific _getfileinformation/_getfinalpathname out of rpython

2014-10-14 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3k
Changeset: r73960:906383ab46d1
Date: 2014-10-14 12:51 -0700
http://bitbucket.org/pypy/pypy/changeset/906383ab46d1/

Log:move the py3 specific _getfileinformation/_getfinalpathname out of
rpython

diff --git a/pypy/module/posix/interp_nt.py b/pypy/module/posix/interp_nt.py
new file mode 100644
--- /dev/null
+++ b/pypy/module/posix/interp_nt.py
@@ -0,0 +1,130 @@
+from rpython.rlib import rwin32
+from rpython.rtyper.lltypesystem import lltype, rffi
+from rpython.rtyper.module.ll_win32file import make_win32_traits
+from rpython.rtyper.module.support import UnicodeTraits
+from rpython.translator.tool.cbuild import ExternalCompilationInfo
+
+
+# XXX: pypy_GetFinalPathNameByHandle is needed to call the dynamically
+# found GetFinalPathNameByHandle function with a non-standard calling
+# convention. currently FuncType pointer calls w/ non-standard calling
+# conventions don't work after translation
+separate_module_source = \
+DWORD
+pypy_GetFinalPathNameByHandle(FARPROC address, HANDLE hFile,
+  LPTSTR lpszFilePath, DWORD cchFilePath,
+  DWORD dwFlags) {
+DWORD (WINAPI *func)(HANDLE, LPTSTR, DWORD, DWORD);
+*(FARPROC*)func = address;
+return func(hFile, lpszFilePath, cchFilePath, dwFlags);
+}
+
+eci = ExternalCompilationInfo(
+includes=['windows.h'],
+separate_module_sources=[separate_module_source],
+export_symbols=['pypy_GetFinalPathNameByHandle']
+)
+pypy_GetFinalPathNameByHandle = rffi.llexternal(
+'pypy_GetFinalPathNameByHandle',
+[rffi.VOIDP, rwin32.HANDLE, rffi.CWCHARP, rwin32.DWORD, rwin32.DWORD],
+rwin32.DWORD, compilation_info=eci)
+
+
+# plain NotImplementedError is invalid RPython
+class LLNotImplemented(NotImplementedError):
+
+def __init__(self, msg):
+self.msg = msg
+
+
+def make_traits(traits):
+win32traits = make_win32_traits(traits)
+
+class NTTraits(win32traits):
+
+GetFinalPathNameByHandle_HANDLE = lltype.nullptr(rffi.VOIDP.TO)
+
+def check_GetFinalPathNameByHandle(self):
+if (self.GetFinalPathNameByHandle_HANDLE !=
+lltype.nullptr(rffi.VOIDP.TO)):
+return True
+
+from rpython.rlib.rdynload import GetModuleHandle, dlsym
+hKernel32 = GetModuleHandle(KERNEL32)
+try:
+func = dlsym(hKernel32, 'GetFinalPathNameByHandleW')
+except KeyError:
+return False
+
+self.GetFinalPathNameByHandle_HANDLE = func
+return True
+
+def GetFinalPathNameByHandle(self, *args):
+assert (self.GetFinalPathNameByHandle_HANDLE !=
+lltype.nullptr(rffi.VOIDP.TO))
+return pypy_GetFinalPathNameByHandle(
+self.GetFinalPathNameByHandle_HANDLE, *args)
+
+return NTTraits()
+
+
+def make__getfileinformation_impl(traits):
+win32traits = make_traits(traits)
+
+def _getfileinformation_llimpl(fd):
+hFile = rwin32.get_osfhandle(fd)
+with lltype.scoped_alloc(
+win32traits.BY_HANDLE_FILE_INFORMATION) as info:
+if win32traits.GetFileInformationByHandle(hFile, info) == 0:
+raise rwin32.lastWindowsError(_getfileinformation)
+return (rffi.cast(lltype.Signed, info.c_dwVolumeSerialNumber),
+rffi.cast(lltype.Signed, info.c_nFileIndexHigh),
+rffi.cast(lltype.Signed, info.c_nFileIndexLow))
+
+return _getfileinformation_llimpl
+
+
+def make__getfinalpathname_impl(traits):
+assert traits.str is unicode, 'Currently only handles unicode paths'
+win32traits = make_traits(traits)
+
+def _getfinalpathname_llimpl(path):
+if not win32traits.check_GetFinalPathNameByHandle():
+raise LLNotImplemented(GetFinalPathNameByHandle not available on 
+   this platform)
+
+hFile = win32traits.CreateFile(path, 0, 0, None,
+   win32traits.OPEN_EXISTING,
+   win32traits.FILE_FLAG_BACKUP_SEMANTICS,
+   rwin32.NULL_HANDLE)
+if hFile == rwin32.INVALID_HANDLE_VALUE:
+raise rwin32.lastWindowsError(CreateFile)
+
+VOLUME_NAME_DOS = rffi.cast(rwin32.DWORD, win32traits.VOLUME_NAME_DOS)
+try:
+usize = win32traits.GetFinalPathNameByHandle(
+hFile,
+lltype.nullptr(traits.CCHARP.TO),
+rffi.cast(rwin32.DWORD, 0),
+VOLUME_NAME_DOS)
+if usize == 0:
+raise rwin32.lastWindowsError(GetFinalPathNameByHandle)
+
+size = rffi.cast(lltype.Signed, usize)
+with rffi.scoped_alloc_unicodebuffer(size + 1) as buf:
+result = win32traits.GetFinalPathNameByHandle(
+hFile,
+

[pypy-commit] pypy py3k: adapt to py3

2014-10-14 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3k
Changeset: r73963:2aea62c472fb
Date: 2014-10-14 16:01 -0700
http://bitbucket.org/pypy/pypy/changeset/2aea62c472fb/

Log:adapt to py3

diff --git a/pypy/module/_winreg/interp_winreg.py 
b/pypy/module/_winreg/interp_winreg.py
--- a/pypy/module/_winreg/interp_winreg.py
+++ b/pypy/module/_winreg/interp_winreg.py
@@ -266,9 +266,7 @@
 buf = None
 
 if typ == rwinreg.REG_DWORD:
-if space.is_none(w_value) or (
-space.isinstance_w(w_value, space.w_int) or
-space.isinstance_w(w_value, space.w_long)):
+if space.is_none(w_value) or space.isinstance_w(w_value, space.w_int):
 if space.is_none(w_value):
 value = r_uint(0)
 else:
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: skip this for now

2014-10-13 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3k
Changeset: r73924:40f3c198b07e
Date: 2014-10-13 10:53 -0700
http://bitbucket.org/pypy/pypy/changeset/40f3c198b07e/

Log:skip this for now

diff --git a/pypy/module/_pypyjson/test/test__pypyjson.py 
b/pypy/module/_pypyjson/test/test__pypyjson.py
--- a/pypy/module/_pypyjson/test/test__pypyjson.py
+++ b/pypy/module/_pypyjson/test/test__pypyjson.py
@@ -190,6 +190,7 @@
 raises(ValueError, _pypyjson.loads(s))
 
 def test_raw_encode_basestring_ascii(self):
+py3k_skip(XXX: needs porting to py3k)
 import _pypyjson
 def check(s):
 s = _pypyjson.raw_encode_basestring_ascii(s)
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: issue1796: mimic CPython's binary naming (along the lines of PEP394), make it

2014-10-13 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3k
Changeset: r73925:01b209cd50a3
Date: 2014-10-13 11:10 -0700
http://bitbucket.org/pypy/pypy/changeset/01b209cd50a3/

Log:issue1796: mimic CPython's binary naming (along the lines of
PEP394), make it 'pypy3.2' on posix w/ a 'pypy3' symlink, and keep
it as pypy.exe on Windows for now

diff --git a/pypy/tool/release/package.py b/pypy/tool/release/package.py
--- a/pypy/tool/release/package.py
+++ b/pypy/tool/release/package.py
@@ -26,6 +26,9 @@
 
 STDLIB_VER = 3
 
+# XXX: don't hardcode the version
+POSIX_EXE = 'pypy3.2'
+
 def ignore_patterns(*patterns):
 Function that can be used as copytree() ignore parameter.
 
@@ -251,6 +254,14 @@
 for source, target in binaries:
 archive = bindir.join(target)
 shutil.copy(str(source), str(archive))
+if not sys.platform == 'win32':
+# create the pypy3 symlink
+old_dir = os.getcwd()
+os.chdir(str(bindir))
+try:
+os.symlink(POSIX_EXE, 'pypy3')
+finally:
+os.chdir(old_dir)
 fix_permissions(builddir)
 
 old_dir = os.getcwd()
@@ -306,7 +317,7 @@
 import imp
 argparse = imp.load_source('argparse', 'lib-python/2.7/argparse.py')
 if sys.platform == 'win32':
-pypy_exe = 'pypy3.exe'
+pypy_exe = 'pypy.exe'
 for p in [os.path.join(basedir, r'..\..\..\local'), #buildbot
 os.path.join(basedir, r'..\local')]: # pypy/doc/windows.rst
 if os.path.exists(p): 
@@ -315,7 +326,7 @@
 else:
 license_base = 'unkown'
 else:
-pypy_exe = 'pypy3'
+pypy_exe = POSIX_EXE
 license_base = '/usr/share/doc'
 parser = argparse.ArgumentParser()
 args = list(args)
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: issue1884: kill PyInt_*

2014-10-13 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3k
Changeset: r73929:83c6e78c4f7d
Date: 2014-10-13 14:51 -0700
http://bitbucket.org/pypy/pypy/changeset/83c6e78c4f7d/

Log:issue1884: kill PyInt_*

diff --git a/pypy/module/cpyext/intobject.py b/pypy/module/cpyext/intobject.py
deleted file mode 100644
--- a/pypy/module/cpyext/intobject.py
+++ /dev/null
@@ -1,162 +0,0 @@
-
-from rpython.rtyper.lltypesystem import rffi, lltype
-from pypy.interpreter.error import OperationError
-from pypy.module.cpyext.api import (
-cpython_api, cpython_struct, build_type_checkers, bootstrap_function,
-PyObject, PyObjectFields, CONST_STRING, CANNOT_FAIL, Py_ssize_t)
-from pypy.module.cpyext.pyobject import (
-make_typedescr, track_reference, RefcountState, from_ref)
-from rpython.rlib.rarithmetic import r_uint, intmask, LONG_TEST, r_ulonglong
-from pypy.objspace.std.intobject import W_IntObject
-import sys
-
-PyIntObjectStruct = lltype.ForwardReference()
-PyIntObject = lltype.Ptr(PyIntObjectStruct)
-PyIntObjectFields = PyObjectFields + \
-((ob_ival, rffi.LONG),)
-cpython_struct(PyIntObject, PyIntObjectFields, PyIntObjectStruct)
-
-@bootstrap_function
-def init_intobject(space):
-Type description of PyIntObject
-make_typedescr(space.w_int.instancetypedef,
-   basestruct=PyIntObject.TO,
-   attach=int_attach,
-   realize=int_realize)
-
-def int_attach(space, py_obj, w_obj):
-
-Fills a newly allocated PyIntObject with the given int object. The
-value must not be modified.
-
-py_int = rffi.cast(PyIntObject, py_obj)
-py_int.c_ob_ival = space.int_w(w_obj)
-
-def int_realize(space, obj):
-intval = rffi.cast(lltype.Signed, rffi.cast(PyIntObject, obj).c_ob_ival)
-w_type = from_ref(space, rffi.cast(PyObject, obj.c_ob_type))
-w_obj = space.allocate_instance(W_IntObject, w_type)
-w_obj.__init__(intval)
-track_reference(space, obj, w_obj)
-state = space.fromcache(RefcountState)
-state.set_lifeline(w_obj, obj)
-return w_obj
-
-PyInt_Check, PyInt_CheckExact = build_type_checkers(Int)
-
-@cpython_api([], lltype.Signed, error=CANNOT_FAIL)
-def PyInt_GetMax(space):
-Return the system's idea of the largest integer it can handle (LONG_MAX,
-as defined in the system header files).
-return sys.maxint
-
-@cpython_api([lltype.Signed], PyObject)
-def PyInt_FromLong(space, ival):
-Create a new integer object with a value of ival.
-
-
-return space.wrap(ival)
-
-@cpython_api([PyObject], lltype.Signed, error=-1)
-def PyInt_AsLong(space, w_obj):
-Will first attempt to cast the object to a PyIntObject, if it is not
-already one, and then return its value. If there is an error, -1 is
-returned, and the caller should check PyErr_Occurred() to find out whether
-there was an error, or whether the value just happened to be -1.
-if w_obj is None:
-raise OperationError(space.w_TypeError,
- space.wrap(an integer is required, got NULL))
-return space.int_w(space.int(w_obj))
-
-@cpython_api([PyObject], lltype.Unsigned, error=-1)
-def PyInt_AsUnsignedLong(space, w_obj):
-Return a C unsigned long representation of the contents of pylong.
-If pylong is greater than ULONG_MAX, an OverflowError is
-raised.
-if w_obj is None:
-raise OperationError(space.w_TypeError,
- space.wrap(an integer is required, got NULL))
-return space.uint_w(space.int(w_obj))
-
-
-@cpython_api([PyObject], rffi.ULONG, error=-1)
-def PyInt_AsUnsignedLongMask(space, w_obj):
-Will first attempt to cast the object to a PyIntObject or
-PyLongObject, if it is not already one, and then return its value as
-unsigned long.  This function does not check for overflow.
-
-w_int = space.int(w_obj)
-num = space.bigint_w(w_int)
-return num.uintmask()
-
-
-@cpython_api([PyObject], rffi.ULONGLONG, error=-1)
-def PyInt_AsUnsignedLongLongMask(space, w_obj):
-Will first attempt to cast the object to a PyIntObject or
-PyLongObject, if it is not already one, and then return its value as
-unsigned long long, without checking for overflow.
-
-w_int = space.int(w_obj)
-if space.isinstance_w(w_int, space.w_int):
-num = space.int_w(w_int)
-return r_ulonglong(num)
-else:
-num = space.bigint_w(w_int)
-return num.ulonglongmask()
-
-@cpython_api([PyObject], lltype.Signed, error=CANNOT_FAIL)
-def PyInt_AS_LONG(space, w_int):
-Return the value of the object w_int. No error checking is performed.
-return space.int_w(w_int)
-
-@cpython_api([PyObject], Py_ssize_t, error=-1)
-def PyInt_AsSsize_t(space, w_obj):
-Will first attempt to cast the object to a PyIntObject or
-PyLongObject, if it is not already one, and then return its value as
-Py_ssize_t.
-
-if w_obj is None:
-raise OperationError(space.w_TypeError,
-  

[pypy-commit] pypy py3k: issue1884, 1879: kill the py2 PyString*, PyNumber_Int PyBoolObject names

2014-10-13 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3k
Changeset: r73928:5b94a7c05348
Date: 2014-10-13 14:51 -0700
http://bitbucket.org/pypy/pypy/changeset/5b94a7c05348/

Log:issue1884, 1879: kill the py2 PyString*, PyNumber_Int  PyBoolObject
names

diff --git a/pypy/module/cpyext/api.py b/pypy/module/cpyext/api.py
--- a/pypy/module/cpyext/api.py
+++ b/pypy/module/cpyext/api.py
@@ -461,14 +461,13 @@
 # Common types with their own struct
 for cpyname, pypyexpr in {
 PyType_Type: space.w_type,
-PyString_Type: space.w_str,
+PyBytes_Type: space.w_bytes,
 PyUnicode_Type: space.w_unicode,
 PyDict_Type: space.w_dict,
 PyTuple_Type: space.w_tuple,
 PyList_Type: space.w_list,
 PySet_Type: space.w_set,
 PyFrozenSet_Type: space.w_frozenset,
-PyInt_Type: space.w_int,
 PyBool_Type: space.w_bool,
 PyFloat_Type: space.w_float,
 PyLong_Type: space.w_int,
diff --git a/pypy/module/cpyext/include/boolobject.h 
b/pypy/module/cpyext/include/boolobject.h
--- a/pypy/module/cpyext/include/boolobject.h
+++ b/pypy/module/cpyext/include/boolobject.h
@@ -7,8 +7,6 @@
 extern C {
 #endif
 
-#define PyBoolObject PyIntObject
-
 #define Py_False ((PyObject *) _Py_ZeroStruct)
 #define Py_True ((PyObject *) _Py_TrueStruct)
 
diff --git a/pypy/module/cpyext/number.py b/pypy/module/cpyext/number.py
--- a/pypy/module/cpyext/number.py
+++ b/pypy/module/cpyext/number.py
@@ -38,12 +38,6 @@
 return space.int_w(w_obj) #XXX: this is wrong on win64
 
 @cpython_api([PyObject], PyObject)
-def PyNumber_Int(space, w_obj):
-Returns the o converted to an integer object on success, or NULL on 
failure.
-This is the equivalent of the Python expression int(o).
-return space.call_function(space.w_int, w_obj)
-
-@cpython_api([PyObject], PyObject)
 def PyNumber_Long(space, w_obj):
 Returns the o converted to a long integer object on success, or NULL on
 failure.  This is the equivalent of the Python expression long(o).
diff --git a/pypy/module/cpyext/test/test_number.py 
b/pypy/module/cpyext/test/test_number.py
--- a/pypy/module/cpyext/test/test_number.py
+++ b/pypy/module/cpyext/test/test_number.py
@@ -20,14 +20,14 @@
 w_l = api.PyNumber_Long(space.wrap(123))
 assert api.PyLong_CheckExact(w_l)
 
-def test_number_int(self, space, api):
-w_l = api.PyNumber_Int(space.wraplong(123L))
+def test_number_long2(self, space, api):
+w_l = api.PyNumber_Long(space.wraplong(123L))
 assert api.PyLong_CheckExact(w_l)
-w_l = api.PyNumber_Int(space.wrap(2  65))
+w_l = api.PyNumber_Long(space.wrap(2  65))
 assert api.PyLong_CheckExact(w_l)
-w_l = api.PyNumber_Int(space.wrap(42.3))
+w_l = api.PyNumber_Long(space.wrap(42.3))
 assert api.PyLong_CheckExact(w_l)
-w_l = api.PyNumber_Int(space.wrap(42))
+w_l = api.PyNumber_Long(space.wrap(42))
 assert api.PyLong_CheckExact(w_l)
 
 def test_number_index(self, space, api):
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: issue1883: add PyUnicode_InternFromString

2014-10-13 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3k
Changeset: r73930:bd8819a48208
Date: 2014-10-13 14:52 -0700
http://bitbucket.org/pypy/pypy/changeset/bd8819a48208/

Log:issue1883: add PyUnicode_InternFromString

diff --git a/pypy/module/cpyext/test/test_unicodeobject.py 
b/pypy/module/cpyext/test/test_unicodeobject.py
--- a/pypy/module/cpyext/test/test_unicodeobject.py
+++ b/pypy/module/cpyext/test/test_unicodeobject.py
@@ -219,6 +219,13 @@
 assert space.unwrap(w_res) == u'sp#65533;'
 rffi.free_charp(s)
 
+def test_internfromstring(self, space, api):
+with rffi.scoped_str2charp('foo') as s:
+w_res = api.PyUnicode_InternFromString(s)
+assert space.unwrap(w_res) == u'foo'
+w_res2 = api.PyUnicode_InternFromString(s)
+assert w_res is w_res2
+
 def test_unicode_resize(self, space, api):
 py_uni = new_empty_unicode(space, 10)
 ar = lltype.malloc(PyObjectP.TO, 1, flavor='raw')
diff --git a/pypy/module/cpyext/unicodeobject.py 
b/pypy/module/cpyext/unicodeobject.py
--- a/pypy/module/cpyext/unicodeobject.py
+++ b/pypy/module/cpyext/unicodeobject.py
@@ -508,6 +508,16 @@
 w_str = space.wrapbytes(rffi.charp2str(s))
 return space.call_method(w_str, 'decode', space.wrap(utf-8))
 
+@cpython_api([CONST_STRING], PyObject)
+def PyUnicode_InternFromString(space, s):
+A combination of PyUnicode_FromString() and
+PyUnicode_InternInPlace(), returning either a new unicode string
+object that has been interned, or a new (owned) reference to an
+earlier interned string object with the same value.
+
+w_str = PyUnicode_FromString(space, s)
+return space.new_interned_w_str(w_str)
+
 @cpython_api([CONST_STRING, Py_ssize_t], PyObject)
 def PyUnicode_FromStringAndSize(space, s, size):
 Create a Unicode Object from the char buffer u. The bytes will be
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy pypy3-release-2.4.x: branch for pypy3-2.4.x release

2014-10-13 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: pypy3-release-2.4.x
Changeset: r73932:12b940544622
Date: 2014-10-13 15:57 -0700
http://bitbucket.org/pypy/pypy/changeset/12b940544622/

Log:branch for pypy3-2.4.x release

diff --git a/pypy/module/cpyext/include/patchlevel.h 
b/pypy/module/cpyext/include/patchlevel.h
--- a/pypy/module/cpyext/include/patchlevel.h
+++ b/pypy/module/cpyext/include/patchlevel.h
@@ -29,7 +29,7 @@
 #define PY_VERSION 3.2.5
 
 /* PyPy version as a string */
-#define PYPY_VERSION 2.5.0-alpha0
+#define PYPY_VERSION 2.4.0
 
 /* Subversion Revision number of this file (not of the repository).
  * Empty since Mercurial migration. */
diff --git a/pypy/module/sys/version.py b/pypy/module/sys/version.py
--- a/pypy/module/sys/version.py
+++ b/pypy/module/sys/version.py
@@ -10,7 +10,7 @@
 #XXX # sync CPYTHON_VERSION with patchlevel.h, package.py
 CPYTHON_API_VERSION= 1013   #XXX # sync with include/modsupport.h
 
-PYPY_VERSION   = (2, 5, 0, alpha, 0)#XXX # sync patchlevel.h
+PYPY_VERSION   = (2, 4, 0, final, 0)#XXX # sync patchlevel.h
 
 if platform.name == 'msvc':
 COMPILER_INFO = 'MSC v.%d 32 bit' % (platform.version * 10 + 600)
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: pypy3-2.4.0 release notes/what's new

2014-10-13 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3k
Changeset: r73933:3f967c2be00e
Date: 2014-10-13 15:58 -0700
http://bitbucket.org/pypy/pypy/changeset/3f967c2be00e/

Log:pypy3-2.4.0 release notes/what's new (grafted from
b11ca344e9fb4a7c673626200caeef85546ae1b2)

diff --git a/pypy/doc/release-pypy3-2.4.0.rst b/pypy/doc/release-pypy3-2.4.0.rst
new file mode 100644
--- /dev/null
+++ b/pypy/doc/release-pypy3-2.4.0.rst
@@ -0,0 +1,126 @@
+=
+PyPy3 2.4 - Snow White
+=
+
+We're pleased to announce PyPy3 2.4, which contains significant performance
+enhancements and bug fixes.
+
+You can download the PyPy3 2.4.0 release here:
+
+http://pypy.org/download.html
+
+We would like to thank our donors for the continued support of the PyPy
+project, and for those who donate to our three sub-projects.
+We've shown quite a bit of progress, but we're slowly running out of funds.
+Please consider donating more, or even better convince your employer to donate,
+so we can finish those projects! The three sub-projects are:
+
+* `Py3k`_ (supporting Python 3.x): This is a Python 3.2.5 compatible
+   version we call PyPy3 2.4, and we are working toward a Python 3.3
+   compatible version
+
+* `STM`_ (software transactional memory): We have released a first working 
version,
+  and continue to try out new promising paths of achieving a fast 
multithreaded Python
+
+* `NumPy`_ which requires installation of our fork of upstream numpy,
+  available `on bitbucket`_
+
+.. _`Py3k`: http://pypy.org/py3donate.html
+.. _`STM`: http://pypy.org/tmdonate2.html
+.. _`NumPy`: http://pypy.org/numpydonate.html
+.. _`on bitbucket`: https://www.bitbucket.org/pypy/numpy
+
+What is PyPy?
+=
+
+PyPy is a very compliant Python interpreter, almost a drop-in replacement for
+CPython 2.7 or 3.2.5. It's fast (`pypy 2.4 and cpython 2.7.x`_ performance
+comparison) due to its integrated tracing JIT compiler.
+
+This release supports **x86** machines on most common operating systems
+(Linux 32/64, Mac OS X 64, Windows, and OpenBSD),
+as well as newer **ARM** hardware (ARMv6 or ARMv7, with VFPv3) running Linux.
+
+While we support 32 bit python on Windows, work on the native Windows 64
+bit python is still stalling, we would welcome a volunteer
+to `handle that`_.
+
+.. _`pypy 2.4 and cpython 2.7.x`: http://speed.pypy.org
+.. _`handle that`: 
http://doc.pypy.org/en/latest/windows.html#what-is-missing-for-a-full-64-bit-translation
+
+PyPy3 Highlights
+
+
+Issues reported with our previous release were fixed after reports from users 
on
+our new issue tracker at https://bitbucket.org/pypy/pypy/issues or on IRC at
+#pypy. Here is a summary of the user-facing PyPy3 specific changes:
+
+* Better Windows compatibility, e.g. the nt module functions _getfinalpathname
+   _getfileinformation are now supported (the former is required for the
+  popular pathlib library for example)
+
+* Various fsencode PEP 383 related fixes to the posix module (readlink, uname,
+  ttyname and ctermid) and improved locale handling
+
+* Switched default binary name os POSIX distributions to 'pypy3' (which
+  symlinks to to 'pypy3.2')
+
+* Fixed a couple different crashes related to parsing Python 3 source code
+
+Further Highlights (shared w/ PyPy2)
+
+
+Benchmarks improved after internal enhancements in string and
+bytearray handling, and a major rewrite of the GIL handling. This means
+that external calls are now a lot faster, especially the CFFI ones. It also
+means better performance in a lot of corner cases with handling strings or
+bytearrays. The main bugfix is handling of many socket objects in your
+program which in the long run used to leak memory.
+
+We fixed a memory leak in IO in the sandbox_ code
+
+We welcomed more than 12 new contributors, and conducted two Google
+Summer of Code projects, as well as other student projects not
+directly related to Summer of Code.
+
+* Reduced internal copying of bytearray operations
+
+* Tweak the internal structure of StringBuilder to speed up large string
+  handling, which becomes advantageous on large programs at the cost of 
slightly
+  slower small *benchmark* type programs.
+
+* Boost performance of thread-local variables in both unjitted and jitted code,
+  this mostly affects errno handling on linux, which makes external calls
+  faster.
+
+* Move to a mixed polling and mutex GIL model that make mutlithreaded jitted
+  code run *much* faster
+
+* Optimize errno handling in linux (x86 and x86-64 only)
+
+* Remove ctypes pythonapi and ctypes.PyDLL, which never worked on PyPy
+
+* Classes in the ast module are now distinct from structures used by
+  the compiler, which simplifies and speeds up translation of our
+  source code to the PyPy binary interpreter
+
+* Win32 now links statically to zlib, expat, bzip, and openssl-1.0.1i.
+  No more missing DLLs
+

[pypy-commit] pypy pypy3-release-2.4.x: merge py3k

2014-10-13 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: pypy3-release-2.4.x
Changeset: r73934:3abbe327bcf1
Date: 2014-10-13 15:59 -0700
http://bitbucket.org/pypy/pypy/changeset/3abbe327bcf1/

Log:merge py3k

diff --git a/pypy/doc/release-pypy3-2.4.0.rst b/pypy/doc/release-pypy3-2.4.0.rst
new file mode 100644
--- /dev/null
+++ b/pypy/doc/release-pypy3-2.4.0.rst
@@ -0,0 +1,126 @@
+=
+PyPy3 2.4 - Snow White
+=
+
+We're pleased to announce PyPy3 2.4, which contains significant performance
+enhancements and bug fixes.
+
+You can download the PyPy3 2.4.0 release here:
+
+http://pypy.org/download.html
+
+We would like to thank our donors for the continued support of the PyPy
+project, and for those who donate to our three sub-projects.
+We've shown quite a bit of progress, but we're slowly running out of funds.
+Please consider donating more, or even better convince your employer to donate,
+so we can finish those projects! The three sub-projects are:
+
+* `Py3k`_ (supporting Python 3.x): This is a Python 3.2.5 compatible
+   version we call PyPy3 2.4, and we are working toward a Python 3.3
+   compatible version
+
+* `STM`_ (software transactional memory): We have released a first working 
version,
+  and continue to try out new promising paths of achieving a fast 
multithreaded Python
+
+* `NumPy`_ which requires installation of our fork of upstream numpy,
+  available `on bitbucket`_
+
+.. _`Py3k`: http://pypy.org/py3donate.html
+.. _`STM`: http://pypy.org/tmdonate2.html
+.. _`NumPy`: http://pypy.org/numpydonate.html
+.. _`on bitbucket`: https://www.bitbucket.org/pypy/numpy
+
+What is PyPy?
+=
+
+PyPy is a very compliant Python interpreter, almost a drop-in replacement for
+CPython 2.7 or 3.2.5. It's fast (`pypy 2.4 and cpython 2.7.x`_ performance
+comparison) due to its integrated tracing JIT compiler.
+
+This release supports **x86** machines on most common operating systems
+(Linux 32/64, Mac OS X 64, Windows, and OpenBSD),
+as well as newer **ARM** hardware (ARMv6 or ARMv7, with VFPv3) running Linux.
+
+While we support 32 bit python on Windows, work on the native Windows 64
+bit python is still stalling, we would welcome a volunteer
+to `handle that`_.
+
+.. _`pypy 2.4 and cpython 2.7.x`: http://speed.pypy.org
+.. _`handle that`: 
http://doc.pypy.org/en/latest/windows.html#what-is-missing-for-a-full-64-bit-translation
+
+PyPy3 Highlights
+
+
+Issues reported with our previous release were fixed after reports from users 
on
+our new issue tracker at https://bitbucket.org/pypy/pypy/issues or on IRC at
+#pypy. Here is a summary of the user-facing PyPy3 specific changes:
+
+* Better Windows compatibility, e.g. the nt module functions _getfinalpathname
+   _getfileinformation are now supported (the former is required for the
+  popular pathlib library for example)
+
+* Various fsencode PEP 383 related fixes to the posix module (readlink, uname,
+  ttyname and ctermid) and improved locale handling
+
+* Switched default binary name os POSIX distributions to 'pypy3' (which
+  symlinks to to 'pypy3.2')
+
+* Fixed a couple different crashes related to parsing Python 3 source code
+
+Further Highlights (shared w/ PyPy2)
+
+
+Benchmarks improved after internal enhancements in string and
+bytearray handling, and a major rewrite of the GIL handling. This means
+that external calls are now a lot faster, especially the CFFI ones. It also
+means better performance in a lot of corner cases with handling strings or
+bytearrays. The main bugfix is handling of many socket objects in your
+program which in the long run used to leak memory.
+
+We fixed a memory leak in IO in the sandbox_ code
+
+We welcomed more than 12 new contributors, and conducted two Google
+Summer of Code projects, as well as other student projects not
+directly related to Summer of Code.
+
+* Reduced internal copying of bytearray operations
+
+* Tweak the internal structure of StringBuilder to speed up large string
+  handling, which becomes advantageous on large programs at the cost of 
slightly
+  slower small *benchmark* type programs.
+
+* Boost performance of thread-local variables in both unjitted and jitted code,
+  this mostly affects errno handling on linux, which makes external calls
+  faster.
+
+* Move to a mixed polling and mutex GIL model that make mutlithreaded jitted
+  code run *much* faster
+
+* Optimize errno handling in linux (x86 and x86-64 only)
+
+* Remove ctypes pythonapi and ctypes.PyDLL, which never worked on PyPy
+
+* Classes in the ast module are now distinct from structures used by
+  the compiler, which simplifies and speeds up translation of our
+  source code to the PyPy binary interpreter
+
+* Win32 now links statically to zlib, expat, bzip, and openssl-1.0.1i.
+  No more missing DLLs
+
+* Many issues were resolved_ since the 2.3.1 release in June
+
+.. 

[pypy-commit] pypy default: pypy3-2.4.0 release notes/what's new

2014-10-13 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: 
Changeset: r73931:b11ca344e9fb
Date: 2014-10-13 15:58 -0700
http://bitbucket.org/pypy/pypy/changeset/b11ca344e9fb/

Log:pypy3-2.4.0 release notes/what's new

diff --git a/pypy/doc/release-pypy3-2.4.0.rst b/pypy/doc/release-pypy3-2.4.0.rst
new file mode 100644
--- /dev/null
+++ b/pypy/doc/release-pypy3-2.4.0.rst
@@ -0,0 +1,126 @@
+=
+PyPy3 2.4 - Snow White
+=
+
+We're pleased to announce PyPy3 2.4, which contains significant performance
+enhancements and bug fixes.
+
+You can download the PyPy3 2.4.0 release here:
+
+http://pypy.org/download.html
+
+We would like to thank our donors for the continued support of the PyPy
+project, and for those who donate to our three sub-projects.
+We've shown quite a bit of progress, but we're slowly running out of funds.
+Please consider donating more, or even better convince your employer to donate,
+so we can finish those projects! The three sub-projects are:
+
+* `Py3k`_ (supporting Python 3.x): This is a Python 3.2.5 compatible
+   version we call PyPy3 2.4, and we are working toward a Python 3.3
+   compatible version
+
+* `STM`_ (software transactional memory): We have released a first working 
version,
+  and continue to try out new promising paths of achieving a fast 
multithreaded Python
+
+* `NumPy`_ which requires installation of our fork of upstream numpy,
+  available `on bitbucket`_
+
+.. _`Py3k`: http://pypy.org/py3donate.html
+.. _`STM`: http://pypy.org/tmdonate2.html
+.. _`NumPy`: http://pypy.org/numpydonate.html
+.. _`on bitbucket`: https://www.bitbucket.org/pypy/numpy
+
+What is PyPy?
+=
+
+PyPy is a very compliant Python interpreter, almost a drop-in replacement for
+CPython 2.7 or 3.2.5. It's fast (`pypy 2.4 and cpython 2.7.x`_ performance
+comparison) due to its integrated tracing JIT compiler.
+
+This release supports **x86** machines on most common operating systems
+(Linux 32/64, Mac OS X 64, Windows, and OpenBSD),
+as well as newer **ARM** hardware (ARMv6 or ARMv7, with VFPv3) running Linux.
+
+While we support 32 bit python on Windows, work on the native Windows 64
+bit python is still stalling, we would welcome a volunteer
+to `handle that`_.
+
+.. _`pypy 2.4 and cpython 2.7.x`: http://speed.pypy.org
+.. _`handle that`: 
http://doc.pypy.org/en/latest/windows.html#what-is-missing-for-a-full-64-bit-translation
+
+PyPy3 Highlights
+
+
+Issues reported with our previous release were fixed after reports from users 
on
+our new issue tracker at https://bitbucket.org/pypy/pypy/issues or on IRC at
+#pypy. Here is a summary of the user-facing PyPy3 specific changes:
+
+* Better Windows compatibility, e.g. the nt module functions _getfinalpathname
+   _getfileinformation are now supported (the former is required for the
+  popular pathlib library for example)
+
+* Various fsencode PEP 383 related fixes to the posix module (readlink, uname,
+  ttyname and ctermid) and improved locale handling
+
+* Switched default binary name os POSIX distributions to 'pypy3' (which
+  symlinks to to 'pypy3.2')
+
+* Fixed a couple different crashes related to parsing Python 3 source code
+
+Further Highlights (shared w/ PyPy2)
+
+
+Benchmarks improved after internal enhancements in string and
+bytearray handling, and a major rewrite of the GIL handling. This means
+that external calls are now a lot faster, especially the CFFI ones. It also
+means better performance in a lot of corner cases with handling strings or
+bytearrays. The main bugfix is handling of many socket objects in your
+program which in the long run used to leak memory.
+
+We fixed a memory leak in IO in the sandbox_ code
+
+We welcomed more than 12 new contributors, and conducted two Google
+Summer of Code projects, as well as other student projects not
+directly related to Summer of Code.
+
+* Reduced internal copying of bytearray operations
+
+* Tweak the internal structure of StringBuilder to speed up large string
+  handling, which becomes advantageous on large programs at the cost of 
slightly
+  slower small *benchmark* type programs.
+
+* Boost performance of thread-local variables in both unjitted and jitted code,
+  this mostly affects errno handling on linux, which makes external calls
+  faster.
+
+* Move to a mixed polling and mutex GIL model that make mutlithreaded jitted
+  code run *much* faster
+
+* Optimize errno handling in linux (x86 and x86-64 only)
+
+* Remove ctypes pythonapi and ctypes.PyDLL, which never worked on PyPy
+
+* Classes in the ast module are now distinct from structures used by
+  the compiler, which simplifies and speeds up translation of our
+  source code to the PyPy binary interpreter
+
+* Win32 now links statically to zlib, expat, bzip, and openssl-1.0.1i.
+  No more missing DLLs
+
+* Many issues were resolved_ since the 2.3.1 release in June
+
+.. 

[pypy-commit] pypy py3k: merge default

2014-10-13 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3k
Changeset: r73936:d971d572758b
Date: 2014-10-13 16:23 -0700
http://bitbucket.org/pypy/pypy/changeset/d971d572758b/

Log:merge default

diff too long, truncating to 2000 out of 13891 lines

diff --git a/LICENSE b/LICENSE
--- a/LICENSE
+++ b/LICENSE
@@ -3,8 +3,8 @@
 
 Except when otherwise stated (look for LICENSE files in directories or
 information at the beginning of each file) all software and documentation in
-the 'rpython', 'pypy', 'ctype_configure', 'dotviewer', 'demo', and 'lib_pypy'
-directories is licensed as follows: 
+the 'rpython', 'pypy', 'ctype_configure', 'dotviewer', 'demo', 'lib_pypy',
+'py', and '_pytest' directories is licensed as follows: 
 
 The MIT License
 
@@ -367,3 +367,43 @@
 Detailed license information is contained in the NOTICE file in the
 directory.
 
+
+Licenses and Acknowledgements for Incorporated Software
+===
+
+This section is an incomplete, but growing list of licenses and
+acknowledgements for third-party software incorporated in the PyPy
+distribution.
+
+License for 'Tcl/Tk'
+
+
+This copy of PyPy contains library code that may, when used, result in
+the Tcl/Tk library to be loaded.  PyPy also includes code that may be
+regarded as being a copy of some parts of the Tcl/Tk header files.
+You may see a copy of the License for Tcl/Tk in the file
+`lib_pypy/_tkinter/license.terms` included here.
+
+License for 'bzip2'
+---
+
+This copy of PyPy may be linked (dynamically or statically) with the
+bzip2 library.  You may see a copy of the License for bzip2/libbzip2 at
+
+http://www.bzip.org/1.0.5/bzip2-manual-1.0.5.html
+
+License for 'openssl'
+-
+
+This copy of PyPy may be linked (dynamically or statically) with the
+openssl library.  You may see a copy of the License for OpenSSL at
+
+https://www.openssl.org/source/license.html
+
+License for '_gdbm'
+--
+
+The _gdbm module includes code from gdbm.h, which is distributed under
+the terms of the GPL license version 2 or any later version.  Thus the
+_gdbm module, provided in the file lib_pypy/_gdbm.py, is redistributed
+under the terms of the GPL license as well.
diff --git a/lib-python/2.7/test/test_select.py 
b/lib-python/2.7/test/test_select.py
--- a/lib-python/2.7/test/test_select.py
+++ b/lib-python/2.7/test/test_select.py
@@ -57,7 +57,17 @@
 del a[-1]
 return sys.__stdout__.fileno()
 a[:] = [F()] * 10
-self.assertEqual(select.select([], a, []), ([], a[:5], []))
+result = select.select([], a, [])
+# CPython: 'a' ends up with 5 items, because each fileno()
+# removes an item and at the middle the iteration stops.
+# PyPy: 'a' ends up empty, because the iteration is done on
+# a copy of the original list: fileno() is called 10 times.
+if test_support.check_impl_detail(cpython=True):
+self.assertEqual(len(result[1]), 5)
+self.assertEqual(len(a), 5)
+if test_support.check_impl_detail(pypy=True):
+self.assertEqual(len(result[1]), 10)
+self.assertEqual(len(a), 0)
 
 def test_main():
 test_support.run_unittest(SelectTestCase)
diff --git a/lib_pypy/_curses.py b/lib_pypy/_curses.py
--- a/lib_pypy/_curses.py
+++ b/lib_pypy/_curses.py
@@ -286,6 +286,13 @@
 
 
 lib = ffi.verify(
+#ifdef __APPLE__
+/* the following define is necessary for OS X 10.6+; without it, the
+   Apple-supplied ncurses.h sets NCURSES_OPAQUE to 1, and then Python
+   can't get at the WINDOW flags field. */
+#define NCURSES_OPAQUE 0
+#endif
+
 #include ncurses.h
 #include panel.h
 #include term.h
diff --git a/pypy/doc/how-to-release.rst b/pypy/doc/how-to-release.rst
--- a/pypy/doc/how-to-release.rst
+++ b/pypy/doc/how-to-release.rst
@@ -38,14 +38,16 @@
 no JIT: windows, linux, os/x
 sandbox: linux, os/x
 
+* repackage and upload source tar.bz2 to bitbucket and to cobra, as some 
packagers 
+  prefer a clearly labeled source package
 * write release announcement pypy/doc/release-x.y(.z).txt
   the release announcement should contain a direct link to the download page
 * update pypy.org (under extradoc/pypy.org), rebuild and commit
 
 * post announcement on morepypy.blogspot.com
-* send announcements to pypy-dev, python-list,
+* send announcements to twitter.com, pypy-dev, python-list,
   python-announce, python-dev ...
 
 * add a tag on the pypy/jitviewer repo that corresponds to pypy release
 * add a tag on the codespeed web site that corresponds to pypy release
-
+* revise versioning at https://readthedocs.org/projects/pypy
diff --git a/pypy/doc/release-2.4.0.rst b/pypy/doc/release-2.4.0.rst
--- a/pypy/doc/release-2.4.0.rst
+++ b/pypy/doc/release-2.4.0.rst
@@ -5,7 +5,7 @@
 We're pleased to announce PyPy 2.4, which contains significant performance
 enhancements and bug fixes. 
 
-You can already 

[pypy-commit] pypy default: also handle surrogates when hosted on a narrow build

2014-10-13 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: 
Changeset: r73939:44eef64a93d7
Date: 2014-05-22 17:26 -0700
http://bitbucket.org/pypy/pypy/changeset/44eef64a93d7/

Log:also handle surrogates when hosted on a narrow build (grafted from
556155656b471613725c28fec6602117c714f661)

diff --git a/rpython/rlib/runicode.py b/rpython/rlib/runicode.py
--- a/rpython/rlib/runicode.py
+++ b/rpython/rlib/runicode.py
@@ -13,6 +13,7 @@
 MAXUNICODE = 0x
 allow_surrogate_by_default = True
 
+NARROW_HOST = not we_are_translated() and sys.maxunicode == 0x
 BYTEORDER = sys.byteorder
 
 # python 2.7 has a preview of py3k behavior, so those functions
@@ -65,7 +66,7 @@
 
 if MAXUNICODE  0x:
 def code_to_unichr(code):
-if not we_are_translated() and sys.maxunicode == 0x:
+if NARROW_HOST:
 # Host CPython is narrow build, generate surrogates
 return unichr_returns_surrogate(code)
 else:
@@ -336,7 +337,8 @@
 ch2 = ord(s[pos])
 # Check for low surrogate and combine the two to
 # form a UCS4 value
-if ((allow_surrogates or MAXUNICODE  65536) and
+if ((allow_surrogates or MAXUNICODE  65536
+ or NARROW_HOST) and
 ch = 0xDBFF and 0xDC00 = ch2 = 0xDFFF):
 ch3 = ((ch - 0xD800)  10 | (ch2 - 0xDC00)) + 
0x1
 pos += 1
@@ -1349,8 +1351,7 @@
 
 # The following logic is enabled only if MAXUNICODE == 0x, or
 # for testing on top of a host Python where sys.maxunicode == 
0x
-if ((MAXUNICODE  65536 or
-(not we_are_translated() and sys.maxunicode  65536))
+if ((MAXUNICODE  65536 or NARROW_HOST)
 and 0xD800 = oc  0xDC00 and pos + 1  size):
 # Map UTF-16 surrogate pairs to Unicode \U escapes
 pos += 1
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: oops, avoid we_are_translated at module scope

2014-10-13 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: 
Changeset: r73940:dfef5006402a
Date: 2014-05-27 13:07 -0700
http://bitbucket.org/pypy/pypy/changeset/dfef5006402a/

Log:oops, avoid we_are_translated at module scope (grafted from
9a4c6f4f53b6f320a2d1069f02923de4da68334d)

diff --git a/rpython/rlib/runicode.py b/rpython/rlib/runicode.py
--- a/rpython/rlib/runicode.py
+++ b/rpython/rlib/runicode.py
@@ -13,7 +13,6 @@
 MAXUNICODE = 0x
 allow_surrogate_by_default = True
 
-NARROW_HOST = not we_are_translated() and sys.maxunicode == 0x
 BYTEORDER = sys.byteorder
 
 # python 2.7 has a preview of py3k behavior, so those functions
@@ -66,7 +65,7 @@
 
 if MAXUNICODE  0x:
 def code_to_unichr(code):
-if NARROW_HOST:
+if is_narrow_host():
 # Host CPython is narrow build, generate surrogates
 return unichr_returns_surrogate(code)
 else:
@@ -86,6 +85,9 @@
 result.append(hi)
 result.append(lo)
 
+def is_narrow_host():
+return not we_are_translated() and sys.maxunicode == 0x
+
 def default_unicode_error_decode(errors, encoding, msg, s,
  startingpos, endingpos):
 if errors == 'replace':
@@ -338,7 +340,7 @@
 # Check for low surrogate and combine the two to
 # form a UCS4 value
 if ((allow_surrogates or MAXUNICODE  65536
- or NARROW_HOST) and
+ or is_narrow_host()) and
 ch = 0xDBFF and 0xDC00 = ch2 = 0xDFFF):
 ch3 = ((ch - 0xD800)  10 | (ch2 - 0xDC00)) + 
0x1
 pos += 1
@@ -1351,7 +1353,7 @@
 
 # The following logic is enabled only if MAXUNICODE == 0x, or
 # for testing on top of a host Python where sys.maxunicode == 
0x
-if ((MAXUNICODE  65536 or NARROW_HOST)
+if ((MAXUNICODE  65536 or is_narrow_host())
 and 0xD800 = oc  0xDC00 and pos + 1  size):
 # Map UTF-16 surrogate pairs to Unicode \U escapes
 pos += 1
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: backout d4a4d951ddc2

2014-10-13 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: 
Changeset: r73938:db3e26419a95
Date: 2014-10-13 17:28 -0700
http://bitbucket.org/pypy/pypy/changeset/db3e26419a95/

Log:backout d4a4d951ddc2

diff --git a/rpython/rlib/runicode.py b/rpython/rlib/runicode.py
--- a/rpython/rlib/runicode.py
+++ b/rpython/rlib/runicode.py
@@ -336,7 +336,8 @@
 ch2 = ord(s[pos])
 # Check for low surrogate and combine the two to
 # form a UCS4 value
-if ch = 0xDBFF and 0xDC00 = ch2 = 0xDFFF:
+if ((allow_surrogates or MAXUNICODE  65536) and
+ch = 0xDBFF and 0xDC00 = ch2 = 0xDFFF):
 ch3 = ((ch - 0xD800)  10 | (ch2 - 0xDC00)) + 
0x1
 pos += 1
 _encodeUCS4(result, ch3)
diff --git a/rpython/rlib/test/test_runicode.py 
b/rpython/rlib/test/test_runicode.py
--- a/rpython/rlib/test/test_runicode.py
+++ b/rpython/rlib/test/test_runicode.py
@@ -806,3 +806,20 @@
 u, len(u), True) == r'\ud800\udc00'
 assert runicode.unicode_encode_raw_unicode_escape(
 u, len(u), True) == r'\ud800\udc00'
+
+def test_encode_surrogate_pair_utf8(self):
+u = runicode.UNICHR(0xD800) + runicode.UNICHR(0xDC00)
+if runicode.MAXUNICODE  65536:
+# Narrow unicode build, consider utf16 surrogate pairs
+assert runicode.unicode_encode_utf_8(
+u, len(u), True, allow_surrogates=True) == '\xf0\x90\x80\x80'
+assert runicode.unicode_encode_utf_8(
+u, len(u), True, allow_surrogates=False) == '\xf0\x90\x80\x80'
+else:
+# Wide unicode build, merge utf16 surrogate pairs only when allowed
+assert runicode.unicode_encode_utf_8(
+u, len(u), True, allow_surrogates=True) == '\xf0\x90\x80\x80'
+# Surrogates not merged, encoding fails.
+py.test.raises(
+UnicodeEncodeError, runicode.unicode_encode_utf_8,
+u, len(u), True, allow_surrogates=False)
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: bring over some helper functions currently only used by py3k

2014-10-13 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: 
Changeset: r73942:d34e5f29e326
Date: 2014-10-13 17:35 -0700
http://bitbucket.org/pypy/pypy/changeset/d34e5f29e326/

Log:bring over some helper functions currently only used by py3k

diff --git a/rpython/rlib/rdynload.py b/rpython/rlib/rdynload.py
--- a/rpython/rlib/rdynload.py
+++ b/rpython/rlib/rdynload.py
@@ -158,3 +158,4 @@
 return res
 
 LoadLibrary = rwin32.LoadLibrary
+GetModuleHandle = rwin32.GetModuleHandle
diff --git a/rpython/rlib/rwin32.py b/rpython/rlib/rwin32.py
--- a/rpython/rlib/rwin32.py
+++ b/rpython/rlib/rwin32.py
@@ -130,6 +130,7 @@
 # is hidden by operations in ll2ctypes.  Call it now.
 GetLastError()
 
+GetModuleHandle = winexternal('GetModuleHandleA', [rffi.CCHARP], HMODULE)
 LoadLibrary = winexternal('LoadLibraryA', [rffi.CCHARP], HMODULE)
 GetProcAddress = winexternal('GetProcAddress',
  [HMODULE, rffi.CCHARP],
diff --git a/rpython/rtyper/module/support.py b/rpython/rtyper/module/support.py
--- a/rpython/rtyper/module/support.py
+++ b/rpython/rtyper/module/support.py
@@ -49,6 +49,7 @@
 CHAR = rffi.CHAR
 CCHARP = rffi.CCHARP
 charp2str = staticmethod(rffi.charp2str)
+charpsize2str = staticmethod(rffi.charpsize2str)
 scoped_str2charp = staticmethod(rffi.scoped_str2charp)
 str2charp = staticmethod(rffi.str2charp)
 free_charp = staticmethod(rffi.free_charp)
@@ -68,6 +69,7 @@
 CHAR = rffi.WCHAR_T
 CCHARP = rffi.CWCHARP
 charp2str = staticmethod(rffi.wcharp2unicode)
+charpsize2str = staticmethod(rffi.wcharpsize2unicode)
 str2charp = staticmethod(rffi.unicode2wcharp)
 scoped_str2charp = staticmethod(rffi.scoped_unicode2wcharp)
 free_charp = staticmethod(rffi.free_wcharp)
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: fix missing endDFAs for u prefix'd tripled quoted strings

2014-09-27 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3k
Changeset: r73724:5f38597ef8a9
Date: 2014-09-26 20:04 -0700
http://bitbucket.org/pypy/pypy/changeset/5f38597ef8a9/

Log:fix missing endDFAs for u prefix'd tripled quoted strings

diff --git a/pypy/interpreter/pyparser/pytokenize.py 
b/pypy/interpreter/pyparser/pytokenize.py
--- a/pypy/interpreter/pyparser/pytokenize.py
+++ b/pypy/interpreter/pyparser/pytokenize.py
@@ -35,8 +35,9 @@
 prefix = uniPrefix + rawPrefix
 endDFAs[prefix + '''] = single3DFA
 endDFAs[prefix + ''] = double3DFA
-endDFAs[u'''] = single3DFA
-endDFAs['U'] = double3DFA
+for uniPrefix in (u, U):
+endDFAs[uniPrefix + '''] = single3DFA
+endDFAs[uniPrefix + ''] = double3DFA
 
 whiteSpaceStatesAccepts = [True]
 whiteSpaceStates = [{'\t': 0, ' ': 0, '\x0c': 0}]
diff --git a/pypy/interpreter/pyparser/test/test_pyparse.py 
b/pypy/interpreter/pyparser/test/test_pyparse.py
--- a/pypy/interpreter/pyparser/test/test_pyparse.py
+++ b/pypy/interpreter/pyparser/test/test_pyparse.py
@@ -146,6 +146,12 @@
 self.parse('a, *rest, b = 1, 2, 3, 4, 5')
 self.parse('(a, *rest, b) = 1, 2, 3, 4, 5')
 
+def test_u_triple_quote(self):
+self.parse('u')
+self.parse('U')
+self.parse(u'')
+self.parse(U'')
+
 
 class TestPythonParserWithSpace:
 
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: we really want a unicodebuffer here

2014-09-24 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3k
Changeset: r73683:2e736033bd2b
Date: 2014-09-24 19:14 -0700
http://bitbucket.org/pypy/pypy/changeset/2e736033bd2b/

Log:we really want a unicodebuffer here

diff --git a/rpython/rtyper/module/ll_win32file.py 
b/rpython/rtyper/module/ll_win32file.py
--- a/rpython/rtyper/module/ll_win32file.py
+++ b/rpython/rtyper/module/ll_win32file.py
@@ -476,24 +476,24 @@
 
 VOLUME_NAME_DOS = rffi.cast(rwin32.DWORD, win32traits.VOLUME_NAME_DOS)
 try:
-size = win32traits.GetFinalPathNameByHandle(
+usize = win32traits.GetFinalPathNameByHandle(
 hFile,
 lltype.nullptr(traits.CCHARP.TO),
 rffi.cast(rwin32.DWORD, 0),
 VOLUME_NAME_DOS)
-if size == 0:
+if usize == 0:
 raise rwin32.lastWindowsError(GetFinalPathNameByHandle)
 
-with lltype.scoped_alloc(traits.CCHARP.TO, size + 1) as 
target_path:
+size = rffi.cast(lltype.Signed, usize)
+with rffi.scoped_alloc_unicodebuffer(size + 1) as buf:
 result = win32traits.GetFinalPathNameByHandle(
 hFile,
-target_path,
-size,
+buf.raw,
+usize,
 VOLUME_NAME_DOS)
 if result == 0:
 raise rwin32.lastWindowsError(GetFinalPathNameByHandle)
-return traits.charpsize2str(target_path,
-rffi.cast(lltype.Signed, result))
+return buf.str(rffi.cast(lltype.Signed, result))
 finally:
 rwin32.CloseHandle(hFile)
 
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: workaround FuncType pointer calls w/ a non-standard calling convention not

2014-09-24 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3k
Changeset: r73684:eab5254eaafa
Date: 2014-09-24 19:24 -0700
http://bitbucket.org/pypy/pypy/changeset/eab5254eaafa/

Log:workaround FuncType pointer calls w/ a non-standard calling
convention not actually using said convention (after translation)
with a stupid shim for now

diff --git a/pypy/module/posix/__init__.py b/pypy/module/posix/__init__.py
--- a/pypy/module/posix/__init__.py
+++ b/pypy/module/posix/__init__.py
@@ -167,8 +167,7 @@
 if os.name == 'nt':
 interpleveldefs.update({
 '_getfileinformation': 'interp_posix._getfileinformation',
-# XXX: currently broken
-#'_getfinalpathname': 'interp_posix._getfinalpathname',
+'_getfinalpathname': 'interp_posix._getfinalpathname',
 })
 if hasattr(os, 'chroot'):
 interpleveldefs['chroot'] = 'interp_posix.chroot'
diff --git a/rpython/rtyper/module/ll_win32file.py 
b/rpython/rtyper/module/ll_win32file.py
--- a/rpython/rtyper/module/ll_win32file.py
+++ b/rpython/rtyper/module/ll_win32file.py
@@ -10,6 +10,17 @@
 from rpython.tool.sourcetools import func_renamer
 from rpython.rlib.objectmodel import specialize
 
+separate_module_source = \
+DWORD
+pypy_GetFinalPathNameByHandle(FARPROC address, HANDLE hFile,
+  LPTSTR lpszFilePath, DWORD cchFilePath,
+  DWORD dwFlags) {
+DWORD (WINAPI *func)(HANDLE, LPTSTR, DWORD, DWORD);
+*(FARPROC*)func = address;
+return func(hFile, lpszFilePath, cchFilePath, dwFlags);
+}
+
+
 def make_win32_traits(traits):
 from rpython.rlib import rwin32
 
@@ -21,6 +32,8 @@
 class CConfig:
 _compilation_info_ = ExternalCompilationInfo(
 includes = ['windows.h', 'winbase.h', 'sys/stat.h'],
+separate_module_sources=[separate_module_source],
+export_symbols=['pypy_GetFinalPathNameByHandle']
 )
 WIN32_FIND_DATA = platform.Struct(
 'struct _WIN32_FIND_DATA' + suffix,
@@ -192,15 +205,15 @@
 [traits.CCHARP, traits.CCHARP],
 rwin32.BOOL)
 
-GETFINALPATHNAMEBYHANDLE_TP = lltype.Ptr(lltype.FuncType(
-[rwin32.HANDLE, traits.CCHARP, rwin32.DWORD, rwin32.DWORD],
-rwin32.DWORD, abi='FFI_STDCALL'))
-# dynamically loaded
-GetFinalPathNameByHandle = lltype.nullptr(
-GETFINALPATHNAMEBYHANDLE_TP.TO)
+GetFinalPathNameByHandle_HANDLE = lltype.nullptr(rffi.VOIDP.TO)
+pypy_GetFinalPathNameByHandle = staticmethod(rffi.llexternal(
+'pypy_GetFinalPathNameByHandle',
+[rffi.VOIDP, rwin32.HANDLE, rffi.CWCHARP, rwin32.DWORD, 
rwin32.DWORD],
+rwin32.DWORD, compilation_info=CConfig._compilation_info_))
 
 def check_GetFinalPathNameByHandle(self):
-if self.GetFinalPathNameByHandle:
+if (self.GetFinalPathNameByHandle_HANDLE !=
+lltype.nullptr(rffi.VOIDP.TO)):
 return True
 
 from rpython.rlib.rdynload import GetModuleHandle, dlsym
@@ -210,10 +223,15 @@
 except KeyError:
 return False
 
-self.GetFinalPathNameByHandle = rffi.cast(
-Win32Traits.GETFINALPATHNAMEBYHANDLE_TP, func)
+self.GetFinalPathNameByHandle_HANDLE = func
 return True
 
+def GetFinalPathNameByHandle(self, *args):
+assert (self.GetFinalPathNameByHandle_HANDLE !=
+lltype.nullptr(rffi.VOIDP.TO))
+return self.pypy_GetFinalPathNameByHandle(
+self.GetFinalPathNameByHandle_HANDLE, *args)
+
 return Win32Traits()
 
 #___
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3.3: merge py3k

2014-09-21 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3.3
Changeset: r73638:de00ce0a7596
Date: 2014-09-21 16:20 -0700
http://bitbucket.org/pypy/pypy/changeset/de00ce0a7596/

Log:merge py3k

diff --git a/pypy/module/posix/__init__.py b/pypy/module/posix/__init__.py
--- a/pypy/module/posix/__init__.py
+++ b/pypy/module/posix/__init__.py
@@ -171,7 +171,8 @@
 if os.name == 'nt':
 interpleveldefs.update({
 '_getfileinformation': 'interp_posix._getfileinformation',
-'_getfinalpathname': 'interp_posix._getfinalpathname',
+# XXX: currently broken
+#'_getfinalpathname': 'interp_posix._getfinalpathname',
 })
 if hasattr(os, 'chroot'):
 interpleveldefs['chroot'] = 'interp_posix.chroot'
diff --git a/pypy/tool/release/package.py b/pypy/tool/release/package.py
--- a/pypy/tool/release/package.py
+++ b/pypy/tool/release/package.py
@@ -307,7 +307,13 @@
 argparse = imp.load_source('argparse', 'lib-python/2.7/argparse.py')
 if sys.platform == 'win32':
 pypy_exe = 'pypy3.exe'
-license_base = os.path.join(basedir, r'..\..\..\local') # as on 
buildbot YMMV
+for p in [os.path.join(basedir, r'..\..\..\local'), #buildbot
+os.path.join(basedir, r'..\local')]: # pypy/doc/windows.rst
+if os.path.exists(p): 
+license_base = p
+break
+else:
+license_base = 'unkown'
 else:
 pypy_exe = 'pypy3'
 license_base = '/usr/share/doc'
@@ -380,5 +386,21 @@
 
 if __name__ == '__main__':
 import sys
+if sys.platform == 'win32':
+# Try to avoid opeing a dialog box if one of the 
+# subprocesses causes a system error
+import ctypes
+winapi = ctypes.windll.kernel32
+SetErrorMode = winapi.SetErrorMode
+SetErrorMode.argtypes=[ctypes.c_int]
+
+SEM_FAILCRITICALERRORS = 1
+SEM_NOGPFAULTERRORBOX  = 2
+SEM_NOOPENFILEERRORBOX = 0x8000
+flags = SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX | 
SEM_NOOPENFILEERRORBOX
+#Since there is no GetErrorMode, do a double Set
+old_mode = SetErrorMode(flags)
+SetErrorMode(old_mode | flags)
+
 retval, _ = package(*sys.argv[1:])
 sys.exit(retval)
diff --git a/pypy/tool/release/test/test_package.py 
b/pypy/tool/release/test/test_package.py
--- a/pypy/tool/release/test/test_package.py
+++ b/pypy/tool/release/test/test_package.py
@@ -115,15 +115,21 @@
 check(pypy,  0755)
 
 def test_generate_license():
-from os.path import dirname, abspath, join
+from os.path import dirname, abspath, join, exists
 class Options(object):
 pass
 options = Options()
 basedir = dirname(dirname(dirname(dirname(dirname(abspath(__file__))
 options.no_tk = False
 if sys.platform == 'win32':
- # as on buildbot YMMV
-options.license_base = join(basedir, r'..\..\..\local')
+for p in [join(basedir, r'..\..\..\local'), #buildbot
+  join(basedir, r'..\local')]: # pypy/doc/windows.rst
+if exists(p): 
+license_base = p
+break
+else:
+license_base = 'unkown'
+options.license_base = license_base
 else:
 options.license_base = '/usr/share/doc'
 license = package.generate_license(py.path.local(basedir), options)
diff --git a/rpython/translator/driver.py b/rpython/translator/driver.py
--- a/rpython/translator/driver.py
+++ b/rpython/translator/driver.py
@@ -476,11 +476,12 @@
 shutil_copy(str(soname), str(newsoname))
 self.log.info(copied: %s % (newsoname,))
 if sys.platform == 'win32':
-# copy the import library as well
-libname = soname.new(ext='lib')
-newlibname = newexename.new(basename=soname.basename)
-shutil.copyfile(str(libname), 
str(newlibname.new(ext='lib')))
-self.log.info(copied: %s % (newlibname,))
+ext_to_copy = ['lib', 'pdb']
+for ext in ext_to_copy:
+name = soname.new(ext=ext)
+newname = newexename.new(basename=soname.basename)
+shutil.copyfile(str(name), str(newname.new(ext=ext)))
+self.log.info(copied: %s % (newname,))
 self.c_entryp = newexename
 self.log.info('usession directory: %s' % (udir,))
 self.log.info(created: %s % (self.c_entryp,))
diff --git a/rpython/translator/platform/windows.py 
b/rpython/translator/platform/windows.py
--- a/rpython/translator/platform/windows.py
+++ b/rpython/translator/platform/windows.py
@@ -410,7 +410,7 @@
'int main(int argc, char* argv[]) '
'{ return $(PYPY_MAIN_FUNCTION)(argc, argv); }  $@')
 m.rule('$(DEFAULT_TARGET)', ['$(TARGET)', 

[pypy-commit] pypy py3k: _getfinalpathname is broken, disable for now

2014-09-21 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3k
Changeset: r73637:7011366e6fbf
Date: 2014-09-21 16:20 -0700
http://bitbucket.org/pypy/pypy/changeset/7011366e6fbf/

Log:_getfinalpathname is broken, disable for now

diff --git a/pypy/module/posix/__init__.py b/pypy/module/posix/__init__.py
--- a/pypy/module/posix/__init__.py
+++ b/pypy/module/posix/__init__.py
@@ -167,7 +167,8 @@
 if os.name == 'nt':
 interpleveldefs.update({
 '_getfileinformation': 'interp_posix._getfileinformation',
-'_getfinalpathname': 'interp_posix._getfinalpathname',
+# XXX: currently broken
+#'_getfinalpathname': 'interp_posix._getfinalpathname',
 })
 if hasattr(os, 'chroot'):
 interpleveldefs['chroot'] = 'interp_posix.chroot'
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3.3: merge py3k

2014-09-21 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3.3
Changeset: r73636:ac2759ae7eb6
Date: 2014-09-18 21:14 -0700
http://bitbucket.org/pypy/pypy/changeset/ac2759ae7eb6/

Log:merge py3k

diff --git a/pypy/doc/windows.rst b/pypy/doc/windows.rst
--- a/pypy/doc/windows.rst
+++ b/pypy/doc/windows.rst
@@ -85,10 +85,13 @@
 
 Abridged method (for -Ojit builds using Visual Studio 2008)
 ~~~
-Download the versions of all the external packages
-from 
+Download the versions of all the external packages from 
+https://bitbucket.org/pypy/pypy/downloads/local_2.4.zip
+(for 2.4 release and later) or
 https://bitbucket.org/pypy/pypy/downloads/local.zip
-Then expand it into the base directory (base_dir) and modify your environment 
to reflect this::
+(for pre-2.4 versions)
+Then expand it into the base directory (base_dir) and modify your environment
+to reflect this::
 
 set PATH=base_dir\bin;base_dir\tcltk\bin;%PATH%
 set INCLUDE=base_dir\include;base_dir\tcltk\include;%INCLUDE%
diff --git a/pypy/interpreter/pycode.py b/pypy/interpreter/pycode.py
--- a/pypy/interpreter/pycode.py
+++ b/pypy/interpreter/pycode.py
@@ -46,6 +46,7 @@
 def cpython_code_signature(code):
 ([list-of-arg-names], vararg-name-or-None, kwarg-name-or-None).
 argcount = code.co_argcount
+varnames = code.co_varnames
 if we_are_translated():
 kwonlyargcount = code.co_kwonlyargcount
 else:
@@ -53,16 +54,18 @@
 kwonlyargcount = getattr(code, 'co_kwonlyargcount', 0)
 assert argcount = 0 # annotator hint
 assert kwonlyargcount = 0
-argnames = list(code.co_varnames[:argcount])
-kwonlyargs = list(code.co_varnames[argcount:argcount + kwonlyargcount])
+argnames = list(varnames[:argcount])
+if argcount  len(varnames):
+kwonlyargs = list(varnames[argcount:argcount + kwonlyargcount])
+else:
+kwonlyargs = None
 if code.co_flags  CO_VARARGS:
-varargname = code.co_varnames[argcount]
+varargname = varnames[argcount]
 argcount += 1
 else:
 varargname = None
 if code.co_flags  CO_VARKEYWORDS:
 kwargname = code.co_varnames[argcount + kwonlyargcount]
-argcount += 1
 else:
 kwargname = None
 return Signature(argnames, varargname, kwargname, kwonlyargs)
diff --git a/pypy/interpreter/pyparser/parsestring.py 
b/pypy/interpreter/pyparser/parsestring.py
--- a/pypy/interpreter/pyparser/parsestring.py
+++ b/pypy/interpreter/pyparser/parsestring.py
@@ -82,12 +82,6 @@
 v = PyString_DecodeEscape(space, substr, 'strict', encoding)
 return space.wrapbytes(v)
 
-def hexbyte(val):
-result = %x % val
-if len(result) == 1:
-result = 0 + result
-return result
-
 def decode_unicode_utf8(space, s, ps, q):
 # The Python 2.7 version, producing UTF-32 escapes
 # String is utf8-encoded, but 'unicode_escape' expects
@@ -107,15 +101,14 @@
 # instead.
 lis.append(u005c)
 if ord(s[ps])  0x80: # XXX inefficient
-w, ps = decode_utf8(space, s, ps, end, utf-32-be)
-rn = len(w)
-assert rn % 4 == 0
-for i in range(0, rn, 4):
-lis.append('\\U')
-lis.append(hexbyte(ord(w[i])))
-lis.append(hexbyte(ord(w[i+1])))
-lis.append(hexbyte(ord(w[i+2])))
-lis.append(hexbyte(ord(w[i+3])))
+w, ps = decode_utf8(space, s, ps, end)
+for c in w:
+# The equivalent of %08x, which is not supported by RPython.
+# 7 zeroes are enough for the unicode range, and the
+# result still fits in 32-bit.
+hexa = hex(ord(c) + 0x1000)
+lis.append('\\U0')
+lis.append(hexa[3:])  # Skip 0x and the leading 1
 else:
 lis.append(s[ps])
 ps += 1
@@ -135,7 +128,7 @@
 # note that the C code has a label here.
 # the logic is the same.
 if recode_encoding and ord(s[ps])  0x80:
-w, ps = decode_utf8(space, s, ps, end, recode_encoding)
+w, ps = decode_utf8_recode(space, s, ps, end, recode_encoding)
 # Append bytes to output buffer.
 builder.append(w)
 else:
@@ -222,14 +215,18 @@
 ch = 'A' and ch = 'F')
 
 
-def decode_utf8(space, s, ps, end, encoding):
+def decode_utf8(space, s, ps, end):
 assert ps = 0
 pt = ps
 # while (s  end  *s != '\\') s++; */ /* inefficient for u..
 while ps  end and ord(s[ps])  0x80:
 ps += 1
-w_u = space.wrap(unicodehelper.decode_utf8(space, s[pt:ps]))
-w_v = unicodehelper.encode(space, w_u, encoding)
+u = unicodehelper.decode_utf8(space, s[pt:ps])
+return u, ps
+
+def decode_utf8_recode(space, s, ps, end, recode_encoding):
+u, ps = decode_utf8(space, s, ps, end)
+w_v = 

[pypy-commit] pypy py3.3: issue832: linux sys.platform now always linux

2014-09-21 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3.3
Changeset: r73639:31223ffc5ac1
Date: 2014-09-21 16:22 -0700
http://bitbucket.org/pypy/pypy/changeset/31223ffc5ac1/

Log:issue832: linux sys.platform now always linux

diff --git a/pypy/module/sys/__init__.py b/pypy/module/sys/__init__.py
--- a/pypy/module/sys/__init__.py
+++ b/pypy/module/sys/__init__.py
@@ -23,7 +23,7 @@
 '__name__'  : '(space.wrap(sys))',
 '__doc__'   : '(space.wrap(PyPy sys module))',
 
-'platform'  : 'space.wrap(sys.platform)',
+'platform'  : 'space.wrap(system.PLATFORM)',
 'maxsize'   : 'space.wrap(sys.maxint)',
 'byteorder' : 'space.wrap(sys.byteorder)',
 'maxunicode': 'space.wrap(vm.MAXUNICODE)',
diff --git a/pypy/module/sys/system.py b/pypy/module/sys/system.py
--- a/pypy/module/sys/system.py
+++ b/pypy/module/sys/system.py
@@ -1,4 +1,6 @@
 Information about the current system.
+import sys
+
 from pypy.objspace.std.complexobject import HASH_IMAG
 from pypy.objspace.std.floatobject import HASH_INF, HASH_NAN
 from pypy.objspace.std.intobject import HASH_MODULUS
@@ -6,6 +8,7 @@
 from rpython.rlib import rbigint, rfloat
 from rpython.rtyper.lltypesystem import lltype, rffi
 
+PLATFORM = 'linux' if sys.platform.startswith('linux') else sys.platform
 
 app = gateway.applevel(
 NOT_RPYTHON
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3.3: sys.platform linux2 - linux

2014-09-21 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3.3
Changeset: r73640:57188ff5ab4e
Date: 2014-09-21 16:31 -0700
http://bitbucket.org/pypy/pypy/changeset/57188ff5ab4e/

Log:sys.platform linux2 - linux

diff --git a/lib_pypy/ctypes_support.py b/lib_pypy/ctypes_support.py
--- a/lib_pypy/ctypes_support.py
+++ b/lib_pypy/ctypes_support.py
@@ -22,7 +22,7 @@
 def _where_is_errno():
 return standard_c_lib._errno()
 
-elif sys.platform in ('linux2', 'freebsd6'):
+elif sys.platform in ('linux', 'freebsd6'):
 standard_c_lib.__errno_location.restype = ctypes.POINTER(ctypes.c_int)
 standard_c_lib.__errno_location.argtypes = None
 def _where_is_errno():
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: merge default

2014-09-18 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3k
Changeset: r73603:45600f667251
Date: 2014-09-17 17:30 -0700
http://bitbucket.org/pypy/pypy/changeset/45600f667251/

Log:merge default

diff --git a/pypy/interpreter/pyparser/parsestring.py 
b/pypy/interpreter/pyparser/parsestring.py
--- a/pypy/interpreter/pyparser/parsestring.py
+++ b/pypy/interpreter/pyparser/parsestring.py
@@ -82,12 +82,6 @@
 v = PyString_DecodeEscape(space, substr, 'strict', encoding)
 return space.wrapbytes(v)
 
-def hexbyte(val):
-result = %x % val
-if len(result) == 1:
-result = 0 + result
-return result
-
 def decode_unicode_utf8(space, s, ps, q):
 # The Python 2.7 version, producing UTF-32 escapes
 # String is utf8-encoded, but 'unicode_escape' expects
@@ -107,15 +101,14 @@
 # instead.
 lis.append(u005c)
 if ord(s[ps])  0x80: # XXX inefficient
-w, ps = decode_utf8(space, s, ps, end, utf-32-be)
-rn = len(w)
-assert rn % 4 == 0
-for i in range(0, rn, 4):
-lis.append('\\U')
-lis.append(hexbyte(ord(w[i])))
-lis.append(hexbyte(ord(w[i+1])))
-lis.append(hexbyte(ord(w[i+2])))
-lis.append(hexbyte(ord(w[i+3])))
+w, ps = decode_utf8(space, s, ps, end)
+for c in w:
+# The equivalent of %08x, which is not supported by RPython.
+# 7 zeroes are enough for the unicode range, and the
+# result still fits in 32-bit.
+hexa = hex(ord(c) + 0x1000)
+lis.append('\\U0')
+lis.append(hexa[3:])  # Skip 0x and the leading 1
 else:
 lis.append(s[ps])
 ps += 1
@@ -135,7 +128,7 @@
 # note that the C code has a label here.
 # the logic is the same.
 if recode_encoding and ord(s[ps])  0x80:
-w, ps = decode_utf8(space, s, ps, end, recode_encoding)
+w, ps = decode_utf8_recode(space, s, ps, end, recode_encoding)
 # Append bytes to output buffer.
 builder.append(w)
 else:
@@ -222,14 +215,18 @@
 ch = 'A' and ch = 'F')
 
 
-def decode_utf8(space, s, ps, end, encoding):
+def decode_utf8(space, s, ps, end):
 assert ps = 0
 pt = ps
 # while (s  end  *s != '\\') s++; */ /* inefficient for u..
 while ps  end and ord(s[ps])  0x80:
 ps += 1
-w_u = space.wrap(unicodehelper.decode_utf8(space, s[pt:ps]))
-w_v = unicodehelper.encode(space, w_u, encoding)
+u = unicodehelper.decode_utf8(space, s[pt:ps])
+return u, ps
+
+def decode_utf8_recode(space, s, ps, end, recode_encoding):
+u, ps = decode_utf8(space, s, ps, end)
+w_v = unicodehelper.encode(space, space.wrap(u), recode_encoding)
 v = space.bytes_w(w_v)
 return v, ps
 
diff --git a/pypy/interpreter/pyparser/test/test_parsestring.py 
b/pypy/interpreter/pyparser/test/test_parsestring.py
--- a/pypy/interpreter/pyparser/test/test_parsestring.py
+++ b/pypy/interpreter/pyparser/test/test_parsestring.py
@@ -100,11 +100,11 @@
 
 def test_simple_enc_roundtrip(self):
 space = self.space
-s = '\x81'
+s = '\x81\\t'
 s = s.decode(koi8-u).encode(utf8)
 w_ret = parsestring.parsestr(self.space, 'koi8-u', s)
 ret = space.unwrap(w_ret)
-assert ret == eval(# -*- coding: koi8-u -*-\nu'\x81') 
+assert ret == eval(# -*- coding: koi8-u -*-\nu'\x81\\t') 
 
 def test_multiline_unicode_strings_with_backslash(self):
 space = self.space
diff --git a/pypy/interpreter/unicodehelper.py 
b/pypy/interpreter/unicodehelper.py
--- a/pypy/interpreter/unicodehelper.py
+++ b/pypy/interpreter/unicodehelper.py
@@ -13,6 +13,7 @@
 
 @specialize.memo()
 def decode_error_handler(space):
+# Fast version of the strict errors handler.
 def raise_unicode_exception_decode(errors, encoding, msg, s,
startingpos, endingpos):
 raise OperationError(space.w_UnicodeDecodeError,
@@ -25,6 +26,7 @@
 
 @specialize.memo()
 def encode_error_handler(space):
+# Fast version of the strict errors handler.
 def raise_unicode_exception_encode(errors, encoding, msg, u,
startingpos, endingpos):
 raise OperationError(space.w_UnicodeEncodeError,
diff --git a/pypy/module/_cffi_backend/ctypefunc.py 
b/pypy/module/_cffi_backend/ctypefunc.py
--- a/pypy/module/_cffi_backend/ctypefunc.py
+++ b/pypy/module/_cffi_backend/ctypefunc.py
@@ -8,6 +8,7 @@
 from rpython.rlib.jit_libffi import (CIF_DESCRIPTION, CIF_DESCRIPTION_P,
 FFI_TYPE, FFI_TYPE_P, FFI_TYPE_PP, SIZE_OF_FFI_ARG)
 from rpython.rlib.objectmodel import we_are_translated, instantiate
+from rpython.rlib.objectmodel import keepalive_until_here
 from rpython.rtyper.lltypesystem import lltype, llmemory, rffi
 
 

[pypy-commit] pypy default: pep8/cleanup

2014-09-18 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: 
Changeset: r73602:832991d1e798
Date: 2014-09-17 16:54 -0700
http://bitbucket.org/pypy/pypy/changeset/832991d1e798/

Log:pep8/cleanup

diff --git a/rpython/rtyper/lltypesystem/lltype.py 
b/rpython/rtyper/lltypesystem/lltype.py
--- a/rpython/rtyper/lltypesystem/lltype.py
+++ b/rpython/rtyper/lltypesystem/lltype.py
@@ -1,16 +1,17 @@
-from types import NoneType, MethodType
 import weakref
+from types import MethodType, NoneType
+
+from rpython.annotator.bookkeeper import analyzer_for, immutablevalue
 from rpython.annotator.model import (
-SomeInteger, SomeBool, SomeObject, AnnotatorError)
+AnnotatorError, SomeBool, SomeInteger, SomeObject)
+from rpython.rlib.objectmodel import Symbolic
 from rpython.rlib.rarithmetic import (
-r_int, r_uint, intmask, r_singlefloat, r_ulonglong, r_longlong,
-r_longfloat, r_longlonglong, base_int, normalizedinttype, longlongmask,
-longlonglongmask, maxint, is_valid_int, is_emulated_long)
-from rpython.rlib.objectmodel import Symbolic
+base_int, intmask, is_emulated_long, is_valid_int, longlonglongmask,
+longlongmask, maxint, normalizedinttype, r_int, r_longfloat, r_longlong,
+r_longlonglong, r_singlefloat, r_uint, r_ulonglong)
+from rpython.rtyper.extregistry import ExtRegistryEntry
+from rpython.tool import leakfinder
 from rpython.tool.identity_dict import identity_dict
-from rpython.tool import leakfinder
-from rpython.annotator.bookkeeper import analyzer_for, immutablevalue
-from rpython.rtyper.extregistry import ExtRegistryEntry
 
 class State(object):
 pass
@@ -313,14 +314,12 @@
 except KeyError:
 return ContainerType.__getattr__(self, name)
 
-
 def _nofield(self, name):
 raise AttributeError('struct %s has no field %r' % (self._name,
  name))
 
 def _names_without_voids(self):
-names_without_voids = [name for name in self._names if 
self._flds[name] is not Void]
-return names_without_voids
+return [name for name in self._names if self._flds[name] is not Void]
 
 def _str_fields_without_voids(self):
 return ', '.join(['%s: %s' % (name, self._flds[name])
@@ -576,8 +575,10 @@
 _gckind = 'raw'
 
 def __init__(self, tag, hints={}):
- if hints['render_structure'] is set, the type is internal and not 
considered
-to come from somewhere else (it should be rendered as a structure) 

+If hints['render_structure'] is set, the type is internal and
+not considered to come from somewhere else (it should be
+rendered as a structure)
+
 self.tag = tag
 self.__name__ = tag
 self.hints = frozendict(hints)
@@ -675,7 +676,8 @@
 
 _numbertypes = {int: Number(Signed, int, intmask)}
 _numbertypes[r_int] = _numbertypes[int]
-_numbertypes[r_longlonglong] = Number(SignedLongLongLong, r_longlonglong, 
longlonglongmask)
+_numbertypes[r_longlonglong] = Number(SignedLongLongLong, r_longlonglong,
+  longlonglongmask)
 if r_longlong is not r_int:
 _numbertypes[r_longlong] = Number(SignedLongLong, r_longlong,
   longlongmask)
@@ -702,8 +704,8 @@
 UnsignedLongLong = build_number(UnsignedLongLong, r_ulonglong)
 
 Float   = Primitive(Float,   0.0)  # C type 'double'
-SingleFloat = Primitive(SingleFloat, r_singlefloat(0.0))   # C type 'float'
-LongFloat   = Primitive(LongFloat,   r_longfloat(0.0)) # C type 'long 
double'
+SingleFloat = Primitive(SingleFloat, r_singlefloat(0.0))   # 'float'
+LongFloat   = Primitive(LongFloat,   r_longfloat(0.0)) # 'long double'
 r_singlefloat._TYPE = SingleFloat
 
 Char = Primitive(Char, '\x00')
@@ -876,9 +878,11 @@
 
 @analyzer_for(cast_primitive)
 def ann_cast_primitive(T, s_v):
-from rpython.rtyper.llannotation import annotation_to_lltype, 
ll_to_annotation
+from rpython.rtyper.llannotation import (
+annotation_to_lltype, ll_to_annotation)
 assert T.is_constant()
-return ll_to_annotation(cast_primitive(T.const, 
annotation_to_lltype(s_v)._defl()))
+return ll_to_annotation(cast_primitive(T.const,
+   annotation_to_lltype(s_v)._defl()))
 
 
 def _cast_whatever(TGT, value):
@@ -905,7 +909,8 @@
 elif TGT == llmemory.Address and isinstance(ORIG, Ptr):
 return llmemory.cast_ptr_to_adr(value)
 elif TGT == Signed and isinstance(ORIG, Ptr) and ORIG.TO._gckind == 'raw':
-return llmemory.cast_adr_to_int(llmemory.cast_ptr_to_adr(value), 
'symbolic')
+return llmemory.cast_adr_to_int(llmemory.cast_ptr_to_adr(value),
+'symbolic')
 raise TypeError(don't know how to cast from %r to %r % (ORIG, TGT))
 
 
@@ -1176,8 +1181,8 @@
 except DelayedPointer:
 return True# assume it's not a delayed null
 
-# 

[pypy-commit] pypy py3k: fix

2014-09-18 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3k
Changeset: r73604:e27f287735af
Date: 2014-09-18 10:00 -0700
http://bitbucket.org/pypy/pypy/changeset/e27f287735af/

Log:fix

diff --git a/rpython/rtyper/module/ll_win32file.py 
b/rpython/rtyper/module/ll_win32file.py
--- a/rpython/rtyper/module/ll_win32file.py
+++ b/rpython/rtyper/module/ll_win32file.py
@@ -445,7 +445,7 @@
 with lltype.scoped_alloc(
 win32traits.BY_HANDLE_FILE_INFORMATION) as info:
 if win32traits.GetFileInformationByHandle(hFile, info) == 0:
-raise lastWindowsError(_getfileinformation)
+raise rwin32.lastWindowsError(_getfileinformation)
 return (rffi.cast(lltype.Signed, info.c_dwVolumeSerialNumber),
 rffi.cast(lltype.Signed, info.c_nFileIndexHigh),
 rffi.cast(lltype.Signed, info.c_nFileIndexLow))
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: fix translation

2014-09-18 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3k
Changeset: r73606:95c3cb767044
Date: 2014-09-18 13:04 -0700
http://bitbucket.org/pypy/pypy/changeset/95c3cb767044/

Log:fix translation

diff --git a/rpython/rtyper/module/ll_win32file.py 
b/rpython/rtyper/module/ll_win32file.py
--- a/rpython/rtyper/module/ll_win32file.py
+++ b/rpython/rtyper/module/ll_win32file.py
@@ -194,10 +194,12 @@
 
 # dynamically loaded
 GetFinalPathNameByHandle = None
+GETFINALPATHNAMEBYHANDLE_TP = lltype.Ptr(lltype.FuncType(
+[rwin32.HANDLE, traits.CCHARP, rwin32.DWORD, rwin32.DWORD],
+rwin32.DWORD, abi='FFI_STDCALL'))
 
-@staticmethod
-def check_GetFinalPathNameByHandle():
-if Win32Traits.GetFinalPathNameByHandle:
+def check_GetFinalPathNameByHandle(self):
+if self.GetFinalPathNameByHandle:
 return True
 
 from rpython.rlib.rdynload import GetModuleHandle, dlsym
@@ -207,13 +209,11 @@
 except KeyError:
 return False
 
-TYPE = lltype.Ptr(lltype.FuncType(
-[rwin32.HANDLE, traits.CCHARP, rwin32.DWORD, rwin32.DWORD],
-rwin32.DWORD, abi='FFI_STDCALL'))
-Win32Traits.GetFinalPathNameByHandle = rffi.cast(TYPE, func)
+self.GetFinalPathNameByHandle = rffi.cast(
+Win32Traits.GETFINALPATHNAMEBYHANDLE_TP, func)
 return True
 
-return Win32Traits
+return Win32Traits()
 
 #___
 # listdir
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: another translation fix attempt

2014-09-18 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3k
Changeset: r73608:c8117677797e
Date: 2014-09-18 13:29 -0700
http://bitbucket.org/pypy/pypy/changeset/c8117677797e/

Log:another translation fix attempt

diff --git a/rpython/rtyper/module/ll_win32file.py 
b/rpython/rtyper/module/ll_win32file.py
--- a/rpython/rtyper/module/ll_win32file.py
+++ b/rpython/rtyper/module/ll_win32file.py
@@ -192,11 +192,12 @@
 [traits.CCHARP, traits.CCHARP],
 rwin32.BOOL)
 
-# dynamically loaded
-GetFinalPathNameByHandle = None
 GETFINALPATHNAMEBYHANDLE_TP = lltype.Ptr(lltype.FuncType(
 [rwin32.HANDLE, traits.CCHARP, rwin32.DWORD, rwin32.DWORD],
 rwin32.DWORD, abi='FFI_STDCALL'))
+# dynamically loaded
+GetFinalPathNameByHandle = lltype.nullptr(
+GETFINALPATHNAMEBYHANDLE_TP.TO)
 
 def check_GetFinalPathNameByHandle(self):
 if self.GetFinalPathNameByHandle:
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: issue1798: add nt._getfinalpathname. add _getfileinformation as well

2014-09-17 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3k
Changeset: r73587:1900e5ea6ec4
Date: 2014-09-17 12:53 -0700
http://bitbucket.org/pypy/pypy/changeset/1900e5ea6ec4/

Log:issue1798: add nt._getfinalpathname. add _getfileinformation as well

diff --git a/pypy/module/posix/__init__.py b/pypy/module/posix/__init__.py
--- a/pypy/module/posix/__init__.py
+++ b/pypy/module/posix/__init__.py
@@ -164,6 +164,11 @@
 # not visible via os, inconsistency in nt:
 if hasattr(posix, '_getfullpathname'):
 interpleveldefs['_getfullpathname'] = 'interp_posix._getfullpathname'
+if os.name == 'nt':
+interpleveldefs.update({
+'_getfileinformation': 'interp_posix._getfileinformation',
+'_getfinalpathname': 'interp_posix._getfinalpathname',
+})
 if hasattr(os, 'chroot'):
 interpleveldefs['chroot'] = 'interp_posix.chroot'
 
diff --git a/pypy/module/posix/interp_posix.py 
b/pypy/module/posix/interp_posix.py
--- a/pypy/module/posix/interp_posix.py
+++ b/pypy/module/posix/interp_posix.py
@@ -5,8 +5,7 @@
 from rpython.rlib.objectmodel import specialize
 from rpython.rlib.rarithmetic import r_longlong
 from rpython.rlib.unroll import unrolling_iterable
-from rpython.rtyper.module import ll_os_stat
-from rpython.rtyper.module.ll_os import RegisterOs
+from rpython.rtyper.module import ll_os, ll_os_stat
 
 from pypy.interpreter.gateway import unwrap_spec, WrappedDefault
 from pypy.interpreter.error import OperationError, wrap_oserror, wrap_oserror2
@@ -1205,7 +1204,7 @@
 raise wrap_oserror(space, e)
 
 def declare_new_w_star(name):
-if name in RegisterOs.w_star_returning_int:
+if name in ll_os.RegisterOs.w_star_returning_int:
 @unwrap_spec(status=c_int)
 def WSTAR(space, status):
 return space.wrap(getattr(os, name)(status))
@@ -1217,7 +1216,7 @@
 WSTAR.func_name = name
 return WSTAR
 
-for name in RegisterOs.w_star:
+for name in ll_os.RegisterOs.w_star:
 if hasattr(os, name):
 func = declare_new_w_star(name)
 globals()[name] = func
@@ -1383,3 +1382,25 @@
 if codeset:
 return space.wrap(codeset)
 return space.w_None
+
+if _WIN32:
+@unwrap_spec(fd=c_int)
+def _getfileinformation(space, fd):
+try:
+info = ll_os._getfileinformation(fd)
+except OSError as e:
+raise wrap_oserror(space, e)
+return space.newtuple([space.wrap(info[0]),
+   space.wrap(info[1]),
+   space.wrap(info[2])])
+
+def _getfinalpathname(space, w_path):
+path = space.unicode_w(w_path)
+try:
+result = ll_os._getfinalpathname(path)
+except ll_os.LLNotImplemented as e:
+raise OperationError(space.w_NotImplementedError,
+ space.wrap(e.msg))
+except OSError as e:
+raise wrap_oserror2(space, e, w_path)
+return space.wrap(result)
diff --git a/pypy/module/posix/test/test_posix2.py 
b/pypy/module/posix/test/test_posix2.py
--- a/pypy/module/posix/test/test_posix2.py
+++ b/pypy/module/posix/test/test_posix2.py
@@ -1040,6 +1040,21 @@
 # just ensure it returns something reasonable
 assert encoding is None or type(encoding) is str
 
+if os.name == 'nt':
+def test__getfileinformation(self):
+import os
+path = os.path.join(self.pdir, 'file1')
+with open(path) as fp:
+info = self.posix._getfileinformation(fp.fileno())
+assert len(info) == 3
+assert all(isinstance(obj, int) for obj in info)
+
+def test__getfinalpathname(self):
+import os
+path = os.path.join(self.pdir, 'file1')
+result = self.posix._getfinalpathname(path)
+assert os.path.exists(result)
+
 
 class AppTestEnvironment(object):
 def setup_class(cls):
diff --git a/rpython/rlib/rdynload.py b/rpython/rlib/rdynload.py
--- a/rpython/rlib/rdynload.py
+++ b/rpython/rlib/rdynload.py
@@ -158,3 +158,4 @@
 return res
 
 LoadLibrary = rwin32.LoadLibrary
+GetModuleHandle = rwin32.GetModuleHandle
diff --git a/rpython/rlib/rwin32.py b/rpython/rlib/rwin32.py
--- a/rpython/rlib/rwin32.py
+++ b/rpython/rlib/rwin32.py
@@ -130,6 +130,7 @@
 # is hidden by operations in ll2ctypes.  Call it now.
 GetLastError()
 
+GetModuleHandle = winexternal('GetModuleHandleA', [rffi.CCHARP], HMODULE)
 LoadLibrary = winexternal('LoadLibraryA', [rffi.CCHARP], HMODULE)
 GetProcAddress = winexternal('GetProcAddress',
  [HMODULE, rffi.CCHARP],
diff --git a/rpython/rtyper/lltypesystem/ll2ctypes.py 
b/rpython/rtyper/lltypesystem/ll2ctypes.py
--- a/rpython/rtyper/lltypesystem/ll2ctypes.py
+++ b/rpython/rtyper/lltypesystem/ll2ctypes.py
@@ -361,7 +361,9 @@
 functype = ctypes.CFUNCTYPE
 if sys.platform == 'win32':

[pypy-commit] pypy py3k: rearrange

2014-09-17 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3k
Changeset: r73588:d0c26086a7f6
Date: 2014-09-17 12:57 -0700
http://bitbucket.org/pypy/pypy/changeset/d0c26086a7f6/

Log:rearrange

diff --git a/rpython/rtyper/module/test/test_ll_win32file.py 
b/rpython/rtyper/module/test/test_ll_win32file.py
--- a/rpython/rtyper/module/test/test_ll_win32file.py
+++ b/rpython/rtyper/module/test/test_ll_win32file.py
@@ -8,6 +8,15 @@
 py.test.skip(requires Windows)
 
 
+def test__getfileinformation():
+with open(__file__) as fp:
+stat = os.fstat(fp.fileno())
+info = ll_os._getfileinformation(fp.fileno())
+serial, high, low = info
+assert type(serial) in (int, long)
+assert (high  32) + low == stat.st_ino
+
+
 def test__getfinalpathname():
 path = __file__.decode('mbcs')
 try:
@@ -15,12 +24,3 @@
 except ll_os.LLNotImplemented:
 py.test.skip(_getfinalpathname not supported on this platform)
 assert os.path.exists(result)
-
-
-def test__getfileinformation():
-with open(__file__) as fp:
-stat = os.fstat(fp.fileno())
-info = ll_os._getfileinformation(fp.fileno())
-serial, high, low = info
-assert type(serial) in (int, long)
-assert (high  32) + low == stat.st_ino
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: handle older windows versions

2014-09-17 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3k
Changeset: r73589:80ee4756ddc3
Date: 2014-09-17 13:00 -0700
http://bitbucket.org/pypy/pypy/changeset/80ee4756ddc3/

Log:handle older windows versions

diff --git a/pypy/module/posix/test/test_posix2.py 
b/pypy/module/posix/test/test_posix2.py
--- a/pypy/module/posix/test/test_posix2.py
+++ b/pypy/module/posix/test/test_posix2.py
@@ -1052,7 +1052,10 @@
 def test__getfinalpathname(self):
 import os
 path = os.path.join(self.pdir, 'file1')
-result = self.posix._getfinalpathname(path)
+try:
+result = self.posix._getfinalpathname(path)
+except NotImplementedError:
+skip(_getfinalpathname not supported on this platform)
 assert os.path.exists(result)
 
 
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] buildbot default: don't explicitly specify the binary name of 'pypy' so that py3k branches can

2014-09-13 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: 
Changeset: r918:345d88ba452d
Date: 2014-09-13 15:53 -0700
http://bitbucket.org/pypy/buildbot/changeset/345d88ba452d/

Log:don't explicitly specify the binary name of 'pypy' so that py3k
branches can default to a value of 'pypy3'

diff --git a/bot2/pypybuildbot/builds.py b/bot2/pypybuildbot/builds.py
--- a/bot2/pypybuildbot/builds.py
+++ b/bot2/pypybuildbot/builds.py
@@ -491,8 +491,7 @@
 description=compress pypy-c,
 haltOnFailure=False,
 command=prefix + [python, pypy/tool/release/package.py,
- ., WithProperties(name), 'pypy',
- '.'],
+  --targetdir=., ., WithProperties(name)],
 workdir='build'))
 nightly = '~/nightly/'
 extension = get_extension(platform)
@@ -600,8 +599,7 @@
 self.addStep(ShellCmd(
 description=compress pypy-c,
 command=prefix + [python, pypy/tool/release/package.py,
- ., WithProperties(name), 'pypy',
- '.'],
+  --targetdir=., ., WithProperties(name)],
 haltOnFailure=True,
 workdir='build'))
 nightly = '~/nightly/'
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: issue1796: default the packaged pypy binary/shared lib name to 'pypy3'

2014-09-13 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3k
Changeset: r73526:86ac335daec2
Date: 2014-09-13 15:57 -0700
http://bitbucket.org/pypy/pypy/changeset/86ac335daec2/

Log:issue1796: default the packaged pypy binary/shared lib name to
'pypy3'

diff --git a/pypy/tool/release/package.py b/pypy/tool/release/package.py
--- a/pypy/tool/release/package.py
+++ b/pypy/tool/release/package.py
@@ -306,10 +306,10 @@
 import imp
 argparse = imp.load_source('argparse', 'lib-python/2.7/argparse.py')
 if sys.platform == 'win32':
-pypy_exe = 'pypy.exe'
+pypy_exe = 'pypy3.exe'
 license_base = os.path.join(basedir, r'..\..\..\local') # as on 
buildbot YMMV
 else:
-pypy_exe = 'pypy'
+pypy_exe = 'pypy3'
 license_base = '/usr/share/doc'
 parser = argparse.ArgumentParser()
 args = list(args)
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: merge default

2014-09-13 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3k
Changeset: r73529:201aee996695
Date: 2014-09-13 18:26 -0700
http://bitbucket.org/pypy/pypy/changeset/201aee996695/

Log:merge default

diff --git a/pypy/doc/windows.rst b/pypy/doc/windows.rst
--- a/pypy/doc/windows.rst
+++ b/pypy/doc/windows.rst
@@ -85,10 +85,13 @@
 
 Abridged method (for -Ojit builds using Visual Studio 2008)
 ~~~
-Download the versions of all the external packages
-from 
+Download the versions of all the external packages from 
+https://bitbucket.org/pypy/pypy/downloads/local_2.4.zip
+(for 2.4 release and later) or
 https://bitbucket.org/pypy/pypy/downloads/local.zip
-Then expand it into the base directory (base_dir) and modify your environment 
to reflect this::
+(for pre-2.4 versions)
+Then expand it into the base directory (base_dir) and modify your environment
+to reflect this::
 
 set PATH=base_dir\bin;base_dir\tcltk\bin;%PATH%
 set INCLUDE=base_dir\include;base_dir\tcltk\include;%INCLUDE%
diff --git a/pypy/interpreter/pycode.py b/pypy/interpreter/pycode.py
--- a/pypy/interpreter/pycode.py
+++ b/pypy/interpreter/pycode.py
@@ -45,6 +45,7 @@
 def cpython_code_signature(code):
 ([list-of-arg-names], vararg-name-or-None, kwarg-name-or-None).
 argcount = code.co_argcount
+varnames = code.co_varnames
 if we_are_translated():
 kwonlyargcount = code.co_kwonlyargcount
 else:
@@ -52,18 +53,14 @@
 kwonlyargcount = getattr(code, 'co_kwonlyargcount', 0)
 assert argcount = 0 # annotator hint
 assert kwonlyargcount = 0
-argnames = list(code.co_varnames[:argcount])
-kwonlyargs = list(code.co_varnames[argcount:argcount + kwonlyargcount])
+argnames = list(varnames[:argcount])
+kwonlyargs = list(varnames[argcount:argcount + kwonlyargcount])
 if code.co_flags  CO_VARARGS:
-varargname = code.co_varnames[argcount]
+varargname = varnames[argcount]
 argcount += 1
 else:
 varargname = None
-if code.co_flags  CO_VARKEYWORDS:
-kwargname = code.co_varnames[argcount]
-argcount += 1
-else:
-kwargname = None
+kwargname = varnames[argcount] if code.co_flags  CO_VARKEYWORDS else None
 return Signature(argnames, varargname, kwargname, kwonlyargs)
 
 
diff --git a/pypy/interpreter/test/test_app_main.py 
b/pypy/interpreter/test/test_app_main.py
--- a/pypy/interpreter/test/test_app_main.py
+++ b/pypy/interpreter/test/test_app_main.py
@@ -1064,7 +1064,7 @@
 prefix = udir.join('pathtest').ensure(dir=1)
 fake_exe = 'bin/pypy-c'
 if sys.platform == 'win32':
-fake_exe += '.exe'
+fake_exe = 'pypy-c.exe'
 fake_exe = prefix.join(fake_exe).ensure(file=1)
 expected_path = [str(prefix.join(subdir).ensure(dir=1))
  for subdir in ('lib_pypy',
@@ -1104,8 +1104,10 @@
 assert sys.path == old_sys_path + [self.goal_dir]
 
 app_main.setup_bootstrap_path(self.fake_exe)
-assert sys.executable == ''  # not executable!
-assert sys.path == old_sys_path + [self.goal_dir]
+if not sys.platform == 'win32':
+# an existing file is always 'executable' on windows
+assert sys.executable == ''  # not executable!
+assert sys.path == old_sys_path + [self.goal_dir]
 
 os.chmod(self.fake_exe, 0o755)
 app_main.setup_bootstrap_path(self.fake_exe)
diff --git a/rpython/translator/platform/test/test_makefile.py 
b/rpython/translator/platform/test/test_makefile.py
--- a/rpython/translator/platform/test/test_makefile.py
+++ b/rpython/translator/platform/test/test_makefile.py
@@ -44,6 +44,7 @@
 assert res.returncode == 0
 
 def test_900_files(self):
+tmpdir = udir.join('test_900_files').ensure(dir=1)
 txt = '#include stdio.h\n'
 for i in range(900):
 txt += 'int func%03d();\n' % i
@@ -52,11 +53,11 @@
 txt += 'j += func%03d();\n' % i
 txt += 'printf(%d\\n, j);\n'
 txt += 'return 0;};\n'
-cfile = udir.join('test_900_files.c')
+cfile = tmpdir.join('test_900_files.c')
 cfile.write(txt)
 cfiles = [cfile]
 for i in range(900):
-cfile2 = udir.join('implement%03d.c' %i)
+cfile2 = tmpdir.join('implement%03d.c' %i)
 cfile2.write('''
 int func%03d()
 {
@@ -64,10 +65,10 @@
 }
 ''' % (i, i))
 cfiles.append(cfile2)
-mk = self.platform.gen_makefile(cfiles, ExternalCompilationInfo(), 
path=udir)
+mk = self.platform.gen_makefile(cfiles, ExternalCompilationInfo(), 
path=tmpdir)
 mk.write()
 self.platform.execute_makefile(mk)
-res = self.platform.execute(udir.join('test_900_files'))
+res = 

[pypy-commit] pypy default: cleanup

2014-09-13 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: 
Changeset: r73528:5e1d74cb3416
Date: 2014-09-13 18:10 -0700
http://bitbucket.org/pypy/pypy/changeset/5e1d74cb3416/

Log:cleanup

diff --git a/pypy/interpreter/pycode.py b/pypy/interpreter/pycode.py
--- a/pypy/interpreter/pycode.py
+++ b/pypy/interpreter/pycode.py
@@ -38,18 +38,15 @@
 def cpython_code_signature(code):
 ([list-of-arg-names], vararg-name-or-None, kwarg-name-or-None).
 argcount = code.co_argcount
+varnames = code.co_varnames
 assert argcount = 0 # annotator hint
-argnames = list(code.co_varnames[:argcount])
+argnames = list(varnames[:argcount])
 if code.co_flags  CO_VARARGS:
-varargname = code.co_varnames[argcount]
+varargname = varnames[argcount]
 argcount += 1
 else:
 varargname = None
-if code.co_flags  CO_VARKEYWORDS:
-kwargname = code.co_varnames[argcount]
-argcount += 1
-else:
-kwargname = None
+kwargname = varnames[argcount] if code.co_flags  CO_VARKEYWORDS else None
 return Signature(argnames, varargname, kwargname)
 
 
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: issue1844: guard against invalid code object argcounts

2014-09-13 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3k
Changeset: r73530:013ccdd884c9
Date: 2014-09-13 19:22 -0700
http://bitbucket.org/pypy/pypy/changeset/013ccdd884c9/

Log:issue1844: guard against invalid code object argcounts

diff --git a/pypy/interpreter/pycode.py b/pypy/interpreter/pycode.py
--- a/pypy/interpreter/pycode.py
+++ b/pypy/interpreter/pycode.py
@@ -54,7 +54,10 @@
 assert argcount = 0 # annotator hint
 assert kwonlyargcount = 0
 argnames = list(varnames[:argcount])
-kwonlyargs = list(varnames[argcount:argcount + kwonlyargcount])
+if argcount  len(varnames):
+kwonlyargs = list(varnames[argcount:argcount + kwonlyargcount])
+else:
+kwonlyargs = None
 if code.co_flags  CO_VARARGS:
 varargname = varnames[argcount]
 argcount += 1
diff --git a/pypy/interpreter/test/test_code.py 
b/pypy/interpreter/test/test_code.py
--- a/pypy/interpreter/test/test_code.py
+++ b/pypy/interpreter/test/test_code.py
@@ -194,3 +194,9 @@
 # CO_NESTED
 assert d['f'](4).__code__.co_flags  0x10
 assert d['f'].__code__.co_flags  0x10 == 0
+
+def test_issue1844(self):
+import types
+args = (1, 0, 1, 0, 0, b'', (), (), (), '', 'operator', 0, b'')
+# previously raised a MemoryError when translated
+types.CodeType(*args)
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: utilize scoped allocation

2014-09-12 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: 
Changeset: r73513:e6aa1e2c6877
Date: 2014-09-12 12:13 -0700
http://bitbucket.org/pypy/pypy/changeset/e6aa1e2c6877/

Log:utilize scoped allocation

diff --git a/rpython/translator/sandbox/rsandbox.py 
b/rpython/translator/sandbox/rsandbox.py
--- a/rpython/translator/sandbox/rsandbox.py
+++ b/rpython/translator/sandbox/rsandbox.py
@@ -60,8 +60,7 @@
 
 def need_more_data(self):
 buflen = self.buflen
-buf = lltype.malloc(rffi.CCHARP.TO, buflen, flavor='raw')
-try:
+with lltype.scoped_alloc(rffi.CCHARP.TO, buflen) as buf:
 buflen = rffi.cast(rffi.SIZE_T, buflen)
 count = ll_read_not_sandboxed(self.fd, buf, buflen)
 count = rffi.cast(lltype.Signed, count)
@@ -69,20 +68,15 @@
 raise IOError
 self.buf += ''.join([buf[i] for i in range(count)])
 self.buflen *= 2
-finally:
-lltype.free(buf, flavor='raw')
 
 def sandboxed_io(buf):
 STDIN = 0
 STDOUT = 1
 # send the buffer with the marshalled fnname and input arguments to STDOUT
-p = lltype.malloc(rffi.CCHARP.TO, len(buf), flavor='raw')
-try:
+with lltype.scoped_alloc(rffi.CCHARP.TO, len(buf)) as p:
 for i in range(len(buf)):
 p[i] = buf[i]
 writeall_not_sandboxed(STDOUT, p, len(buf))
-finally:
-lltype.free(p, flavor='raw')
 # build a Loader that will get the answer from STDIN
 loader = FdLoader(STDIN)
 # check for errors
@@ -108,9 +102,8 @@
 @signature(types.str(), returns=types.impossible())
 def not_implemented_stub(msg):
 STDERR = 2
-buf = rffi.str2charp(msg + '\n')
-writeall_not_sandboxed(STDERR, buf, len(msg) + 1)
-rffi.free_charp(buf)
+with rffi.scoped_str2charp(msg + '\n') as buf:
+writeall_not_sandboxed(STDERR, buf, len(msg) + 1)
 raise RuntimeError(msg)  # XXX in RPython, the msg is ignored at the moment
 
 dump_string = rmarshal.get_marshaller(str)
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: workaround lack of __future__.__file__, as __future__'s pre-imported during

2014-09-12 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3k
Changeset: r73516:73c7d67b9c5f
Date: 2014-09-12 15:18 -0700
http://bitbucket.org/pypy/pypy/changeset/73c7d67b9c5f/

Log:workaround lack of __future__.__file__, as __future__'s pre-imported
during translation

diff --git a/lib-python/3/test/test_modulefinder.py 
b/lib-python/3/test/test_modulefinder.py
--- a/lib-python/3/test/test_modulefinder.py
+++ b/lib-python/3/test/test_modulefinder.py
@@ -9,7 +9,7 @@
 import modulefinder
 
 TEST_DIR = tempfile.mkdtemp()
-TEST_PATH = [TEST_DIR, os.path.dirname(__future__.__file__)]
+TEST_PATH = [TEST_DIR, os.path.dirname(tempfile.__file__)]
 
 # Each test description is a list of 5 items:
 #
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: pep8/use oefmt

2014-09-11 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: 
Changeset: r73476:d5039133da03
Date: 2014-07-27 11:35 -0700
http://bitbucket.org/pypy/pypy/changeset/d5039133da03/

Log:pep8/use oefmt (grafted from
6704fc912ee12bb7be511d77fd192537ca3d75e3)

diff --git a/pypy/module/operator/test/test_tscmp.py 
b/pypy/module/operator/test/test_tscmp.py
--- a/pypy/module/operator/test/test_tscmp.py
+++ b/pypy/module/operator/test/test_tscmp.py
@@ -1,5 +1,4 @@
 from pypy.module.operator.tscmp import pypy_tscmp
-from rpython.rtyper.lltypesystem.rffi import scoped_nonmovingbuffer
 
 class TestTimingSafeCompare:
 def test_tscmp_neq(self):
diff --git a/pypy/module/operator/tscmp.py b/pypy/module/operator/tscmp.py
--- a/pypy/module/operator/tscmp.py
+++ b/pypy/module/operator/tscmp.py
@@ -3,9 +3,11 @@
 attacks for the hmac module.
 
 import py
+
 from rpython.rtyper.lltypesystem import lltype, rffi
 from rpython.translator.tool.cbuild import ExternalCompilationInfo
-from pypy.interpreter.error import OperationError
+
+from pypy.interpreter.error import OperationError, oefmt
 
 cwd = py.path.local(__file__).dirpath()
 eci = ExternalCompilationInfo(
@@ -13,15 +15,21 @@
 separate_module_files=[cwd.join('tscmp.c')],
 export_symbols=['pypy_tscmp'])
 
+
 def llexternal(*args, **kwargs):
 kwargs.setdefault('compilation_info', eci)
 kwargs.setdefault('sandboxsafe', True)
 return rffi.llexternal(*args, **kwargs)
 
-pypy_tscmp = llexternal('pypy_tscmp', [rffi.CCHARP, rffi.CCHARP, rffi.LONG, 
rffi.LONG], rffi.INT)
+
+pypy_tscmp = llexternal('pypy_tscmp',
+[rffi.CCHARP, rffi.CCHARP, rffi.LONG, rffi.LONG],
+rffi.INT)
+
 
 def compare_digest(space, w_a, w_b):
-if space.isinstance_w(w_a, space.w_unicode) and space.isinstance_w(w_b, 
space.w_unicode):
+if (space.isinstance_w(w_a, space.w_unicode) and
+space.isinstance_w(w_b, space.w_unicode)):
 try:
 a_value = space.call_method(w_a, encode, space.wrap(ascii))
 b_value = space.call_method(w_b, encode, space.wrap(ascii))
@@ -29,14 +37,17 @@
 except OperationError as e:
 if not e.match(space, space.w_UnicodeEncodeError):
 raise
-raise OperationError(space.w_TypeError,
-space.wrap(comparing strings with non-ASCII characters is 
not supported))
+raise oefmt(space.w_TypeError,
+comparing strings with non-ASCII characters is not 
+supported)
 else:
 return compare_digest_buffer(space, w_a, w_b)
 
+
 def compare_digest_buffer(space, w_a, w_b):
 a = space.bufferstr_w(w_a)
 b = space.bufferstr_w(w_b)
 with rffi.scoped_nonmovingbuffer(a) as a_buffer:
 with rffi.scoped_nonmovingbuffer(b) as b_buffer:
-return space.wrap(rffi.cast(lltype.Bool, pypy_tscmp(a_buffer, 
b_buffer, len(a), len(b
+result = pypy_tscmp(a_buffer, b_buffer, len(a), len(b))
+return space.wrap(rffi.cast(lltype.Bool, result))
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: merge default

2014-09-11 Thread pjenvey
Author: Philip Jenvey pjen...@underboss.org
Branch: py3k
Changeset: r73481:1568c757e7cb
Date: 2014-09-11 13:47 -0700
http://bitbucket.org/pypy/pypy/changeset/1568c757e7cb/

Log:merge default

diff too long, truncating to 2000 out of 6687 lines

diff --git a/LICENSE b/LICENSE
--- a/LICENSE
+++ b/LICENSE
@@ -35,280 +35,290 @@
 the beginning of each file) the files in the 'pypy' directory are each
 copyrighted by one or more of the following people and organizations:
 
-Armin Rigo
-Maciej Fijalkowski
-Carl Friedrich Bolz
-Antonio Cuni
-Amaury Forgeot d'Arc
-Samuele Pedroni
-Alex Gaynor
-Michael Hudson
-David Schneider
-Matti Picus
-Brian Kearns
-Philip Jenvey
-Holger Krekel
-Christian Tismer
-Hakan Ardo
-Benjamin Peterson
-Manuel Jacob
-Anders Chrigstrom
-Eric van Riet Paap
-Wim Lavrijsen
-Ronan Lamy
-Richard Emslie
-Alexander Schremmer
-Dan Villiom Podlaski Christiansen
-Lukas Diekmann
-Sven Hager
-Anders Lehmann
-Aurelien Campeas
-Niklaus Haldimann
-Camillo Bruni
-Laura Creighton
-Toon Verwaest
-Remi Meier
-Leonardo Santagada
-Seo Sanghyeon
-Romain Guillebert
-Justin Peel
-Ronny Pfannschmidt
-David Edelsohn
-Anders Hammarquist
-Jakub Gustak
-Guido Wesdorp
-Lawrence Oluyede
-Bartosz Skowron
-Daniel Roberts
-Niko Matsakis
-Adrien Di Mascio
-Alexander Hesse
-Ludovic Aubry
-Jacob Hallen
-Jason Creighton
-Alex Martelli
-Michal Bendowski
-Jan de Mooij
-stian
-Michael Foord
-Stephan Diehl
-Stefan Schwarzer
-Valentino Volonghi
-Tomek Meka
-Patrick Maupin
-Bob Ippolito
-Bruno Gola
-Jean-Paul Calderone
-Timo Paulssen
-Squeaky
-Alexandre Fayolle
-Simon Burton
-Marius Gedminas
-John Witulski
-Konstantin Lopuhin
-Greg Price
-Dario Bertini
-Mark Pearse
-Simon Cross
-Andreas St#252;hrk
-Jean-Philippe St. Pierre
-Guido van Rossum
-Pavel Vinogradov
-Pawe#322; Piotr Przeradowski
-Paul deGrandis
-Ilya Osadchiy
-Tobias Oberstein
-Adrian Kuhn
-Boris Feigin
-Stefano Rivera
-tav
-Taavi Burns
-Georg Brandl
-Bert Freudenberg
-Stian Andreassen
-Laurence Tratt
-Wanja Saatkamp
-Ivan Sichmann Freitas
-Gerald Klix
-Mike Blume
-Oscar Nierstrasz
-Stefan H. Muller
-Jeremy Thurgood
-Gregor Wegberg
-Rami Chowdhury
-Tobias Pape
-Edd Barrett
-David Malcolm
-Eugene Oden
-Henry Mason
-Preston Timmons
-Jeff Terrace
-David Ripton
-Dusty Phillips
-Lukas Renggli
-Guenter Jantzen
-Ned Batchelder
-Amit Regmi
-Ben Young
-Nicolas Chauvat
-Andrew Durdin
-Andrew Chambers
-Michael Schneider
-Nicholas Riley
-Jason Chu
-Igor Trindade Oliveira
-Rocco Moretti
-Gintautas Miliauskas
-Michael Twomey
-Lucian Branescu Mihaila
-Tim Felgentreff
-Tyler Wade
-Gabriel Lavoie
-Olivier Dormond
-Jared Grubb
-Karl Bartel
-Brian Dorsey
-Victor Stinner
-Andrews Medina
-Stuart Williams
-Jasper Schulz
-Christian Hudon
-Toby Watson
-Antoine Pitrou
-Aaron Iles
-Michael Cheng
-Justas Sadzevicius
-Mikael Sch#246;nenberg
-Gasper Zejn
-Neil Shepperd
-Elmo M#228;ntynen
-Jonathan David Riehl
-Stanislaw Halik
-Anders Qvist
-Chirag Jadwani
-Beatrice During
-Alex Perry
-Vincent Legoll
-Alan McIntyre
-Alexander Sedov
-Corbin Simpson
-Christopher Pope
-wenzhuman
-Christian Tismer 
-Marc Abramowitz
-Dan Stromberg
-Stefano Parmesan
-Alexis Daboville
-Jens-Uwe Mager
-Carl Meyer
-Karl Ramm
-Pieter Zieschang
-Gabriel
-Lukas Vacek
-Andrew Dalke
-Sylvain Thenault
-Nathan Taylor
-Vladimir Kryachko
-Jacek Generowicz
-Alejandro J. Cura
-Jacob Oscarson
-Travis Francis Athougies
-Ryan Gonzalez
-Kristjan Valur Jonsson
-Sebastian Pawlu#347;
-Neil Blakey-Milner
-anatoly techtonik
-Lutz Paelike
-Lucio Torre
-Lars Wassermann
-Henrik Vendelbo
-Dan Buch
-Miguel de Val Borro
-Artur Lisiecki
-Sergey Kishchenko
-Ignas Mikalajunas
-Christoph Gerum
-Martin Blais
-Lene Wagner
-Tomo Cocoa
-roberto@goyle
-Yury V. Zaytsev
-Anna Katrina Dominguez
-William Leslie
-Bobby Impollonia
-t...@eistee.fritz.box
-Andrew Thompson
-Ben Darnell
-Roberto De Ioris
-Juan Francisco Cantero Hurtado
-Godefroid Chappelle
-Joshua Gilbert
-Dan Colish
-Christopher Armstrong
-Michael Hudson-Doyle
-Anders Sigfridsson
-Yasir Suhail
-rafalgalczyn...@gmail.com
-Floris Bruynooghe
-Laurens Van Houtven
-Akira Li
-Gustavo Niemeyer
-Stephan Busemann
-Rafa#322; Ga#322;czy#324;ski

<    1   2   3   4   5   6   7   8   9   10   >