[issue16778] Logger.findCaller needs to be smarter

2012-12-25 Thread Glynn Clements

New submission from Glynn Clements:

The current behaviour of logging.Logger.findCaller() makes it awkward to add 
custom logging interfaces.

E.g. suppose that you define a custom logging level (NOTICE) then add a 
notice() function (analogous to logging.info() etc), the resulting LogRecord 
structure will have pathname, filename, module, funcName and lineno members 
which refer to the notice() function itself, rather than to its caller.

This can be hacked around e.g. by using code.compile_command to lie about the 
source filename, but that's ugly and highly unintuitive.

--
components: Library (Lib)
messages: 178145
nosy: glynnc
priority: normal
severity: normal
status: open
title: Logger.findCaller needs to be smarter
type: enhancement
versions: Python 2.7

___
Python tracker 
<http://bugs.python.org/issue16778>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16778] Logger.findCaller needs to be smarter

2012-12-26 Thread Glynn Clements

Glynn Clements added the comment:

Subclassing findCaller() is likely to be a bit hairy for the average user, as 
it deals with some fairly arcane aspects of Python internals.

As for mechanism, maybe allow functions/methods to be registered with the 
logging module, which would store a referenceto the function's func_code 
member. findCaller() would check the frame's f_code member against the set of 
registered functions, and continue up the stack until it found an unregistered 
function.

--

___
Python tracker 
<http://bugs.python.org/issue16778>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6373] SystemError in encoder

2009-06-29 Thread Glynn Clements

New submission from Glynn Clements :

Test case:

> "\udce4\udceb\udcef\udcf6\udcfc".encode("iso-8859-1", "surrogateescape")
Traceback (most recent call last):
  File "", line 1, in 
SystemError: Objects/bytesobject.c:3182: bad argument to internal function

The line number corresponds to _PyBytes_Resize()

--
components: Interpreter Core, Unicode
messages: 89852
nosy: glynnc
severity: normal
status: open
title: SystemError in encoder
type: behavior
versions: Python 3.1

___
Python tracker 
<http://bugs.python.org/issue6373>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com