Re: Possible bug?

Les <[email protected]> Wed, 16 Mar 2022 14:18:07 +0100
Newsgroups gmane.comp.python.reportlab.user
Message-ID <CAKXe9UC+_pGEpQ2Kx8YzLJX2=Xt2=xve+-apzQaqtON-nE4hFQ@mail.gmail.com>
>
> 2) there is no guarantee that any specific flowable is immutable; to
> support repeated processing we make a shallow copy
> and that works for many cases, but it's not guaranteed if the flowables
> are perverse. Shallow and deep copies may allow
> duplicated usage, but obviously they consume resources.
>

Hello Robin,

I understand the explanation. Just one more question. Nothing is perverse
in my minimal working example, it only contains simple paragraphs. You also
say that generally it is disallowed to use shallow copies for repeated
document generation.

However, BaseDocTemplate.multiBuild also uses a shallow copy:

https://github.com/Distrotech/reportlab/blob/master/src/reportlab/platypus/doctemplate.py#L1042

# work with a copy of the story, since it is consumed
tempStory = story[:]
self.build(tempStory, **buildKwds)

I'm curious - why is it allowed here, and not allowed elsewhere?

Regards,

   Laszlo