Backquote deprecation warning

Hello! I'm having a bit of a trouble getting the deprecation warning for backquotes `repr` right. Neither the ast_for_* functions in Python/ast.c nor the node structures have access to the filename. Should the node structure gain an additional field to drag the filename around? Or can we simply life with the fact that the user won't get a filename in the deprecation warning? Christian

Christian Heimes schrieb:
Hello!
I'm having a bit of a trouble getting the deprecation warning for backquotes `repr` right. Neither the ast_for_* functions in Python/ast.c nor the node structures have access to the filename.
On a related note, every time you start a Python interpreter with -3 you get 8 instances of warning: callable() not supported in 3.x They come from copy_reg.py:pickle/constructor. Py3k has a hasattr('__call__') there. Am I correct that for Py2, that must be hasattr(object, '__call__') or isinstance(object, types.ClassType) ? Or are there other callable objects without a __call__ method? Georg -- Thus spake the Lord: Thou shalt indent with four spaces. No more, no less. Four shall be the number of spaces thou shalt indent, and the number of thy indenting shall be four. Eight shalt thou not indent, nor either indent thou two, excepting that thou then proceed to four. Tabs are right out.

Christian Heimes wrote:
Should the node structure gain an additional field to drag the filename around?
Why not? Early on in the design of the Pyrex compiler, I made the decision that every parse tree node would contain a source filename and position, down to character resolution. It's paid off enormously, as I can produce highly pinpointed error messages for just about anything at any stage of processing. -- Greg
participants (4)
-
"Martin v. Löwis"
-
Christian Heimes
-
Georg Brandl
-
Greg Ewing