GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — bpo-1635741: In pickle module, inject module state from class methods by koubaa · Pull Request #23304 · python/cpython

Conversation

@koubaa

@koubaa koubaa commented Nov 15, 2020 •
edited by bedevere-bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

This PR prepares for changing to heap types.
When switching to heap types, the clinic can be used to get the module state.

https://bugs.python.org/issue1635741

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@the-knights-who-say-ni the-knights-who-say-ni added the CLA signed label Nov 15, 2020
@bedevere-bot bedevere-bot added the awaiting review label Nov 15, 2020
@koubaa koubaa changed the title bpo-1635741 - inject module state from class methods bpo-1635741: In pickle module, inject module state from class methods Nov 15, 2020
@koubaa

koubaa commented Nov 15, 2020

Copy link
Copy Markdown
Contributor Author

@vstinner @corona10 @shihai1991 please review

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

koubaa
koubaa commented Nov 15, 2020
View reviewed changes
Comment thread Modules/_pickle.c Outdated

@koubaa koubaa Nov 15, 2020 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PickleState is not used here, but is added as an argument to avoid complicating the macro/switch case in

static PyObject *
load(UnpicklerObject *self, PickleState *st)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@tiran

tiran commented Nov 18, 2020

Copy link
Copy Markdown
Member

Most modules are using state for the state variable. Could you please replace st with state so we have a consistent naming scheme across the code base?

shihai1991 reacted with thumbs up emoji encukou reacted with thumbs down emoji
All reactions
  • 👍 1 reaction
  • 👎 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@koubaa

koubaa commented Nov 20, 2020 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

Most modules are using state for the state variable. Could you please replace st with state so we have a consistent naming scheme across the code base?

@tiran I did that in my initial draft here. The reason I didn't do it here is because there are local variables named state in some functions (see for example line 3949 in save_reduce. Do you have a suggestion on what to change those names to? I don't understand exactly what those variables represent

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions

github-actions Bot commented Dec 21, 2020

Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Dec 21, 2020
@shihai1991
shihai1991 requested review from corona10 and vstinner December 21, 2020 10:38
@shihai1991 shihai1991 added the skip news label Dec 21, 2020
shihai1991
shihai1991 reviewed Dec 21, 2020
View reviewed changes

@shihai1991 shihai1991 left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason I didn't do it here is because there are local variables named state in some functions (see for example line 3949 in save_reduce.

the state would be more exact. If there have other arguments have own this name, keep st unchanged is not a big probleam.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Modules/_pickle.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Modules/_pickle.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

vstinner
vstinner reviewed Jan 20, 2021
View reviewed changes
Comment thread Modules/_pickle.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Modules/_pickle.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Modules/_pickle.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

koubaa added 2 commits March 4, 2021 20:49
@koubaa
get module state from class methods
ee54eb3
when switching to heap types, the clinic can be used to get the module state therte
@koubaa
address PR comments
eea5c35
@koubaa
koubaa force-pushed the bpo-1635741-picklestate-inject branch from d7cad26 to eea5c35 Compare March 7, 2021 17:21
@koubaa

koubaa commented Mar 7, 2021

Copy link
Copy Markdown
Contributor Author

@shihai1991 @vstinner I addressed these comments

shihai1991 reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

shihai1991
shihai1991 approved these changes Mar 8, 2021
View reviewed changes

@shihai1991 shihai1991 left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is huge :) . About adding parenthesis, I will update it when those code have relation with the bpo.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-bot bedevere-bot added awaiting core review and removed awaiting review labels Mar 8, 2021
@iritkatriel

iritkatriel commented Apr 11, 2022

Copy link
Copy Markdown
Member

https://bugs.python.org/issue1635741 is closed. What is the status of this PR?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner

vstinner commented Apr 19, 2022

Copy link
Copy Markdown
Member

The change is still relevant, but should use a new issue number.

Moreover, the SC asked to put the conversion of static types to heap types on hold. @encukou and @erlend-aasland wrote https://peps.python.org/pep-0687/ which may unblock the situation but it's still a draft.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ezio-melotti ezio-melotti removed the CLA signed label Jul 13, 2022
@erlend-aasland

erlend-aasland commented Jul 20, 2022

Copy link
Copy Markdown
Contributor

The change is still relevant, but should use a new issue number.

Moreover, the SC asked to put the conversion of static types to heap types on hold. @encukou and @erlend-aasland wrote https://peps.python.org/pep-0687/ which may unblock the situation but it's still a draft.

FYI, PEP 687 was accepted.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot removed the stale Stale PR or inactive for long period of time. label Jul 31, 2022
@kylotan kylotan mannequin mentioned this pull request Sep 19, 2022
Py_Finalize() doesn't clear all Python objects at exit #44470
Closed
@encukou

encukou commented Mar 28, 2024

Copy link
Copy Markdown
Member

Pickle module state was isolated in #102982. koubaa is listed as co-author, so I hope some of this work made it in at the end.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@encukou encukou closed this Mar 28, 2024
@erlend-aasland

erlend-aasland commented Mar 28, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Pickle module state was isolated in #102982. koubaa is listed as co-author, so I hope some of this work made it in at the end.

It did; PR #102982 was based off of Mohamed's work in #23188 (IIRC, I cherry-picked the commits from this that PR onto my new branch). See also #23188 (comment).

koubaa reacted with thumbs up emoji encukou reacted with heart emoji
All reactions
  • 👍 1 reaction
  • ❤️ 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

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

Reviewers

@vstinner vstinner vstinner left review comments
@shihai1991 shihai1991 shihai1991 approved these changes
@corona10 corona10 Awaiting requested review from corona10

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

awaiting core review skip news

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

10 participants

@koubaa @tiran @iritkatriel @vstinner @erlend-aasland @encukou @shihai1991 @the-knights-who-say-ni @ezio-melotti @bedevere-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.