[pypy-commit] pypy zlib-copying-third-time-a-charm: Whatsnew.

2019-02-06 Thread Julian Berman
Author: Julian Berman 
Branch: zlib-copying-third-time-a-charm
Changeset: r95881:a95cf340ec7c
Date: 2019-02-07 07:56 +0100
http://bitbucket.org/pypy/pypy/changeset/a95cf340ec7c/

Log:Whatsnew.

diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst
--- a/pypy/doc/whatsnew-head.rst
+++ b/pypy/doc/whatsnew-head.rst
@@ -5,6 +5,11 @@
 .. this is a revision shortly after release-pypy-7.0.0
 .. startrev: 481c69f7d81f
 
+.. branch: zlib-copying-third-time-a-charm
+
+Make sure zlib decompressobjs have their streams deallocated immediately
+on flush.
+
 .. branch: zlib-copying-redux
 
 Fix calling copy on already-flushed compressobjs.
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy zlib-copying-third-time-a-charm: Notice when we're copying a flushed decompressobj too.

2019-02-06 Thread Julian Berman
Author: Julian Berman 
Branch: zlib-copying-third-time-a-charm
Changeset: r95880:1c38b412ceb1
Date: 2019-02-07 07:54 +0100
http://bitbucket.org/pypy/pypy/changeset/1c38b412ceb1/

Log:Notice when we're copying a flushed decompressobj too.

Hopefully we go green. Otherwise we go home...

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
@@ -323,12 +323,16 @@
 try:
 self.lock()
 try:
+if not self.stream:
+raise oefmt(
+space.w_ValueError,
+"Decompressor was already flushed",
+)
 copied = rzlib.inflateCopy(self.stream)
 finally:
 self.unlock()
 except rzlib.RZlibError as e:
 raise zlib_error(space, e.msg)
