Author: Manuel Jacob <[email protected]>
Branch: py3.5
Changeset: r95853:4a4b466ea459
Date: 2019-02-06 02:42 +0100
http://bitbucket.org/pypy/pypy/changeset/4a4b466ea459/
Log: hg merge default
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
@@ -113,22 +113,8 @@
Wrapper around zlib's z_stream structure which provides convenient
compression functionality.
"""
- def __init__(self, space, level=rzlib.Z_DEFAULT_COMPRESSION,
- method=rzlib.Z_DEFLATED, # \
- wbits=rzlib.MAX_WBITS, # \ undocumented
- memLevel=rzlib.DEF_MEM_LEVEL, # / parameters
- strategy=rzlib.Z_DEFAULT_STRATEGY, # /
- zdict=None,
- stream=None):
+ def __init__(self, space, stream):
ZLibObject.__init__(self, space)
- if stream is None:
- try:
- stream = rzlib.deflateInit(level, method, wbits,
- memLevel, strategy, zdict=zdict)
- except rzlib.RZlibError as e:
- raise zlib_error(space, e.msg)
- except ValueError:
- raise oefmt(space.w_ValueError, "Invalid initialization
option")
self.stream = stream
self.register_finalizer(space)
@@ -220,11 +206,17 @@
zdict = None
else:
zdict = space.charbuf_w(w_zdict)
- stream = space.allocate_instance(Compress, w_subtype)
- stream = space.interp_w(Compress, stream)
- Compress.__init__(stream, space, level,
- method, wbits, memLevel, strategy, zdict)
- return stream
+ 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,
+ zdict=zdict)
+ except rzlib.RZlibError as e:
+ raise zlib_error(space, e.msg)
+ except ValueError:
+ raise oefmt(space.w_ValueError, "Invalid initialization option")
+ Compress.__init__(w_stream, space, stream)
+ return w_stream
Compress.typedef = TypeDef(
@@ -244,15 +236,7 @@
Wrapper around zlib's z_stream structure which provides convenient
decompression functionality.
"""
- def __init__(
- self,
- space,
- wbits=rzlib.MAX_WBITS,
- zdict=None,
- stream=None,
- unused_data="",
- unconsumed_tail="",
- ):
+ def __init__(self, space, stream, zdict, unused_data, unconsumed_tail):
"""
Initialize a new decompression object.
@@ -262,13 +246,7 @@
inflateInit2.
"""
ZLibObject.__init__(self, space)
- if stream is None:
- try:
- stream = rzlib.inflateInit(wbits, zdict=zdict)
- except rzlib.RZlibError as e:
- raise zlib_error(space, e.msg)
- except ValueError:
- raise oefmt(space.w_ValueError, "Invalid initialization
option")
+
self.stream = stream
self.zdict = zdict
self.unused_data = unused_data
@@ -383,10 +361,16 @@
zdict = None
else:
zdict = space.charbuf_w(w_zdict)
- stream = space.allocate_instance(Decompress, w_subtype)
- stream = space.interp_w(Decompress, stream)
- Decompress.__init__(stream, space, wbits, zdict)
- return stream
+ w_stream = space.allocate_instance(Decompress, w_subtype)
+ w_stream = space.interp_w(Decompress, w_stream)
+ try:
+ stream = rzlib.inflateInit(wbits, zdict=zdict)
+ except rzlib.RZlibError as e:
+ raise zlib_error(space, e.msg)
+ except ValueError:
+ raise oefmt(space.w_ValueError, "Invalid initialization option")
+ Decompress.__init__(w_stream, space, stream, zdict, '', '')
+ return w_stream
def default_buffer_size(space):
return space.newint(rzlib.OUTPUT_BUFFER_SIZE)
diff --git a/rpython/rlib/rgc.py b/rpython/rlib/rgc.py
--- a/rpython/rlib/rgc.py
+++ b/rpython/rlib/rgc.py
@@ -1406,6 +1406,11 @@
return _ResizableListSupportingRawPtr(lst)
def nonmoving_raw_ptr_for_resizable_list(lst):
+ if must_split_gc_address_space():
+ raise ValueError
+ return _nonmoving_raw_ptr_for_resizable_list(lst)
+
+def _nonmoving_raw_ptr_for_resizable_list(lst):
assert isinstance(lst, _ResizableListSupportingRawPtr)
return lst._nonmoving_raw_ptr_for_resizable_list()
@@ -1450,7 +1455,7 @@
return hop.inputarg(hop.args_r[0], 0)
class Entry(ExtRegistryEntry):
- _about_ = nonmoving_raw_ptr_for_resizable_list
+ _about_ = _nonmoving_raw_ptr_for_resizable_list
def compute_result_annotation(self, s_list):
from rpython.rtyper.lltypesystem import lltype, rffi
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit