Skip to content

bpo-34093: Stablize FLAG_REF usage (two-pass version) - #8293

Closed
methane wants to merge 2 commits into
python:mainfrom
methane:stable-marshal-1
Closed

bpo-34093: Stablize FLAG_REF usage (two-pass version)#8293
methane wants to merge 2 commits into
python:mainfrom
methane:stable-marshal-1

Conversation

@methane

@methanemethane commented Jul 16, 2018

Copy link
Copy Markdown
Member

marshal used refcnt() to decide use FLAG_REF or not.
Even when one object is used only once in marshled object,
FLAG_REF could be used.
This commit makes marshal two-pass. It counts refs
at first pass. In second pass, mashal objects and
use FLAG_REF only when the object is used more than twice.
@methane

Copy link
Copy Markdown
MemberAuthor

I don't like the option name stable, because it is very unclear what is stable.
It just helps reproducible pyc build.

@ericsnowcurrently

Copy link
Copy Markdown
Member

Wow, this is very similar to a PR I made for the same problem (before you pointed me here): gh-28379. The biggest difference is that I literally call w_object() twice, where the first pass determines how many times an object is used (and the result bytes are discarded).

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@methane@ericsnowcurrently@the-knights-who-say-ni@bedevere-bot