Skip to content

fix: resolve failure to pickle.loads(pickle.dumps(PlanarEmbedding())) - #8186

Merged
rossbar merged 3 commits into
networkx:mainfrom
mdealencar:fix/unpickling_PlanarEmbedding
Aug 8, 2025
Merged

rossbar merged 3 commits into
networkx:mainfrom
mdealencar:fix/unpickling_PlanarEmbedding

Conversation

@mdealencar

Copy link
Copy Markdown
Contributor

Fixes #8185

Trying to pickle.loads(pickle.dumps(PlanarEmbedding())) raises: AttributeError: 'PlanarEmbedding' object has no attribute '__forbidden'

Trying to pickle.loads(pickle.dumps(PlanarEmbedding())) raises:
AttributeError: 'PlanarEmbedding' object has no attribute '__forbidden'

@rossbar rossbar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we just rename __forbidden to _forbidden?

@mdealencar

Copy link
Copy Markdown
Contributor Author

Can we just rename __forbidden to _forbidden?

Yes, that is indeed simpler and works. Done.

@MridulS MridulS added this to the 3.6 milestone Aug 8, 2025

@Peiffap Peiffap left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks! Can you add the (previously failing) roundtrip test to the test suite as well (with a reference to the issue)?

@rossbar rossbar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, thanks @mdealencar . A test would be fine but I'm okay without one since this is just a quirk of how Python wants you to name things

@rossbar
rossbar merged commit 36e8a1e into networkx:main Aug 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

Unpickling error: 'PlanarEmbedding' object has no attribute '__forbidden'

4 participants