I'm trying to get a handle on a real world problem related to raising an
exception. This is in the reportlab SimpleDoctemplate class.
The following code takes a very long time (>60 seconds) in Python 2.2, 2.3, 2.4,
but not in 2.1 (at least on windows).
raise LayoutError("Flowable %s too large on page %d" % (f.identity(30), self.page))
However, the supposedly functionally identical code
ident = f.identity(30)
raise LayoutError("Flowable %s too large on page %d" % (ident, self.page))
does not take a long time (<< 1 second). The exception LayoutError is trivial
class LayoutError(Exception):
pass
The f involved is a table containing other tables, LazyParagraphs etc etc etc. I
will not be able to exhibit an example without a large effort. The method
identity is from the platypus Table and recursively attempts to obtain an
identification string.
Clearly this must be some kind of bug, but is it Python 2.2/3/4 or in our code.
Since the change occurs in 2.1-->2.2 I can think of GC/new style classes etc.
Can anyone advise on what would be a good strategy to illustrate/refine/solve
this problem?
--
Robin Becker 1 1266
On Fri, 18 Mar 2005 12:04:02 +0000, rumours say that Robin Becker
<ro***@reportlab.com> might have written: I'm trying to get a handle on a real world problem related to raising an exception. This is in the reportlab SimpleDoctemplate class.
The following code takes a very long time (>60 seconds) in Python 2.2, 2.3, 2.4, but not in 2.1 (at least on windows).
raise LayoutError("Flowable %s too large on page %d" % (f.identity(30), self.page))
Maybe this is dumb, but how long does the following take?
raise LayoutError, "Flowable %s too large on page %d" % (f.identity(30),
self.page)
However, the supposedly functionally identical code
ident = f.identity(30) raise LayoutError("Flowable %s too large on page %d" % (ident, self.page))
Let's not assume that f.identity(30) runs equally fast in the two cases (for any
obscure reasons). Did you time it (ie get the time at the start and end of the
function)?
does not take a long time (<< 1 second). The exception LayoutError is trivial class LayoutError(Exception): pass
--
TZOTZIOY, I speak England very best.
"Be strict when sending and tolerant when receiving." (from RFC1958)
I really should keep that in mind when talking with people, actually... This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Tom_OM |
last post by:
I have a web site in which I offer freeware programs. They're true
freeware, not crippled versions attempting to get people to buy the
full versions. The beginning of my user license agreement...
|
by: James Stroud |
last post by:
Hello All,
Is this a bug? Why is this tuple getting unpacked by raise? Am I missing some
subtle logic? Why does print not work the same way as raise? Both are
statements. Why does raise need to...
|
by: Dmitry |
last post by:
Hi,
I have defined interface for COM components which inludes an argument being
filled with additional error info, if such occurs. If inside I raise COM
Error, I populate that parameter.
In COM...
|
by: Scot |
last post by:
I have the following code:
Dim IP, domainName As String
domainName = "yahoo.com"
Try
IP = System.Net.Dns.GetHostByName(domainName).AddressList(0).ToString()
Catch ex As Exception
IP = "Not...
|
by: Bruce D |
last post by:
My program in connecting to a web site and I want to know how long it takes
to connect to this site. I'm assuming I need to use some sort of timer.
This is a console application. Here are the...
|
by: Steven W. Orr |
last post by:
In my class I have
class Error(Exception):
"""Base class for exceptions in this module."""
pass
class TransitionError(Error):
"""Raised when an operation attempts a state transition that's...
|
by: =?Utf-8?B?Ulc=?= |
last post by:
I constructed a new Class with some private members.
I would like an event to be raised on the moment the value of one of those
private members is changed.
How do I define an event for that...
|
by: Charles Law |
last post by:
I have a data table with ~1000 rows. I go through the rows one at a time,
checking the contents. If I find a cell with an error, e.g containing null,
I use SetColumnError on the data row to flag...
|
by: Rafe |
last post by:
Hi,
I've encountered a problem which is making debugging less obvious than
it should be. The @property decorator doesn't always raise exceptions.
It seems like it is bound to the class but...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |