This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients Madison May, ezio.melotti, rhettinger, terry.reedy
Date 2015-07-17.18:03:36
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1437156217.01.0.397251881134.issue24641@psf.upfronthosting.co.za>
In-reply-to
Content
A typical TypeError message use the following pattern:
  TypeError: 'int' object is not callable
as it is the class, not the value, that is the problem.

If the same is always true for the JSON TypeError, at the point of failure, then the dumps message could follow the same pattern.

However, I don't know if the message *is* value independent.  The SO question asked about

TypeError: {'album': [u"Rooney's Lost Album"], 'title': [u'The Kids
After Sunset'], 'artist': [u'Rooney']} is not JSON serializable

and the OP claimed in a comment to the accepted answer that the problem was that the value objects represented as lists were not list() objects, just as '5' here is not an int() object.

The JSON error code, in 3.5 at

  File "C:\Programs\Python35\lib\json\encoder.py", line 180, in default
    raise TypeError(repr(o) + " is not JSON serializable")

could be expanded to check whether the string representation starts with the class name and if it does not, add "'classname' object" at the front. This would solve Madison's posted issue, but not the SO problem.
(It would, however, have made it clear that the {}s represented a real dict() object and directed attention inward.)

For testing, compile('','','exec') returns an object that cannot be dumped.

To me, this looks more like an enhancement than bugfix, so a change might be limited to future releases.
History
Date User Action Args
2015-07-17 18:03:37terry.reedysetrecipients: + terry.reedy, rhettinger, ezio.melotti, Madison May
2015-07-17 18:03:37terry.reedysetmessageid: <1437156217.01.0.397251881134.issue24641@psf.upfronthosting.co.za>
2015-07-17 18:03:36terry.reedylinkissue24641 messages
2015-07-17 18:03:36terry.reedycreate