-
 return Decompress(
 space=space,
 stream=copied,
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy zlib-copying-third-time-a-charm: Immediately free the z_stream after flushing a decompressobj.

2019-02-06 Thread Julian Berman
Author: Julian Berman 
Branch: zlib-copying-third-time-a-charm
Changeset: r95879:4ae1b51c0133
Date: 2019-02-07 07:53 +0100
http://bitbucket.org/pypy/pypy/changeset/4ae1b51c0133/

Log:Immediately free the z_stream after flushing a decompressobj.

Matches what CPython does, and doesn't wait for the finalizer, but
more importantly will help us actually pass the lib-python test in a
minute...

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
@@ -359,6 +359,9 @@
 else:
 string, finished, unused_len = result
 self._save_unconsumed_input(data, finished, unused_len)
+if finished:
+rzlib.inflateEnd(self.stream)
+self.stream = rzlib.null_stream
 return space.newbytes(string)
 
 
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy.org extradoc: (antocuni, mattip): update the website for the new release; only the source, the HTML will be regenerated/uploaded later

2019-02-06 Thread antocuni
Author: Antonio Cuni 
Branch: extradoc
Changeset: r930:3d49c68495b0
Date: 2019-02-06 18:33 +0100
http://bitbucket.org/pypy/pypy.org/changeset/3d49c68495b0/

Log:(antocuni, mattip): update the website for the new release; only the
source, the HTML will be regenerated/uploaded later

diff --git a/source/download.txt b/source/download.txt
--- a/source/download.txt
+++ b/source/download.txt
@@ -13,16 +13,17 @@
   performance improvements.
 
 We provide binaries for x86, ARM, PPC and s390x running on different operating 
systems such as
-Linux, Mac OS X and Windows:
+Linux, Mac OS X and Windows (`what's new in PyPy 7.0?`_):
 
-* the Python2.7 compatible release  **PyPy2.7 v6.0**  (`what's 
new in PyPy2.7?`_)
+* the Python2.7 compatible release  **PyPy2.7 v7.0**
 
-* the Python3.5 compatible release  **PyPy3.5 v6.0**  (`what's 
new in PyPy3.5?`_).
+* the Python3.5 compatible release  **PyPy3.5 v7.0**
+
+* the Python3.6 compatible release, alpha quality  **PyPy3.6 v7.0**
 
 * the Python2.7 Software Transactional Memory special release  
**PyPy-STM 2.5.1** (Linux x86-64 only)
 
-.. _what's new in PyPy2.7?: http://doc.pypy.org/en/latest/release-v6.0.0.html
-.. _what's new in PyPy3.5?: http://doc.pypy.org/en/latest/release-v6.0.0.html
+.. _what's new in PyPy 7.0?: http://doc.pypy.org/en/latest/release-v7.0.0.html
 
 
 .. class:: download_menu
@@ -79,15 +80,13 @@
 
 .. _release:
 
-Python2.7 compatible PyPy 6.0.0
+Python2.7 compatible PyPy 7.0
 ---
 
 .. class:: download_menu
 
 * `Linux x86 binary (32bit, built on Ubuntu 12.04 - 16.04)`__ (see ``[1]`` 
below)
 * `Linux x86-64 binary (64bit, built on Ubuntu 12.04 - 16.04)`__ (see ``[1]`` 
below)
-* `ARM Hardfloat Linux binary (ARMHF/gnueabihf, Raspbian)`__ (see ``[1]`` 
below)
-* `ARM Hardfloat Linux binary (ARMHF/gnueabihf, Ubuntu Raring)`__ (see ``[1]`` 
below)
 * `Mac OS X binary (64bit)`__
 * FreeBSD x86 and x86_64: see FreshPorts_
 * `Windows binary (32bit)`__ (you might need the VS 2008 runtime library
@@ -99,31 +98,27 @@
 * `All our downloads,`__ including previous versions.  We also have a
   mirror_, but please use only if you have troubles accessing the links above
 
-.. __: https://bitbucket.org/pypy/pypy/downloads/pypy2-v6.0.0-linux32.tar.bz2
-.. __: https://bitbucket.org/pypy/pypy/downloads/pypy2-v6.0.0-linux64.tar.bz2
-.. __: 
https://bitbucket.org/pypy/pypy/downloads/pypy2-v6.0.0-linux-armhf-raspbian.tar.bz2
-.. __: 
https://bitbucket.org/pypy/pypy/downloads/pypy2-v6.0.0-linux-armel.tar.bz2
-.. __: https://bitbucket.org/pypy/pypy/downloads/pypy2-v6.0.0-osx64.tar.bz2
-.. __: https://bitbucket.org/pypy/pypy/downloads/pypy2-v6.0.0-win32.zip
-.. __: https://bitbucket.org/pypy/pypy/downloads/pypy2-v5.10.0-ppc64.tar.bz2
-.. __: https://bitbucket.org/pypy/pypy/downloads/pypy2-v5.10.0-ppc64le.tar.bz2
-.. __: https://bitbucket.org/pypy/pypy/downloads/pypy2-v6.0.0-s390x.tar.bz2
-.. __: https://bitbucket.org/pypy/pypy/downloads/pypy2-v6.0.0-src.tar.bz2
-.. __: https://bitbucket.org/pypy/pypy/downloads/pypy2-v6.0.0-src.zip
+.. __: https://bitbucket.org/pypy/pypy/downloads/pypy2-v7.0.0-linux32.tar.bz2
+.. __: https://bitbucket.org/pypy/pypy/downloads/pypy2-v7.0.0-linux64.tar.bz2
+.. __: https://bitbucket.org/pypy/pypy/downloads/pypy2-v7.0.0-osx64.tar.bz2
+.. __: https://bitbucket.org/pypy/pypy/downloads/pypy2-v7.0.0-win32.zip
+.. __: https://bitbucket.org/pypy/pypy/downloads/pypy2-v7.0.0-ppc64.tar.bz2
+.. __: https://bitbucket.org/pypy/pypy/downloads/pypy2-v7.0.0-ppc64le.tar.bz2
+.. __: https://bitbucket.org/pypy/pypy/downloads/pypy2-v7.0.0-s390x.tar.bz2
+.. __: https://bitbucket.org/pypy/pypy/downloads/pypy2-v7.0.0-src.tar.bz2
+.. __: https://bitbucket.org/pypy/pypy/downloads/pypy2-v7.0.0-src.zip
 .. _`vcredist_x86.exe`: 
http://www.microsoft.com/en-us/download/details.aspx?id=5582
 .. __: https://bitbucket.org/pypy/pypy/downloads
 .. _mirror: http://buildbot.pypy.org/mirror/
 .. _FreshPorts: http://www.freshports.org/lang/pypy
 
-Python 3.5.3 compatible PyPy3.5 v6.0.0
+Python 3.5.3 compatible PyPy3.5 v7.0.0
 ---
 
 .. class:: download_menu
 
 * `Linux x86 binary (32bit, built on Ubuntu 12.04 - 16.04)`__ (see ``[1]`` 
below)
 * `Linux x86-64 binary (64bit, built on Ubuntu 12.04 - 16.04)`__ (see ``[1]`` 
below)
-* `ARM Hardfloat Linux binary (ARMHF/gnueabihf, Raspbian)`__ (see ``[1]`` 
below)
-* `ARM Softfloat Linux binary (ARMEL/gnueabi, Ubuntu Raring)`__ (see ``[1]`` 
below)
 * `Mac OS X binary (64bit)`__ (High Sierra >= 10.13, not for Sierra and below)
 * `Windows binary (32bit)`__ **BETA** 
 * `s390x Linux binary (built on Redhat Linux 7.2)`__ (see ``[1]`` below)
@@ -131,15 +126,13 @@
 * `All our downloads,`__ including previous versions.  We also have a
   mirror_, but please use only if you have troubles accessing the links above
 
-.. __: https://bitbucket.org/pypy/pypy/downloads/pypy3-v6.0.0-linux32.tar.bz2
-.. __: 

[pypy-commit] pypy default: commit the tweaked version of the script which I used for the release

2019-02-06 Thread antocuni
Author: Antonio Cuni 
Branch: 
Changeset: r95878:4c920e4d6d68
Date: 2019-02-06 18:11 +0100
http://bitbucket.org/pypy/pypy/changeset/4c920e4d6d68/

Log:commit the tweaked version of the script which I used for the
release

diff --git a/pypy/tool/release/repackage.sh b/pypy/tool/release/repackage.sh
--- a/pypy/tool/release/repackage.sh
+++ b/pypy/tool/release/repackage.sh
@@ -1,7 +1,7 @@
 # Edit these appropriately before running this script
 pmaj=2  # python main version
 pmin=7  # python minor version
-maj=6
+maj=7
 min=0
 rev=0
 branchname=release-pypy$pmaj.$pmin-$maj.x # ==OR== release-$maj.x  # ==OR== 
release-$maj.$min.x
@@ -13,7 +13,7 @@
 hg log -r $tagname || exit 1
 hgrev=`hg id -r $tagname -i`
 
-rel=pypy$pmaj-v$maj.$min.$rev
+rel=pypy$pmaj.$pmin-v$maj.$min.$rev
 # The script should be run in an empty in the pypy tree, i.e. pypy/tmp
 if [ "`ls . | wc -l`" != "0" ]
 then
@@ -23,7 +23,7 @@
 
 # Download latest builds from the buildmaster, rename the top
 # level directory, and repackage ready to be uploaded to bitbucket
-for plat in linux linux64 linux-armhf-raspbian linux-armel osx64 s390x
+for plat in linux linux64 osx64 s390x # linux-armhf-raspbian linux-armel
   do
 echo downloading package for $plat
 if wget -q --show-progress 
http://buildbot.pypy.org/nightly/$branchname/pypy-c-jit-latest-$plat.tar.bz2
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy unicode-utf8-py3: Kill dead code

2019-02-06 Thread rlamy
Author: Ronan Lamy 
Branch: unicode-utf8-py3
Changeset: r95875:daa08b2d951c
Date: 2019-02-06 14:56 +0100
http://bitbucket.org/pypy/pypy/changeset/daa08b2d951c/

Log:Kill dead code

diff --git a/pypy/module/array/interp_array.py 
b/pypy/module/array/interp_array.py
--- a/pypy/module/array/interp_array.py
+++ b/pypy/module/array/interp_array.py
@@ -1033,11 +1033,6 @@
 "unsigned %d-byte integer out of range",
 mytype.bytes)
 return rffi.cast(mytype.itemtype, item)
-if mytype.unwrap == 'unicode_w':
-if len(item) != 1:
-raise oefmt(space.w_TypeError, "array item must be char")
-item = item[0]
-return rffi.cast(mytype.itemtype, item)
 if mytype.unwrap == 'utf8_len_w':
 utf8, lgt = item
 if lgt != 1:
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: Added tag release-pypy3.5-v7.0.0 for changeset 1f86f25937b6

2019-02-06 Thread antocuni
Author: Antonio Cuni 
Branch: 
Changeset: r95872:13e6a9467268
Date: 2019-02-06 14:15 +0100
http://bitbucket.org/pypy/pypy/changeset/13e6a9467268/

Log:Added tag release-pypy3.5-v7.0.0 for changeset 1f86f25937b6

diff --git a/.hgtags b/.hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -59,3 +59,4 @@
 ab0b9caf307db6592905a80b8faffd69b39005b8 release-pypy2.7-v6.0.0
 fdd60ed87e941677e8ea11acf9f1819466521bf2 release-pypy3.5-v6.0.0
 9112c8071614108b1042bfef0713915107004d62 release-pypy2.7-v7.0.0
+1f86f25937b6ae6c8b25236c35228fac587678bf release-pypy3.5-v7.0.0
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: merge heads

2019-02-06 Thread antocuni
Author: Antonio Cuni 
Branch: 
Changeset: r95874:35673b0b2571
Date: 2019-02-06 14:21 +0100
http://bitbucket.org/pypy/pypy/changeset/35673b0b2571/

Log:merge heads

diff --git a/pypy/module/zlib/test/test_zlib.py 
b/pypy/module/zlib/test/test_zlib.py
--- a/pypy/module/zlib/test/test_zlib.py
+++ b/pypy/module/zlib/test/test_zlib.py
@@ -35,6 +35,8 @@
 compression and decompression tests have a little real data to assert
 against.
 """
+cls.w_runappdirect = cls.space.wrap(cls.runappdirect)
+
 cls.w_zlib = cls.space.getbuiltinmodule('zlib')
 expanded = 'some bytes which will be compressed'
 cls.w_expanded = cls.space.wrap(expanded)
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: Added tag release-pypy3.6-v7.0.0 for changeset dab365a46514

2019-02-06 Thread antocuni
Author: Antonio Cuni 
Branch: 
Changeset: r95873:e239e0b2814c
Date: 2019-02-06 14:15 +0100
http://bitbucket.org/pypy/pypy/changeset/e239e0b2814c/

Log:Added tag release-pypy3.6-v7.0.0 for changeset dab365a46514

diff --git a/.hgtags b/.hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -60,3 +60,4 @@
 fdd60ed87e941677e8ea11acf9f1819466521bf2 release-pypy3.5-v6.0.0
 9112c8071614108b1042bfef0713915107004d62 release-pypy2.7-v7.0.0
 1f86f25937b6ae6c8b25236c35228fac587678bf release-pypy3.5-v7.0.0
+dab365a465140aa79a5f3ba4db784c4af4d5c195 release-pypy3.6-v7.0.0
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: Added tag release-pypy2.7-v7.0.0 for changeset 9112c8071614

2019-02-06 Thread antocuni
Author: Antonio Cuni 
Branch: 
Changeset: r95871:a41775a6bcf2
Date: 2019-02-06 14:14 +0100
http://bitbucket.org/pypy/pypy/changeset/a41775a6bcf2/

Log:Added tag release-pypy2.7-v7.0.0 for changeset 9112c8071614

diff --git a/.hgtags b/.hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -58,3 +58,4 @@
 3f6eaa010fce78cc7973bdc1dfdb95970f08fed2 release-pypy3.5-v5.10.1
 ab0b9caf307db6592905a80b8faffd69b39005b8 release-pypy2.7-v6.0.0
 fdd60ed87e941677e8ea11acf9f1819466521bf2 release-pypy3.5-v6.0.0
+9112c8071614108b1042bfef0713915107004d62 release-pypy2.7-v7.0.0
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: This appears to be necessary to actually have runappdirect available for app tests.

2019-02-06 Thread Julian Berman
Author: Julian Berman 
Branch: 
Changeset: r95870:fee9d13fa77c
Date: 2019-02-06 14:18 +0100
http://bitbucket.org/pypy/pypy/changeset/fee9d13fa77c/

Log:This appears to be necessary to actually have runappdirect available
for app tests.

diff --git a/pypy/module/zlib/test/test_zlib.py 
b/pypy/module/zlib/test/test_zlib.py
--- a/pypy/module/zlib/test/test_zlib.py
+++ b/pypy/module/zlib/test/test_zlib.py
@@ -35,6 +35,8 @@
 compression and decompression tests have a little real data to assert
 against.
 """
+cls.w_runappdirect = cls.space.wrap(cls.runappdirect)
+
 cls.w_zlib = cls.space.getbuiltinmodule('zlib')
 expanded = 'some bytes which will be compressed'
 cls.w_expanded = cls.space.wrap(expanded)
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3.5: Merge default.

2019-02-06 Thread Julian Berman
Author: Julian Berman 
Branch: py3.5
Changeset: r95869:5186243836bc
Date: 2019-02-06 12:24 +0100
http://bitbucket.org/pypy/pypy/changeset/5186243836bc/

Log:Merge default.

diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst
--- a/pypy/doc/whatsnew-head.rst
+++ b/pypy/doc/whatsnew-head.rst
@@ -5,6 +5,10 @@
 .. this is a revision shortly after release-pypy-7.0.0
 .. startrev: 481c69f7d81f
 
+.. branch: zlib-copying-redux
+
+Fix calling copy on already-flushed compressobjs.
+
 .. branch: zlib-copying
 
 The zlib module's compressobj and decompressobj now expose copy methods
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
@@ -154,6 +154,11 @@
 try:
 self.lock()
 try:
+if not self.stream:
+raise oefmt(
+space.w_ValueError,
+"Compressor was already flushed",
+)
 copied = rzlib.deflateCopy(self.stream)
 finally:
 self.unlock()
@@ -308,9 +313,6 @@
 try:
 self.lock()
 try:
-if not self.stream:
-raise zlib_error(space,
- "decompressor object already flushed")
 copied = rzlib.inflateCopy(self.stream)
 finally:
 self.unlock()
diff --git a/pypy/module/zlib/test/test_zlib.py 
b/pypy/module/zlib/test/test_zlib.py
--- a/pypy/module/zlib/test/test_zlib.py
+++ b/pypy/module/zlib/test/test_zlib.py
@@ -366,7 +366,8 @@
 
 assert (d1 + from_copy) == (d1 + from_decompressor)
 
-def test_unsuccessful_decompress_copy(self):
+def test_cannot_copy_decompressor_with_stream_in_inconsistent_state(self):
+if self.runappdirect: skip("can't run with -A")
 decompressor = self.zlib.decompressobj()
 self.intentionally_break_a_z_stream(zobj=decompressor)
 raises(self.zlib.error, decompressor.copy)
@@ -400,7 +401,13 @@
 
 assert (d1 + from_copy) == (d1 + from_compressor)
 
-def test_unsuccessful_compress_copy(self):
+def test_cannot_copy_compressor_with_stream_in_inconsistent_state(self):
+if self.runappdirect: skip("can't run with -A")
 compressor = self.zlib.compressobj()
 self.intentionally_break_a_z_stream(zobj=compressor)
 raises(self.zlib.error, compressor.copy)
+
+def test_cannot_copy_compressor_with_flushed_stream(self):
+compressor = self.zlib.compressobj()
+compressor.flush()
+raises(ValueError, compressor.copy)
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy 35windowsfixes: Closed branch. The commit was grafted into the default branch

2019-02-06 Thread andrewjlawrence
Author: andrewjlawrence
Branch: 35windowsfixes
Changeset: r95868:284828e44f37
Date: 2019-02-06 11:08 +
http://bitbucket.org/pypy/pypy/changeset/284828e44f37/

Log:Closed branch. The commit was grafted into the default branch

___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: Merge default heads

2019-02-06 Thread Julian Berman
Author: Julian Berman 
Branch: 
Changeset: r95867:60fa14799cf4
Date: 2019-02-06 12:06 +0100
http://bitbucket.org/pypy/pypy/changeset/60fa14799cf4/

Log:Merge default heads

diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst
--- a/pypy/doc/whatsnew-head.rst
+++ b/pypy/doc/whatsnew-head.rst
@@ -5,6 +5,10 @@
 .. this is a revision shortly after release-pypy-7.0.0
 .. startrev: 481c69f7d81f
 
+.. branch: zlib-copying-redux
+
+Fix calling copy on already-flushed compressobjs.
+
 .. branch: zlib-copying
 
 The zlib module's compressobj and decompressobj now expose copy methods
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
@@ -175,6 +175,11 @@
 try:
 self.lock()
 try:
+if not self.stream:
+raise oefmt(
+space.w_ValueError,
+"Compressor was already flushed",
+)
 copied = rzlib.deflateCopy(self.stream)
 finally:
 self.unlock()
@@ -318,9 +323,6 @@
 try:
 self.lock()
 try:
-if not self.stream:
-raise zlib_error(space,
- "decompressor object already flushed")
 copied = rzlib.inflateCopy(self.stream)
 finally:
 self.unlock()
diff --git a/pypy/module/zlib/test/test_zlib.py 
b/pypy/module/zlib/test/test_zlib.py
--- a/pypy/module/zlib/test/test_zlib.py
+++ b/pypy/module/zlib/test/test_zlib.py
@@ -307,7 +307,8 @@
 
 assert (d1 + from_copy) == (d1 + from_decompressor)
 
-def test_unsuccessful_decompress_copy(self):
+def test_cannot_copy_decompressor_with_stream_in_inconsistent_state(self):
+if self.runappdirect: skip("can't run with -A")
 decompressor = self.zlib.decompressobj()
 self.intentionally_break_a_z_stream(zobj=decompressor)
 raises(self.zlib.error, decompressor.copy)
@@ -341,7 +342,13 @@
 
 assert (d1 + from_copy) == (d1 + from_compressor)
 
-def test_unsuccessful_compress_copy(self):
+def test_cannot_copy_compressor_with_stream_in_inconsistent_state(self):
+if self.runappdirect: skip("can't run with -A")
 compressor = self.zlib.compressobj()
 self.intentionally_break_a_z_stream(zobj=compressor)
 raises(self.zlib.error, compressor.copy)
+
+def test_cannot_copy_compressor_with_flushed_stream(self):
+compressor = self.zlib.compressobj()
+compressor.flush()
+raises(ValueError, compressor.copy)
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: Merge zlib-copying-redux

2019-02-06 Thread Julian Berman
Author: Julian Berman 
Branch: 
Changeset: r95865:ec33801be3ff
Date: 2019-02-06 11:43 +0100
http://bitbucket.org/pypy/pypy/changeset/ec33801be3ff/

Log:Merge zlib-copying-redux

diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst
--- a/pypy/doc/whatsnew-head.rst
+++ b/pypy/doc/whatsnew-head.rst
@@ -5,6 +5,10 @@
 .. this is a revision shortly after release-pypy-7.0.0
 .. startrev: 481c69f7d81f
 
+.. branch: zlib-copying-redux
+
+Fix calling copy on already-flushed compressobjs.
+
 .. branch: zlib-copying
 
 The zlib module's compressobj and decompressobj now expose copy methods
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
@@ -175,6 +175,11 @@
 try:
 self.lock()
 try:
+if not self.stream:
+raise oefmt(
+space.w_ValueError,
+"Compressor was already flushed",
+)
 copied = rzlib.deflateCopy(self.stream)
 finally:
 self.unlock()
@@ -318,9 +323,6 @@
 try:
 self.lock()
 try:
-if not self.stream:
-raise zlib_error(space,
- "decompressor object already flushed")
 copied = rzlib.inflateCopy(self.stream)
 finally:
 self.unlock()
diff --git a/pypy/module/zlib/test/test_zlib.py 
b/pypy/module/zlib/test/test_zlib.py
--- a/pypy/module/zlib/test/test_zlib.py
+++ b/pypy/module/zlib/test/test_zlib.py
@@ -307,7 +307,8 @@
 
 assert (d1 + from_copy) == (d1 + from_decompressor)
 
-def test_unsuccessful_decompress_copy(self):
+def test_cannot_copy_decompressor_with_stream_in_inconsistent_state(self):
+if self.runappdirect: skip("can't run with -A")
 decompressor = self.zlib.decompressobj()
 self.intentionally_break_a_z_stream(zobj=decompressor)
 raises(self.zlib.error, decompressor.copy)
@@ -341,7 +342,13 @@
 
 assert (d1 + from_copy) == (d1 + from_compressor)
 
-def test_unsuccessful_compress_copy(self):
+def test_cannot_copy_compressor_with_stream_in_inconsistent_state(self):
+if self.runappdirect: skip("can't run with -A")
 compressor = self.zlib.compressobj()
 self.intentionally_break_a_z_stream(zobj=compressor)
 raises(self.zlib.error, compressor.copy)
+
+def test_cannot_copy_compressor_with_flushed_stream(self):
+compressor = self.zlib.compressobj()
+compressor.flush()
+raises(ValueError, compressor.copy)
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: Merge default

2019-02-06 Thread Julian Berman
Author: Julian Berman 
Branch: 
Changeset: r95866:24f1b599a64d
Date: 2019-02-06 11:59 +0100
http://bitbucket.org/pypy/pypy/changeset/24f1b599a64d/

Log:Merge default

diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst
--- a/pypy/doc/whatsnew-head.rst
+++ b/pypy/doc/whatsnew-head.rst
@@ -5,6 +5,10 @@
 .. this is a revision shortly after release-pypy-7.0.0
 .. startrev: 481c69f7d81f
 
+.. branch: zlib-copying-redux
+
+Fix calling copy on already-flushed compressobjs.
+
 .. branch: zlib-copying
 
 The zlib module's compressobj and decompressobj now expose copy methods
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
@@ -175,6 +175,11 @@
 try:
 self.lock()
 try:
+if not self.stream:
+raise oefmt(
+space.w_ValueError,
+"Compressor was already flushed",
+)
 copied = rzlib.deflateCopy(self.stream)
 finally:
 self.unlock()
@@ -318,9 +323,6 @@
 try:
 self.lock()
 try:
-if not self.stream:
-raise zlib_error(space,
- "decompressor object already flushed")
 copied = rzlib.inflateCopy(self.stream)
 finally:
 self.unlock()
diff --git a/pypy/module/zlib/test/test_zlib.py 
b/pypy/module/zlib/test/test_zlib.py
--- a/pypy/module/zlib/test/test_zlib.py
+++ b/pypy/module/zlib/test/test_zlib.py
@@ -307,7 +307,8 @@
 
 assert (d1 + from_copy) == (d1 + from_decompressor)
 
-def test_unsuccessful_decompress_copy(self):
+def test_cannot_copy_decompressor_with_stream_in_inconsistent_state(self):
+if self.runappdirect: skip("can't run with -A")
 decompressor = self.zlib.decompressobj()
 self.intentionally_break_a_z_stream(zobj=decompressor)
 raises(self.zlib.error, decompressor.copy)
@@ -341,7 +342,13 @@
 
 assert (d1 + from_copy) == (d1 + from_compressor)
 
-def test_unsuccessful_compress_copy(self):
+def test_cannot_copy_compressor_with_stream_in_inconsistent_state(self):
+if self.runappdirect: skip("can't run with -A")
 compressor = self.zlib.compressobj()
 self.intentionally_break_a_z_stream(zobj=compressor)
 raises(self.zlib.error, compressor.copy)
+
+def test_cannot_copy_compressor_with_flushed_stream(self):
+compressor = self.zlib.compressobj()
+compressor.flush()
+raises(ValueError, compressor.copy)
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3.5: hg merge default

2019-02-06 Thread ambv
Author: ukasz Langa 
Branch: py3.5
Changeset: r95863:706d2757733b
Date: 2019-02-06 12:01 +0100
http://bitbucket.org/pypy/pypy/changeset/706d2757733b/

Log:hg merge default

diff --git a/.hgignore b/.hgignore
--- a/.hgignore
+++ b/.hgignore
@@ -4,8 +4,10 @@
 *~
 .*.swp
 .idea
+.mypy_cache
 .project
 .pydevproject
+.vscode
 __pycache__
 .venv
 .cache
diff --git a/rpython/rtyper/lltypesystem/module/test/math_cases.py 
b/rpython/rtyper/lltypesystem/module/test/math_cases.py
--- a/rpython/rtyper/lltypesystem/module/test/math_cases.py
+++ b/rpython/rtyper/lltypesystem/module/test/math_cases.py
@@ -59,9 +59,6 @@
 ('copysign', (1.5, -0.0), -1.5),
 ('copysign', (1.5, INFINITY), 1.5),
 ('copysign', (1.5, -INFINITY), -1.5),
-]
-if sys.platform != 'win32':# all NaNs seem to be negative there...?
-IRREGCASES += [
 ('copysign', (1.5, NAN), 1.5),
 ('copysign', (1.75, -NAN), -1.75),  # special case for -NAN here
 ]
