[issue13337] IGNORE_CASE doctest option flag

2011-11-03 Thread Gerald Dalley

New submission from Gerald Dalley :

It would be helpful to have a doctest flag that makes the test case insensitive.

Use case: nan values are printed as "nan" with typical Linux implementations, 
but as "NaN" on other operating systems like Solaris.

In a naive implementation, the core change to 
doctest.OutputChecker.check_output is:

+if optionflags & IGNORE_CASE:
+got= got.lower()
+want   = want.lower()
+true_line  = "true\n"
+false_line = "false\n"
+else:
+true_line  = "True\n"
+false_line = "False\n"
+
 # Handle the common case first, for efficiency:
 # if they're string-identical, always return true.
 if got == want:
 return True

 # The values True and False replaced 1 and 0 as the return
 # value for boolean comparisons in Python 2.3.
 if not (optionflags & DONT_ACCEPT_TRUE_FOR_1):
-if (got,want) == ("True\n", "1\n"):
+if (got,want) == (true_line, "1\n"):
 return True
-if (got,want) == ("False\n", "0\n"):
+if (got,want) == (false_line, "0\n"):
 return True

--
components: Library (Lib)
messages: 146961
nosy: Gerald.Dalley
priority: normal
severity: normal
status: open
title: IGNORE_CASE doctest option flag
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4

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



[issue13337] IGNORE_CASE doctest option flag

2011-11-03 Thread Gerald Dalley

Changes by Gerald Dalley :


--
type:  -> feature request

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



[issue13337] IGNORE_CASE doctest option flag

2011-11-03 Thread Gerald Dalley

Gerald Dalley  added the comment:

ITSM?

The motivating use case here comes from "nan" strings produced by libc in 
extension modules (even though python itself and some major libraries like 
numpy are consistent).  At least some versions Solaris and Linux differ in this 
particular case.

--

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



[issue42248] Raised exception in Enum keeping user objects alive unnecessarily

2020-12-04 Thread Gerald Dalley


Gerald Dalley  added the comment:

I and a few others have run into issues with the Enum constructors producing 
spurious reference cycles. This can cause memory explosions if large objects 
like numpy arrays are held in any of the relevant stack frames. Based on 
https://bugs.python.org/issue36820, it looks like the maintainers of CPython 
are open to fixing similar issues, and PRs look like the way to make progress.

--
nosy: +gerald.dalley2
type:  -> enhancement

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



[issue7689] Pickling of classes with a metaclass and copy_reg

2010-06-16 Thread Gerald Dalley

Gerald Dalley  added the comment:

Another use case: for distributed processing, it's handy to be able to pickle 
interactive functions and functions that are part of a script.  The user can 
then remotely execute a broader set of functions than can be pickled by 
default.  This is especially helpful for interactive exploration of data.

Pickling most types of functions is possible by serializing a function's 
bytecode, etc. and registering a handler with copy_reg.  Unfortunately, this 
handler is ignored under some conditions (e.g. copy_reg is ignored when 
attempting to serialize top-level functions in a script) but the copy_reg 
handler does get used for lambdas and inner functions.  This patch looks like 
it will allow FunctionType's pickle handler to be overridden in all cases.

--
nosy: +dalleyg

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