[issue30063] DeprecationWarning in json/encoder.py

R. David Murray report at bugs.python.org
Fri Apr 14 15:18:04 EDT 2017


R. David Murray added the comment:

Yes, but the way deprecation warnings work is that there is a stacklevel specified, and the line reported in the error is that number of steps back up the call stack from where the warning was actually issued.  The json module doesn't natively handle datetime, so there *must* be third party code that is doing the datetime encoding.  It is that code that is triggering the Deprecation warning, and the stacklevel on that deprecation warning must skip the third party code and go up another level to land in the encode.py file.  (self.iterencode can result in a call out to user code.)  This may or may not be a bug in the third party DeprecationWarning...it is sometimes hard to get stacklevel right for all cases, especially if the code in question is usually called from a nested function inside the library.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30063>
_______________________________________


More information about the Python-bugs-list mailing list