Code

Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#18022 closed Bug (fixed)

Django 1.4 never uses python's standard json module

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

Description

The problem is that an overly zealous except clause masks a NameError that always gets raised.

Attachments (1)

import_json.diff (456 bytes) - added by Clueless 2 years ago.

Download all attachments as: .zip

Change History (5)

Changed 2 years ago by Clueless

comment:1 Changed 2 years ago by claudep

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

Just waiting confirmation by another core dev before committing in 1.4.X branch.

comment:2 Changed 2 years ago by Clueless

I may have been mistaken. The __version__ = json.__version__ line definitely used to cause a NameError and there's no way __version__ was set successfully, but that doesn't happen until after everything from json is loaded and use_system_version is set. It looks like __version__ never gets set, and the fix in #17018 never accomplished anything, but you do end up getting the rest of standard library json as expected.

Still worth merging to get the correct __version__ but it's not particularly critical.

comment:3 Changed 2 years ago by ramiro

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

In [17865]:

Fixed #18022 -- Fixed import of standalone Python 'json' module.

Thanks Clueless for the report and initial patch.

Refs #17071, r17018.

comment:4 Changed 2 years ago by claudep

IMHO, this fix is useful mainly for the 1.4.X branch, as in 1.5 this will probably get a much more serious refactoring (#18023).

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.