diff --git a/python-construct-2.10.68-fixed-passing-self-instead-of-stream.patch b/python-construct-2.10.68-fixed-passing-self-instead-of-stream.patch new file mode 100644 index 0000000000000000000000000000000000000000..1a1139cc016e189e1dc4e89e798737bcb0eba801 --- /dev/null +++ b/python-construct-2.10.68-fixed-passing-self-instead-of-stream.patch @@ -0,0 +1,42 @@ +From 188b0c709a2312714d25a72169acae805649f822 Mon Sep 17 00:00:00 2001 +From: Arkadiusz Bulski +Date: Sun, 18 Sep 2022 16:20:04 +0200 +Subject: [PATCH] Bug #938 fixed (thanks Henrique) + +--- + construct/core.py | 2 +- + tests/test_core.py | 5 +++++ + 2 files changed, 6 insertions(+), 1 deletion(-) + +diff --git a/construct/core.py b/construct/core.py +index 129abe5..e31e8e9 100644 +--- a/construct/core.py ++++ b/construct/core.py +@@ -5594,7 +5594,7 @@ class Lazy(Subconstruct): + obj = self.subcon._parsereport(stream, context, path) + stream_seek(stream, fallback, 0, path) + return obj +- len = self.subcon._actualsize(self, context, path) ++ len = self.subcon._actualsize(stream, context, path) + stream_seek(stream, len, 1, path) + return execute + +diff --git a/tests/test_core.py b/tests/test_core.py +index ea00810..b6465c5 100644 +--- a/tests/test_core.py ++++ b/tests/test_core.py +@@ -1328,6 +1328,11 @@ def test_lazy(): + assert d.build(x) == b'\x00' + assert d.sizeof() == 1 + ++def test_lazy_issue_938(): ++ d = Lazy(Prefixed(Byte, Byte)) ++ func = d.parse(b'\x01\x02') ++ assert func() == 2 ++ + def test_lazy_seek(): + d = Struct( + "a" / Int8ub, +-- +2.39.0.windows.2 + diff --git a/python-construct.spec b/python-construct.spec index ef04bb84bfb79f11e23fa9c250a414053e9b4fbd..72ade54f1d80421d6c3f6989830750f44b2b86c0 100644 --- a/python-construct.spec +++ b/python-construct.spec @@ -1,11 +1,13 @@ %global _empty_manifest_terminate_build 0 Name: python-construct Version: 2.10.68 -Release: 1 +Release: 2 Summary: A powerful declarative symmetric parser/builder for binary data License: MIT URL: http://construct.readthedocs.org Source0: https://pypi.python.org/packages/source/c/construct/construct-%{version}.tar.gz +Patch0001: python-construct-2.10.68-fixed-passing-self-instead-of-stream.patch + BuildArch: noarch %description Construct is a powerful declarative and symmetrical parser and builder for binary data. @@ -28,7 +30,7 @@ Construct is a powerful declarative and symmetrical parser and builder for binar Instead of writing imperative code to parse a piece of data, you declaratively define a data structure that describes your data. As this data structure is not code, you can use it in one direction to parse data into Pythonic objects, and in the other direction, to build objects into binary data. %prep -%autosetup -n construct-%{version} +%autosetup -n construct-%{version} -p1 %build %py3_build @@ -68,6 +70,9 @@ mv %{buildroot}/doclist.lst . %{_docdir}/* %changelog +* Sat Jan 7 2023 zhangliangpengkun - 2.10.68-2 +- Fixed passing self instead of stream + * Tue Oct 18 2022 Ge Wang - 2.10.68-1 - update to version 2.10.68