Opened 11 years ago

Closed 11 years ago

#20560 closed Bug (duplicate)

django.utils.simplejson

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

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 by Alex Burgel, 11 years ago

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 by Alex Burgel, 11 years ago

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 by Alex Burgel, 11 years ago

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