Opened 3 years ago

Closed 3 years ago

#20560 closed Bug (duplicate)


Reported by: Alex Burgel Owned by: nobody
Component: Core (Serialization) Version: 1.4
Severity: Normal Keywords: json
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


The fix for #17071 introduces a NameError which gets swallowed. This prevents django.utils.simplejson from using the builtin json library.

It tries to set the module's version to the version of the imported library, like so:

__version__ = json.__version__

But it uses a from json import * instead of a import json, so you get a NameError.

Change History (3)

comment:1 Changed 3 years ago by Alex Burgel

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset

I've put the fix in a pull request:

The fix mirrors the approach taken for importing simplejson.

I have not included any tests because I'm not sure how such a test should be written since its dependent on the underlying system. I'd be happy to write one if someone could suggest a good way to do so.

comment:2 Changed 3 years ago by Alex Burgel

My bad. I didn't see #18022.

Clearly this is fixed in 1.5 and up. So please consider this bug report a request to backport the fix to 1.4.

comment:3 Changed 3 years ago by Alex Burgel

Resolution: duplicate
Status: newclosed

Nevermind. The fix is not necessary, #18022 says that the json library is imported correctly.

Note: See TracTickets for help on using tickets.
Back to Top