diff --git a/rpython/translator/c/primitive.py 
b/rpython/translator/c/primitive.py
--- a/rpython/translator/c/primitive.py
+++ b/rpython/translator/c/primitive.py
@@ -123,9 +123,9 @@
 return '(-Py_HUGE_VAL)'
 elif math.isnan(value):
 if is_positive_nan(value):
-return '(Py_HUGE_VAL/Py_HUGE_VAL)'
+return '(_PyPy_dg_stdnan(0))'
 else:
-return '(-(Py_HUGE_VAL/Py_HUGE_VAL))'
+return '(_PyPy_dg_stdnan(1))'
 else:
 x = repr(value)
 assert not x.startswith('n')
@@ -142,9 +142,9 @@
 elif math.isnan(value):
 # XXX are these expressions ok?
 if is_positive_nan(value):
-return '((float)(Py_HUGE_VAL/Py_HUGE_VAL))'
+return '((float)(_PyPy_dg_stdnan(0)))'
 else:
-return '(-(float)(Py_HUGE_VAL/Py_HUGE_VAL))'
+return '((float)(_PyPy_dg_stdnan(1)))'
 else:
 return repr(value) + 'f'
 
diff --git a/rpython/translator/c/src/support.c 
b/rpython/translator/c/src/support.c
--- a/rpython/translator/c/src/support.c
+++ b/rpython/translator/c/src/support.c
@@ -9,6 +9,26 @@
 #include 
 
 /*** misc ***/
