[pypy-svn] r17883 - in pypy/dist/pypy: annotation translator
pedronis at codespeak.net
pedronis at codespeak.net
Mon Sep 26 22:09:37 CEST 2005
Author: pedronis
Date: Mon Sep 26 22:09:35 2005
New Revision: 17883
Modified:
pypy/dist/pypy/annotation/bookkeeper.py
pypy/dist/pypy/annotation/builtin.py
pypy/dist/pypy/translator/annrpython.py
Log:
delegate warning printing to RPythonAnnotator
no printing in annotation/
Modified: pypy/dist/pypy/annotation/bookkeeper.py
==============================================================================
--- pypy/dist/pypy/annotation/bookkeeper.py (original)
+++ pypy/dist/pypy/annotation/bookkeeper.py Mon Sep 26 22:09:35 2005
@@ -6,7 +6,6 @@
import sys
from types import FunctionType, ClassType, MethodType
from types import BuiltinMethodType, NoneType
-from pypy.tool.ansi_print import ansi_print
from pypy.annotation.model import *
from pypy.annotation.classdef import ClassDef, isclassdef
from pypy.annotation.listdef import ListDef, MOST_GENERAL_LISTDEF
@@ -378,7 +377,6 @@
else:
clsdef = self.getclassdef(x.__class__)
if x.__class__.__dict__.get('_annspecialcase_', '').endswith('ctr_location'):
- print "encountered a pre-built mutable instance of a class needing specialization: %s" % x.__class__.__name__
raise Exception, "encountered a pre-built mutable instance of a class needing specialization: %s" % x.__class__.__name__
if x not in self.seen_mutable: # avoid circular reflowing,
# see for example test_circular_mutable_getattr
@@ -724,12 +722,7 @@
return self.annotator.whereami(self.position_key)
def warning(self, msg):
- try:
- pos = self.whereami()
- except AttributeError:
- pos = '?'
- ansi_print("*** WARNING: [%s] %s" % (pos, msg), esc="31") # RED
-
+ return self.annotator.warning(msg)
def ishashable(x):
try:
Modified: pypy/dist/pypy/annotation/builtin.py
==============================================================================
--- pypy/dist/pypy/annotation/builtin.py (original)
+++ pypy/dist/pypy/annotation/builtin.py Mon Sep 26 22:09:35 2005
@@ -4,7 +4,6 @@
import types
import sys, math, os, time
-from pypy.tool.ansi_print import ansi_print
from pypy.annotation.model import SomeInteger, SomeObject, SomeChar, SomeBool
from pypy.annotation.model import SomeList, SomeString, SomeTuple, SomeSlice
from pypy.annotation.model import SomeUnicodeCodePoint, SomeAddress
@@ -324,7 +323,6 @@
n = 1
p = lltype.malloc(T.const, n)
r = SomePtr(lltype.typeOf(p))
- #print "MALLOC", r
return r
def typeOf(s_val):
Modified: pypy/dist/pypy/translator/annrpython.py
==============================================================================
--- pypy/dist/pypy/translator/annrpython.py (original)
+++ pypy/dist/pypy/translator/annrpython.py Mon Sep 26 22:09:35 2005
@@ -267,13 +267,26 @@
s_value))
if arg in self.return_bindings and degenerated:
- log.red("*** WARNING: %s result degenerated to SomeObject" %
- self.whereami((self.return_bindings[arg],None, None)))
+ self.warning("result degenerated to SomeObject",
+ (self.return_bindings[arg],None, None))
self.binding_caused_by[arg] = called_from
# XXX make this line available as a debugging option
##assert not (s_value.__class__ == annmodel.SomeObject and s_value.knowntype == object) ## debug
+
+ def warning(self, msg, pos=None):
+ if pos is None:
+ try:
+ pos = self.bookkeeper.position_key
+ except AttributeError:
+ pos = '?'
+ if pos != '?':
+ pos = self.whereami(pos)
+
+ log.red("*** WARNING: %s/ %s" % (pos, msg))
+
+
#___ interface for annotator.bookkeeper _______
def recursivecall(self, func, whence, inputcells): # whence = position_key|callback taking the annotator, graph
More information about the Pypy-commit
mailing list