[issue6608] asctime causing python to crash

2009-08-02 Thread James Abbatiello
James Abbatiello added the comment: Further investigation shows that MS asctime() doesn't like leap seconds and causes an assertion when passing (2008, 12, 31, 23, 59, 60, 2, 366, -1) -> 'Wed Dec 31 23:59:60 2008'. Given that and since asctime() is such a simple function I t

[issue6608] asctime causing python to crash

2009-07-31 Thread James Abbatiello
James Abbatiello added the comment: Since there's no good way to disable the assertion (see issue4804), checking the validity of the argument beforehand looks like an option. The checking that's currently being done in the strftime() implementation looks useful but it is not en

[issue5093] 2to3 with a pipe on non-ASCII script

2009-07-31 Thread James Abbatiello
James Abbatiello added the comment: In what case(s) do you propose the output to be encoded in UTF-8? If output is to a terminal and that terminal is set to Latin-1 or cp437 or whatever then outputting UTF-8 in that case will only show garbage characters to the user. If output is to a file

[issue5093] 2to3 with a pipe on non-ASCII script

2009-07-29 Thread James Abbatiello
James Abbatiello added the comment: The --no-diffs option was recently added which looks like a good workaround. Here's an attempt at a solution. If sys.stdout has an encoding set then use that, just as is being done now. If there is no encoding (implying "ascii") then use

[issue6599] 2to3 test_print_function_option fails on Windows

2009-07-29 Thread James Abbatiello
New submission from James Abbatiello : test_print_function_option is failing on Windows. Patch attached. Output of failure: C:>python test.py test_all_project_files (lib2to3.tests.test_all_fixers.Test_all) ... \2to3\lib2to3\refactor.py:194: DeprecationWarning: the 'print_function&#x

[issue6358] os.popen exit code inconsistent

2009-06-28 Thread James Abbatiello
New submission from James Abbatiello : Start a process with os.popen() and then try to get its exit code by closing the resulting file handle. The value returned is inconsistent between 2.x and 3.x. Example: Python 2.6.2 (r262:71605, Apr 14 2009, 22:40:02) [MSC v.1500 32 bit (Intel)] on win32

[issue6250] Python compiles dead code

2009-06-15 Thread James Abbatiello
James Abbatiello added the comment: Raymond, I've updated peephole.c to allow code to terminate with any of RETURN_VALUE, END_FINALLY or RAISE_VARARGS [0-3]. I also added tests to test_peepholer.py to make sure the peepholer still works in these

[issue6250] Python compiles dead code

2009-06-15 Thread James Abbatiello
James Abbatiello added the comment: I should add that the patch doesn't only address dead user-code. It also eliminates code that the compiler generates itself but that would be unreachable at runtime. Consider the following function: def foo(x): if x: raise Something else:

[issue6250] Python compiles dead code

2009-06-09 Thread James Abbatiello
New submission from James Abbatiello : Python currently emits bytecode for code that is unreachable (e.g. following a return statement). This doesn't hurt anything but it takes up space doing nothing. This patch attempts to avoid generating any bytecode in this situation. There's a

[issue6227] doctest_aliases doesn't test duplicate removal

2009-06-06 Thread James Abbatiello
New submission from James Abbatiello : The file Lib/test/doctest_aliases.py is used by test_doctest to check the handling of duplicate removal. The "g = f" line in this file is one indent too far to the right so instead of creating an alias for f called g it is just unreachable code i

[issue6201] test_winreg fails

2009-06-04 Thread James Abbatiello
New submission from James Abbatiello : test_winreg fails with: == ERROR: testLocalMachineRegistryWorks (test.test_winreg.WinregTests) -- Traceback (most recent

[issue6199] test_unittest fails on Windows

2009-06-04 Thread James Abbatiello
New submission from James Abbatiello : test_unittest fails on Windows with: == FAIL: test_find_tests_with_package (test.test_unittest.TestDiscovery

[issue6198] test_float fails on Windows

2009-06-04 Thread James Abbatiello
New submission from James Abbatiello : test_float fails on Windows with: == FAIL: test_format_testfile (test.test_float.IEEEFormatTestCase) -- Traceback (most

[issue6197] test__locale fails with RADIXCHAR on Windows

2009-06-04 Thread James Abbatiello
New submission from James Abbatiello : regrtest.py test__locale fails with: test__locale test test__locale crashed -- : cannot import name RADIXCHAR 1 test failed: test__locale The attached patch backports the fix from issue5643 -- components: Tests, Windows files

[issue6134] 2to3 tests fail on Windows due to line endings

2009-05-27 Thread James Abbatiello
New submission from James Abbatiello : The tests for 2to3 currently fail on Windows. Data is read from a file in binary mode and then written to a temporary file in text mode which doubles up the carriage returns. Additionally, several files are missing the svn:eol-style property. The