+#define Sign_bit 0x8000
+#define NAN_WORD0 0x7ff8
+#define NAN_WORD1 0
+#define PY_UINT32_T unsigned int
+
+#ifndef __BIG_ENDIAN__
+#define IEEE_8087
+#endif
+
+#ifdef IEEE_8087
+#define word0(x) (x)->L[1]
+#define word1(x) (x)->L[0]
+#else
+#define word0(x) (x)->L[0]
+#define word1(x) (x)->L[1]
+#endif
+#define dval(x) (x)->d
+
+typedef PY_UINT32_T ULong;
+typedef union { double d; ULong L[2]; } U;
 
 RPY_EXTERN
 void RPyAssertFailed(const char* filename, long lineno,
@@ -25,3 +45,20 @@
   fprintf(stderr, "Invalid RPython operation (NULL ptr or bad array index)\n");
   abort();
 }
+
+/* Return a 'standard' NaN value.
+   There are exactly two quiet NaNs that don't arise by 'quieting' signaling
+   NaNs (see IEEE 754-2008, section 6.2.1).  If sign == 0, return the one whose
+   sign bit is cleared.  Otherwise, return the one whose sign bit is set.
+*/
+
+double
+_PyPy_dg_stdnan(int sign)
+{
+U rv;
+word0() = NAN_WORD0;
+word1() = NAN_WORD1;
+if (sign)
+word0() |= Sign_bit;
+return dval();
+}
diff --git a/rpython/translator/c/src/support.h 
b/rpython/translator/c/src/support.h
--- a/rpython/translator/c/src/support.h
+++ b/rpython/translator/c/src/support.h
@@ -38,6 +38,9 @@
 RPY_EXTERN
 void RPyAbort(void);
 
