question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot unpickle DocumentNode

See original GitHub issue

Reporting issues with GraphQL-core 3

Unpickling of DocumentNode(s) fail since unpickling a FrozenList fails. I believe the root issue is that List is extended, and pickle assumes it may call append, resulting in a FrozenError.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
Citocommented, Dec 28, 2021

This has now been solved in b9423b74ca9d22d009a1a4633b38b2bcd06c604b by using tuples instead of FrozenLists for lists of nodes, and by not pickling the Token links, as explained above. Will be available in v3.2.0rc4.

1reaction
Citocommented, Nov 7, 2020

@corydolphin I like to move this forward, but I have limited time, so I would be glad if you or anybody else could help.

The first thing we need is a test that makes sure that document asts can be properly pickled and unpickled. So I added this at the bottom of test_schema_parser.py:

    def can_pickle_and_unpickle_kitchen_sink_schema(kitchen_sink_sdl):  # noqa: F811
        sys.setrecursionlimit(2000)
        doc = parse(kitchen_sink_sdl)
        dumped = pickle.dumps(doc)
        loaded = pickle.loads(dumped)
        assert loaded == doc

This test fails due to the FrozenError issue and passes if we replace the FrozenLists with an ordinary list.

However, it baffles me that I had to set sys.setrecursionlimit(2000) to make it pass, otherweise I get a RecursionError. The kitchen_sink document is actually not that complicated or deeply nested. Does anybody understand what’s going on here?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot unpickle some data just pickled with python 3 with a ...
Pickling un pickling goes fine until the bit of code tagged "ADDING THIS CODE CAUSES PROBLEM" is inserted. In this case I get...
Read more >
Python HTML Support - Computer Hope
This is a read-only attribute. Node.parentNode, The parent of the current node, or None for the document node. The value is always a...
Read more >
13.7.1 DOM Objects - Python 2.4 Documentation
With no argument, the XML header does not specify an encoding, and the result is Unicode string if the default encoding cannot represent...
Read more >
sphinx-all command man page - python3-sphinx | ManKier
Note that the term cannot have more than one line of text. ... pickle files this pickle file requires that the sphinx package...
Read more >
Oracle® Database - XML C API Reference
document node */ ... XML document node ... (with XmlDomSetPIData), but the target is required and cannot be changed. Note the.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found