[issue29218] distutils: Remove unused install_misc class

2017-01-11 Thread Greg Ward
Greg Ward added the comment: LGTM, after a cursory glance at the code history. Been a lng time since I understood this stuff deeply, though! -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue28702] Confusing error message when None used in expressions, eg. "'NoneType' object has no attribute 'foo'"

2016-11-21 Thread Greg Ward
Greg Ward added the comment: > Is it worth changing about 800 places in CPython code? Not counting > third-party code. Definitely not. My aim is not to fix every possible reference to "instance of 'NoneType'", just the handful of cases that are most frequently encountered,

[issue28702] Confusing error message when None used in expressions, eg. "'NoneType' object has no attribute 'foo'"

2016-11-15 Thread Greg Ward
Greg Ward added the comment: Based on a brief conversation with Brett Cannon at PyCon Canada the other day. Thanks for the idea, Brett! -- nosy: +brett.cannon ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue28702] Confusing error message when None used in expressions, eg. "'NoneType' object has no attribute 'foo'"

2016-11-15 Thread Greg Ward
New submission from Greg Ward: Python's error message when you let None accidentally sneak into an expression where it doesn't belong could be better. The canonical example is attribute lookup: >>> a = None >>> a.foo Traceback (most recent call last): File ""

[issue28700] test_dbm failure: KeyError: b'0' (intermittent in 3.5, reliable in 3.6)

2016-11-15 Thread Greg Ward
Changes by Greg Ward <g...@gerg.ca>: -- title: test_dbm failure: KeyError: b'0' (regression in 3.6) -> test_dbm failure: KeyError: b'0' (intermittent in 3.5, reliable in 3.6) ___ Python tracker <rep...@bugs.python.org> <http

[issue28700] test_dbm failure: KeyError: b'0' (regression in 3.6)

2016-11-15 Thread Greg Ward
Greg Ward added the comment: As suggested in http://bugs.python.org/issue14120, I installed libgdbm-dev, re-configured, and re-compiled. That fixes the problem. IMHO that's not good enough: if we're missing a dependency, then either configuring or building should fail. It's nice that the test

[issue28700] test_dbm failure: KeyError: b'0' (regression in 3.6)

2016-11-15 Thread Greg Ward
Greg Ward added the comment: Forgot to mention: I'm running: No LSB modules are available. Distributor ID: Ubuntu Description:Ubuntu 16.04.1 LTS Release:16.04 Codename: xenial with $ dpkg-query -W | grep dbm libgdbm3:amd64 1.8.3-13.1

[issue28700] test_dbm failure: KeyError: b'0' (regression in 3.6)

2016-11-15 Thread Greg Ward
New submission from Greg Ward: test_dbm.py fails reliably for me in 3.6, but in 3.5 it passes ~80% of the time. The failure in both cases is KeyError: b'0', which has come up previously in http://bugs.python.org/issue20094 and http://bugs.python.org/issue14120. But since we've switched from

[issue17445] Handle bytes comparisons in difflib.Differ

2015-04-20 Thread Greg Ward
Changes by Greg Ward g...@gerg.ca: -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17445

[issue17445] Handle bytes comparisons in difflib.Differ

2015-04-16 Thread Greg Ward
Greg Ward added the comment: Just uploaded https://bugs.python.org/file39083/fa4c6160c518.diff. Pretty sure I've addressed all of @berker.peksag's review comments: thanks for that! I also fixed a number of subtle bugs in the tests. Pro tip: when asserting that something raises TypeError

[issue17445] Handle bytes comparisons in difflib.Differ

2015-04-16 Thread Greg Ward
Changes by Greg Ward g...@gerg.ca: Added file: http://bugs.python.org/file39083/fa4c6160c518.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17445

[issue17445] Handle bytes comparisons in difflib.Differ

2015-04-15 Thread Greg Ward
Greg Ward added the comment: OK I've revived my patch and rebased on latest trunk. http://hg.gerg.ca/cpython/rev/13161c1d9c5f Comments welcome. I'll push this in a couple of days if nobody objects. -- ___ Python tracker rep...@bugs.python.org http

[issue2931] optparse: various problems with unicode and gettext

2015-04-15 Thread Greg Ward
Greg Ward added the comment: I've turned ash's test program into a bunch of test cases against Python 3.5 trunk. Is it worth committing them? Yeah, probably. Review comments... +try: +self.parser.error(RUSSIAN_TEXT) +except InterceptedError: +pass

