#20560 closed Bug (duplicate)

django.utils.simplejson

Reported by: aburgel 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

Description

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 23 months ago by aburgel

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

I've put the fix in a pull request:

https://github.com/django/django/pull/1243

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 23 months ago by aburgel

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 23 months ago by aburgel

  • Resolution set to duplicate
  • Status changed from new to closed

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