+RPY_EXTERN
+double _PyPy_dg_stdnan(int sign);
+
 #if defined(RPY_LL_ASSERT) || defined(RPY_SANDBOXED)
 /* obscure macros that can be used as expressions and lvalues to refer
  * to a field of a structure or an item in an array in a "safe" way --
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: [.hgignore] Add mypy_cache and vscode

2019-02-06 Thread ambv
Author: ukasz Langa 
Branch: 
Changeset: r95862:1a36a013597d
Date: 2019-02-06 12:00 +0100
http://bitbucket.org/pypy/pypy/changeset/1a36a013597d/

Log:[.hgignore] Add mypy_cache and vscode

diff --git a/.hgignore b/.hgignore
--- a/.hgignore
+++ b/.hgignore
@@ -4,8 +4,10 @@
 *~
 .*.swp
 .idea
+.mypy_cache
 .project
 .pydevproject
+.vscode
 __pycache__
 
 .cache/
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3.6: hg merge py3.5

2019-02-06 Thread ambv
Author: ukasz Langa 
Branch: py3.6
Changeset: r95864:baff18bae4fb
Date: 2019-02-06 12:01 +0100
http://bitbucket.org/pypy/pypy/changeset/baff18bae4fb/

Log:hg merge py3.5

diff --git a/.hgignore b/.hgignore
--- a/.hgignore
+++ b/.hgignore
@@ -4,8 +4,10 @@
 *~
 .*.swp
 .idea
+.mypy_cache
 .project
 .pydevproject
+.vscode
 __pycache__
 .venv
 .cache
diff --git a/lib_pypy/_csv.py b/lib_pypy/_csv.py
deleted file mode 100644
--- a/lib_pypy/_csv.py
+++ /dev/null
@@ -1,573 +0,0 @@
-"""CSV parsing and writing.
-
-This module provides classes that assist in the reading and writing
-of Comma Separated Value (CSV) files, and implements the interface
-described by PEP 305.  Although many CSV files are simple to parse,
-the format is not formally defined by a stable specification and
-is subtle enough that parsing lines of a CSV file with something
-like line.split(\",\") is bound to fail.  The module supports three
-basic APIs: reading, writing, and registration of dialects.
-
-
-DIALECT REGISTRATION:
-
-Readers and writers support a dialect argument, which is a convenient
-handle on a group of settings.  When the dialect argument is a string,
-it identifies one of the dialects previously registered with the module.
-If it is a class or instance, the attributes of the argument are used as
-the settings for the reader or writer:
-
-class excel:
-delimiter = ','
-quotechar = '\"'
-escapechar = None
-doublequote = True
-skipinitialspace = False
-lineterminator = '\\r\\n'
-quoting = QUOTE_MINIMAL
-
-SETTINGS:
-
-* quotechar - specifies a one-character string to use as the 
-quoting character.  It defaults to '\"'.
-* delimiter - specifies a one-character string to use as the 
-field separator.  It defaults to ','.
-* skipinitialspace - specifies how to interpret whitespace which
-immediately follows a delimiter.  It defaults to False, which
-means that whitespace immediately following a delimiter is part
-of the following field.
-* lineterminator -  specifies the character sequence which should 
-terminate rows.
-* quoting - controls when quotes should be generated by the writer.
-It can take on any of the following module constants:
-
-csv.QUOTE_MINIMAL means only when required, for example, when a
-field contains either the quotechar or the delimiter
-csv.QUOTE_ALL means that quotes are always placed around fields.
-csv.QUOTE_NONNUMERIC means that quotes are always placed around
-fields which do not parse as integers or floating point
-numbers.
-csv.QUOTE_NONE means that quotes are never placed around fields.
-* escapechar - specifies a one-character string used to escape 
-the delimiter when quoting is set to QUOTE_NONE.
-* doublequote - controls the handling of quotes inside fields.  When
-True, two consecutive quotes are interpreted as one during read,
-and when writing, each quote character embedded in the data is
-written as two quotes.
-"""
-
-__version__ = "1.0"
-
-QUOTE_MINIMAL, QUOTE_ALL, QUOTE_NONNUMERIC, QUOTE_NONE = range(4)
-_dialects = {}
-_field_limit = 128 * 1024 # max parsed field size
-
-class Error(Exception):
-pass
-
-class Dialect(object):
-"""CSV dialect
-
-The Dialect type records CSV parsing and generation options."""
-
-__slots__ = ["_delimiter", "_doublequote", "_escapechar",
- "_lineterminator", "_quotechar", "_quoting",
- "_skipinitialspace", "_strict"]
-
-def __new__(cls, dialect, **kwargs):
-
-for name in kwargs:
-if '_' + name not in Dialect.__slots__:
-raise TypeError("unexpected keyword argument '%s'" %
-(name,))
-
-if dialect is not None:
-if isinstance(dialect, str):
-dialect = get_dialect(dialect)
-
-# Can we reuse this instance?
-if (isinstance(dialect, Dialect)
-and all(value is None for value in kwargs.values())):
-return dialect
-
-self = object.__new__(cls)
-
-
-def set_char(x):
-if x is None:
-return None
-if isinstance(x, str) and len(x) <= 1:
-return x
-raise TypeError("%r must be a 1-character string" % (name,))
-def set_str(x):
-if isinstance(x, str):
-return x
-raise TypeError("%r must be a string" % (name,))
-def set_quoting(x):
-if x in range(4):
-return x
-raise TypeError("bad 'quoting' value")
-
-attributes = {"delimiter": (',', set_char),
-  "doublequote": (True, bool),
-  "escapechar": (None, set_char),
-  "lineterminator": ("\r\n", set_str),
-   

[pypy-commit] pypy zlib-copying-redux: Close to-be-merged branch.

2019-02-06 Thread Julian Berman
Author: Julian Berman 
Branch: zlib-copying-redux
Changeset: r95861:32412a37b57f
Date: 2019-02-06 11:40 +0100
http://bitbucket.org/pypy/pypy/changeset/32412a37b57f/

Log:Close to-be-merged branch.

___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy zlib-copying-redux: Add the whatsnew snippet.

2019-02-06 Thread Julian Berman
Author: Julian Berman 
Branch: zlib-copying-redux
Changeset: r95860:9b1847feb4f2
Date: 2019-02-06 11:34 +0100
http://bitbucket.org/pypy/pypy/changeset/9b1847feb4f2/

Log:Add the whatsnew snippet.

diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst
--- a/pypy/doc/whatsnew-head.rst
+++ b/pypy/doc/whatsnew-head.rst
@@ -5,6 +5,10 @@
 .. this is a revision shortly after release-pypy-7.0.0
 .. startrev: 481c69f7d81f
 
+.. branch: zlib-copying-redux
+
+Fix calling copy on already-flushed compressobjs.
+
 .. branch: zlib-copying
 
 The zlib module's compressobj and decompressobj now expose copy methods
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy zlib-copying-redux: Skip the tests that need to rpython-munge when we run app-level.

2019-02-06 Thread Julian Berman
Author: Julian Berman 
Branch: zlib-copying-redux
Changeset: r95859:ab1d3b141472
Date: 2019-02-06 11:18 +0100
http://bitbucket.org/pypy/pypy/changeset/ab1d3b141472/

Log:Skip the tests that need to rpython-munge when we run app-level.

diff --git a/pypy/module/zlib/test/test_zlib.py 
b/pypy/module/zlib/test/test_zlib.py
--- a/pypy/module/zlib/test/test_zlib.py
+++ b/pypy/module/zlib/test/test_zlib.py
@@ -308,6 +308,7 @@
 assert (d1 + from_copy) == (d1 + from_decompressor)
 
 def test_cannot_copy_decompressor_with_stream_in_inconsistent_state(self):
+if self.runappdirect: skip("can't run with -A")
 decompressor = self.zlib.decompressobj()
 self.intentionally_break_a_z_stream(zobj=decompressor)
 raises(self.zlib.error, decompressor.copy)
@@ -342,6 +343,7 @@
 assert (d1 + from_copy) == (d1 + from_compressor)
 
 def test_cannot_copy_compressor_with_stream_in_inconsistent_state(self):
+if self.runappdirect: skip("can't run with -A")
 compressor = self.zlib.compressobj()
 self.intentionally_break_a_z_stream(zobj=compressor)
 raises(self.zlib.error, compressor.copy)
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy zlib-copying-redux: Move our check for stream being nullptr to the right place.

2019-02-06 Thread Julian Berman
Author: Julian Berman 
Branch: zlib-copying-redux
Changeset: r95858:6c3c1a0558e6
Date: 2019-02-06 11:03 +0100
http://bitbucket.org/pypy/pypy/changeset/6c3c1a0558e6/

Log:Move our check for stream being nullptr to the right place.

It's compressobj that sets this to nullptr on flush, not
decompressobj.

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
@@ -175,6 +175,11 @@
 try:
 self.lock()
 try:
+if not self.stream:
+raise oefmt(
+space.w_ValueError,
+"Compressor was already flushed",
+)
 copied = rzlib.deflateCopy(self.stream)
 finally:
 self.unlock()
@@ -318,9 +323,6 @@
 try:
 self.lock()
 try:
-if not self.stream:
-raise zlib_error(space,
- "decompressor object already flushed")
 copied = rzlib.inflateCopy(self.stream)
 finally:
 self.unlock()
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: Fixed nan sign on windows

2019-02-06 Thread andrewjlawrence
Author: andrewjlawrence
Branch: 
Changeset: r95857:f8548d5c059a
Date: 2019-02-05 17:17 +
http://bitbucket.org/pypy/pypy/changeset/f8548d5c059a/

Log:Fixed nan sign on windows

diff --git a/rpython/rtyper/lltypesystem/module/test/math_cases.py 
b/rpython/rtyper/lltypesystem/module/test/math_cases.py
--- a/rpython/rtyper/lltypesystem/module/test/math_cases.py
+++ b/rpython/rtyper/lltypesystem/module/test/math_cases.py
@@ -59,9 +59,6 @@
 ('copysign', (1.5, -0.0), -1.5),
 ('copysign', (1.5, INFINITY), 1.5),
 ('copysign', (1.5, -INFINITY), -1.5),
-]
-if sys.platform != 'win32':# all NaNs seem to be negative there...?
-IRREGCASES += [
 ('copysign', (1.5, NAN), 1.5),
 ('copysign', (1.75, -NAN), -1.75),  # special case for -NAN here
 ]
diff --git a/rpython/translator/c/primitive.py 
b/rpython/translator/c/primitive.py
--- a/rpython/translator/c/primitive.py
+++ b/rpython/translator/c/primitive.py
@@ -123,9 +123,9 @@
 return '(-Py_HUGE_VAL)'
 elif math.isnan(value):
 if is_positive_nan(value):
-return '(Py_HUGE_VAL/Py_HUGE_VAL)'
+return '(_PyPy_dg_stdnan(0))'
 else:
-return '(-(Py_HUGE_VAL/Py_HUGE_VAL))'
+return '(_PyPy_dg_stdnan(1))'
 else:
 x = repr(value)
 assert not x.startswith('n')
@@ -142,9 +142,9 @@
 elif math.isnan(value):
 # XXX are these expressions ok?
 if is_positive_nan(value):
-return '((float)(Py_HUGE_VAL/Py_HUGE_VAL))'
+return '((float)(_PyPy_dg_stdnan(0)))'
 else:
-return '(-(float)(Py_HUGE_VAL/Py_HUGE_VAL))'
+return '((float)(_PyPy_dg_stdnan(1)))'
 else:
 return repr(value) + 'f'
 
diff --git a/rpython/translator/c/src/support.c 
b/rpython/translator/c/src/support.c
--- a/rpython/translator/c/src/support.c
+++ b/rpython/translator/c/src/support.c
@@ -9,6 +9,26 @@
 #include 
 
 /*** misc ***/