[issue21775] shutil.copytree() crashes copying to VFAT on Linux: AttributeError: 'PermissionError' object has no attribute 'winerror'

2014-11-20 Thread Greg Ward
Greg Ward added the comment: Would it be possible to write a unit test, maybe using unittest.mock to mock most parts? Good idea! Turns out this was quite straightforward. The test patch is: --- a/Lib/test/test_shutil.py +++ b/Lib/test/test_shutil.py @@ -1,6 +1,7 @@ # Copyright (C) 2003

[issue21775] shutil.copytree() crashes copying to VFAT on Linux: AttributeError: 'PermissionError' object has no attribute 'winerror'

2014-11-20 Thread Greg Ward
Greg Ward added the comment: I'll commit on branch 3.4 and merge to default. Whoops, never mind. Looks like I don't have push permission to hg.python.org after all. It's been 8 years since my last commit, so I shouldn't complain. So... can someone with commit privs please hg pull -r

[issue21775] shutil.copytree() crashes copying to VFAT on Linux: AttributeError: 'PermissionError' object has no attribute 'winerror'

2014-06-15 Thread Greg Ward
New submission from Greg Ward: When using shutil.copytree() on Linux to copy to a VFAT filesystem, it crashes like this: Traceback (most recent call last): File /data/src/cpython/3.4/Lib/shutil.py, line 336, in copytree copystat(src, dst) File /data/src/cpython/3.4/Lib/shutil.py, line

[issue21775] shutil.copytree() crashes copying to VFAT on Linux: AttributeError: 'PermissionError' object has no attribute 'winerror'

2014-06-15 Thread Greg Ward
Greg Ward added the comment: In 3.3 and earlier, copytree() crashes roughly as described in issue1545, with shutil.Error that wraps the underlying Operation not permitted error from trying to chmod() something in a VFAT filesystem. Since this appears to accurately reflect what's coming from

[issue21775] shutil.copytree() crashes copying to VFAT on Linux: AttributeError: 'PermissionError' object has no attribute 'winerror'

2014-06-15 Thread Greg Ward
Greg Ward added the comment: Bad news: because reproducing this requires sudo (to mount an arbitrary filesystem), I'm not sure it's possible/desirable to add test code for it. Good news: the fix is trivial, and it passes my manual test. Here's a patch: --- a/Lib/shutil.py +++ b/Lib/shutil.py

[issue19536] MatchObject should offer __getitem__()

2013-11-10 Thread Greg Ward
Greg Ward added the comment: import this [...] There should be one-- and preferably only one --obvious way to do it. -- nosy: +gward ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19536

[issue17445] Handle bytes comparisons in difflib.Differ

2013-03-24 Thread Greg Ward
Greg Ward added the comment: I recommend the following: replace the simple test in the attached bytes_diff.py with Greg's unittest-based tests and adjust the __name__ == '__main__' incantation accordingly. Latest patch, following Terry's suggestion: http://hg.gerg.ca/cpython/rev

[issue17445] Return the type you accept

2013-03-18 Thread Greg Ward
Greg Ward added the comment: The original reproduction I posted was incorrect -- it makes difflib look worse than it should. (I passed strings rather than lists of strings.) Here is a more accurate version: import difflib a = [b'hello'] b = [b'hello!'] '\n'.join(line for line

[issue17445] Return the type you accept

2013-03-18 Thread Greg Ward
Greg Ward added the comment: Replying to Terry Reedy: So a dual string/bytes function would not be completely trivial. Correct. I have one working, but it makes my eyes bleed. I fail ashamed to have written it. Greg, can you convert bytes to strings, or strings to bytes Nope. Here

[issue17445] Return the type you accept

2013-03-18 Thread Greg Ward
Greg Ward added the comment: OK I now have two competing patches. Both are disgusting, but in different ways. 1) http://hg.gerg.ca/cpython/rev/fcf3d27f20d9 - factor out all the string constants - always concatenate, do not .format() 2) http://hg.gerg.ca/cpython/rev/cebefce2cfd4 - copy

[issue17445] Handle bytes comparisons in difflib.Differ

2013-03-18 Thread Greg Ward
Greg Ward added the comment: Take 3: http://hg.gerg.ca/cpython/rev/78bdb10551ee - uses surrogateescape as suggested by Antoine - seems to work -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17445

[issue17445] Handle bytes comparisons in difflib.Differ