+#define Sign_bit 0x8000
+#define NAN_WORD0 0x7ff8
+#define NAN_WORD1 0
+#define PY_UINT32_T unsigned int
+
+#ifndef __BIG_ENDIAN__
+#define IEEE_8087
+#endif
+
+#ifdef IEEE_8087
+#define word0(x) (x)->L[1]
+#define word1(x) (x)->L[0]
+#else
+#define word0(x) (x)->L[0]
+#define word1(x) (x)->L[1]
+#endif
+#define dval(x) (x)->d
+
+typedef PY_UINT32_T ULong;
+typedef union { double d; ULong L[2]; } U;
 
 RPY_EXTERN
 void RPyAssertFailed(const char* filename, long lineno,
@@ -25,3 +45,20 @@
   fprintf(stderr, "Invalid RPython operation (NULL ptr or bad array index)\n");
   abort();
 }
+
+/* Return a 'standard' NaN value.
+   There are exactly two quiet NaNs that don't arise by 'quieting' signaling
+   NaNs (see IEEE 754-2008, section 6.2.1).  If sign == 0, return the one whose
+   sign bit is cleared.  Otherwise, return the one whose sign bit is set.
+*/
+
+double
+_PyPy_dg_stdnan(int sign)
+{
+U rv;
+word0() = NAN_WORD0;
+word1() = NAN_WORD1;
+if (sign)
+word0() |= Sign_bit;
+return dval();
+}
diff --git a/rpython/translator/c/src/support.h 
b/rpython/translator/c/src/support.h
--- a/rpython/translator/c/src/support.h
+++ b/rpython/translator/c/src/support.h
@@ -38,6 +38,9 @@
 RPY_EXTERN
 void RPyAbort(void);
 