2013-03-18 Thread Greg Ward
Greg Ward added the comment: Thanks for the review, Terry! Here is a revised patch, now on trunk: http://hg.gerg.ca/cpython/rev/6dedcdbe7cd5 I believe I have addressed all of your concerns. Note also that the tests now highlight some dubious behaviour. Further feedback is welcome! I'm

[issue17445] Return the type you accept

2013-03-17 Thread Greg Ward
Greg Ward added the comment: The particular use case that triggered this: Mercurial's test suite. It runs hg blah blah and compares the output against known good output. But Mercurial's output is just bytes, because pretty much everything in a Mercurial repo is just bytes (file data of course

[issue15510] textwrap.wrap('') returns empty list

2012-08-07 Thread Greg Ward
Greg Ward added the comment: Random comments from original author of textwrap.py, in case anyone cares at this point... * This is a pretty obscure edge case, and I admit that it never occurred to me when writing the code. (If it had, I would have tested it!) * One can debate endlessly about

[issue6454] Add example keyword argument to optparse constructor

2010-12-17 Thread Greg Ward
Greg Ward g...@gerg.ca added the comment: I understood Greg’s reply to mean that there was no need for an examples keyword if simple paragraph splitting was added. Right, but optparse has been superseded by argparse. So my opinion is even less important than it was before 2.7

[issue2236] Distutils' mkpath implementation ignoring the mode parameter

2010-08-26 Thread Greg Ward
Greg Ward g...@gerg.ca added the comment: I'm unassigning this since I no longer know how to commit changes to Python. Sorry, I just haven't kept track over the years, I don't follow python-dev anymore, and I could not find documentation explaining where I should commit what sort of changes

[issue2236] Distutils' mkpath implementation ignoring the mode parameter

2010-06-28 Thread Greg Ward
Greg Ward g...@gerg.ca added the comment: Is it too late for 2.7? I have no idea. It does look as though someone has written unit tests for distutils, so the patch needs a test change too. Henrique? -- stage: - unit test needed ___ Python

[issue1859] textwrap doesn't linebreak on \n

2009-11-28 Thread Greg Ward
Greg Ward g...@gerg.ca added the comment: Greg, any comment on this issue? Yes, two: 1) textwrap does not handle paragraphs or paragraph breaks in any way. That was a deliberate limitation to keep the code from getting any hairier. People have complained about this in the past, and I have

[issue6454] Add example keyword argument to optparse constructor

2009-11-22 Thread Greg Ward
Greg Ward g...@gerg.ca added the comment: but I feel there is a better and more general solution - just provide some minimal formatting for description: treat empty line as paragraph separator. Then I would be able to add example or anything else to the description formatting it as necessary

[issue5555] optparse

2009-06-30 Thread Greg Ward
Greg Ward g...@gerg.ca added the comment: This is an edited-down excerpt form the optparse documentation from: http://docs.python.org/library/optparse.html ... the traditional Unix syntax is a hyphen (“-“) followed by a single letter [...] Some other option syntaxes that the world has

[issue5555] optparse: clarify option concatenation in docs

2009-06-30 Thread Greg Ward
Changes by Greg Ward g...@gerg.ca: -- title: optparse - optparse: clarify option concatenation in docs ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue

[issue1704474] test_optparse.py mod. for jython

2009-06-01 Thread Greg Ward
Greg Ward g...@gerg.ca added the comment: I just took a look at the original patch uploaded by drtimcouper. IMHO it would be cleaner and simpler to modify optparse.py so that it behaves as consistently as possible under Jython and CPython. For example, optparse should catch the ValueError

[issue1704474] optparse tests fail under Jython

2009-06-01 Thread Greg Ward
Changes by Greg Ward g...@gerg.ca: -- components: +Library (Lib) -Tests title: test_optparse.py mod. for jython - optparse tests fail under Jython ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1704474

ANNOUNCE: Optik 1.5.3

2006-07-24 Thread Greg Ward
Python svn repository: fix unit test so it doesn't screw up other tests in the Python test suite. 1.5.2 (22 Jul 2006) --- * Minor documentation tweaks. * SF bug #1498146: handle Unicode help strings (affects option help, description, and epilog). -- Greg Ward [EMAIL

ANNOUNCE: Optik 1.5.1

2006-04-19 Thread Greg Ward
'epilog' attribute to OptionParser (and constructor arg): paragraph of text to print after the main option help. * Corrected French translation (po/optik/fr.po) (Laurent Laporte). * Beefed up reference guide. * Backported to Python 2.0/2.1 (Giovanni Bajo). Greg -- Greg Ward