+RPY_EXTERN
+double _PyPy_dg_stdnan(int sign);
+
 #if defined(RPY_LL_ASSERT) || defined(RPY_SANDBOXED)
 /* obscure macros that can be used as expressions and lvalues to refer
  * to a field of a structure or an item in an array in a "safe" way --
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy zlib-copying-redux: Add a test for copying flushed zlib compressobjs.

2019-02-06 Thread Julian Berman
Author: Julian Berman 
Branch: zlib-copying-redux
Changeset: r95856:bf5838a3edac
Date: 2019-02-06 11:00 +0100
http://bitbucket.org/pypy/pypy/changeset/bf5838a3edac/

Log:Add a test for copying flushed zlib compressobjs.

diff --git a/pypy/module/zlib/test/test_zlib.py 
b/pypy/module/zlib/test/test_zlib.py
--- a/pypy/module/zlib/test/test_zlib.py
+++ b/pypy/module/zlib/test/test_zlib.py
@@ -307,7 +307,7 @@
 
 assert (d1 + from_copy) == (d1 + from_decompressor)
 
-def test_unsuccessful_decompress_copy(self):
+def test_cannot_copy_decompressor_with_stream_in_inconsistent_state(self):
 decompressor = self.zlib.decompressobj()
 self.intentionally_break_a_z_stream(zobj=decompressor)
 raises(self.zlib.error, decompressor.copy)
@@ -341,7 +341,12 @@
 
 assert (d1 + from_copy) == (d1 + from_compressor)
 
-def test_unsuccessful_compress_copy(self):
+def test_cannot_copy_compressor_with_stream_in_inconsistent_state(self):
 compressor = self.zlib.compressobj()
 self.intentionally_break_a_z_stream(zobj=compressor)
 raises(self.zlib.error, compressor.copy)
+
+def test_cannot_copy_compressor_with_flushed_stream(self):
+compressor = self.zlib.compressobj()
+compressor.flush()
+raises(ValueError, compressor.copy)
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: Backed out changeset: 236bea4de5e1

2019-02-06 Thread mattip
Author: Matti Picus 
Branch: 
Changeset: r95855:3935d273ac91
Date: 2019-02-06 10:16 +0100
http://bitbucket.org/pypy/pypy/changeset/3935d273ac91/

Log:Backed out changeset: 236bea4de5e1

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
@@ -225,7 +225,7 @@
 w_stream = space.allocate_instance(Compress, w_subtype)
 w_stream = space.interp_w(Compress, w_stream)
 try:
-w_stream = rzlib.deflateInit(level, method, wbits, memLevel, strategy)
+stream = rzlib.deflateInit(level, method, wbits, memLevel, strategy)
 except rzlib.RZlibError as e:
 raise zlib_error(space, e.msg)
 except ValueError:
@@ -262,9 +262,9 @@
 """
 ZLibObject.__init__(self, space)
 
+self.stream = stream
 self.unused_data = unused_data
 self.unconsumed_tail = unconsumed_tail
-self.stream = stream
 self.register_finalizer(space)
 
 def _finalize_(self):
@@ -368,7 +368,7 @@
 w_stream = space.allocate_instance(Decompress, w_subtype)
 w_stream = space.interp_w(Decompress, w_stream)
 try:
-w_stream = rzlib.inflateInit(wbits)
+stream = rzlib.inflateInit(wbits)
 except rzlib.RZlibError as e:
 raise zlib_error(space, e.msg)
 except ValueError:
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: typo in c5c3ad13d149 ?

2019-02-06 Thread mattip
Author: Matti Picus 
Branch: 
Changeset: r95854:236bea4de5e1
Date: 2019-02-06 09:53 +0100
http://bitbucket.org/pypy/pypy/changeset/236bea4de5e1/

Log:typo in c5c3ad13d149 ?

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
@@ -225,7 +225,7 @@
 w_stream = space.allocate_instance(Compress, w_subtype)
 w_stream = space.interp_w(Compress, w_stream)
 try:
-stream = rzlib.deflateInit(level, method, wbits, memLevel, strategy)
+w_stream = rzlib.deflateInit(level, method, wbits, memLevel, strategy)
 except rzlib.RZlibError as e:
 raise zlib_error(space, e.msg)
 except ValueError:
@@ -262,9 +262,9 @@
 """
 ZLibObject.__init__(self, space)
 
-self.stream = stream
 self.unused_data = unused_data
 self.unconsumed_tail = unconsumed_tail
+self.stream = stream
 self.register_finalizer(space)
 
 def _finalize_(self):
@@ -368,7 +368,7 @@
 w_stream = space.allocate_instance(Decompress, w_subtype)
 w_stream = space.interp_w(Decompress, w_stream)
 try:
-stream = rzlib.inflateInit(wbits)
+w_stream = rzlib.inflateInit(wbits)
 except rzlib.RZlibError as e:
 raise zlib_error(space, e.msg)
 except ValueError:
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit